|
1 | 1 | package com.pubnub.api.builder
|
2 | 2 |
|
3 | 3 | // basic publish/subscribe class
|
4 |
| - |
5 |
| -internal abstract class PubSubOperation( |
6 |
| - internal val channels: List<String> = emptyList(), |
7 |
| - internal val channelGroups: List<String> = emptyList() |
8 |
| -) |
| 4 | +internal sealed class PubSubOperation |
9 | 5 |
|
10 | 6 | // concrete publish/subscribe cases
|
| 7 | +internal data class SubscribeOperation( |
| 8 | + val channels: List<String> = emptyList(), |
| 9 | + val channelGroups: List<String> = emptyList(), |
| 10 | + val presenceEnabled: Boolean = false, |
| 11 | + val timetoken: Long = 0L |
| 12 | +) : PubSubOperation() |
| 13 | + |
| 14 | +internal data class UnsubscribeOperation( |
| 15 | + val channels: List<String> = emptyList(), |
| 16 | + val channelGroups: List<String> = emptyList() |
| 17 | +) : PubSubOperation() |
| 18 | + |
| 19 | +internal data class PresenceOperation( |
| 20 | + val channels: List<String> = emptyList(), |
| 21 | + val channelGroups: List<String> = emptyList(), |
| 22 | + val connected: Boolean = false |
| 23 | +) : PubSubOperation() |
11 | 24 |
|
12 |
| -internal class SubscribeOperation( |
13 |
| - channels: List<String> = emptyList(), |
14 |
| - channelGroups: List<String> = emptyList(), |
15 |
| - internal val presenceEnabled: Boolean = false, |
16 |
| - internal val timetoken: Long = 0L |
17 |
| -) : PubSubOperation(channels, channelGroups) |
18 |
| - |
19 |
| -internal class UnsubscribeOperation( |
20 |
| - channels: List<String> = emptyList(), |
21 |
| - channelGroups: List<String> = emptyList() |
22 |
| -) : PubSubOperation(channels, channelGroups) |
23 |
| - |
24 |
| -internal class PresenceOperation( |
25 |
| - channels: List<String> = emptyList(), |
26 |
| - channelGroups: List<String> = emptyList(), |
27 |
| - internal val connected: Boolean = false |
28 |
| -) : PubSubOperation(channels, channelGroups) |
29 |
| - |
30 |
| -internal class StateOperation( |
31 |
| - channels: List<String> = emptyList(), |
32 |
| - channelGroups: List<String> = emptyList(), |
| 25 | +internal data class StateOperation( |
| 26 | + val channels: List<String> = emptyList(), |
| 27 | + val channelGroups: List<String> = emptyList(), |
33 | 28 | val state: Any? = null
|
34 |
| -) : PubSubOperation(channels, channelGroups) |
| 29 | +) : PubSubOperation() |
| 30 | + |
| 31 | +internal data class TimetokenRegionOperation( |
| 32 | + val timetoken: Long = 0L, |
| 33 | + val region: String |
| 34 | +) : PubSubOperation() |
| 35 | + |
| 36 | +internal object ConnectedStatusAnnouncedOperation : PubSubOperation() |
| 37 | + |
| 38 | +internal object NoOpOperation : PubSubOperation() |
0 commit comments