@@ -2,8 +2,9 @@ package com.x8bit.bitwarden.data.platform.manager.model
2
2
3
3
import com.x8bit.bitwarden.data.platform.manager.PushManager
4
4
import kotlinx.serialization.Contextual
5
- import kotlinx.serialization.SerialName
5
+ import kotlinx.serialization.ExperimentalSerializationApi
6
6
import kotlinx.serialization.Serializable
7
+ import kotlinx.serialization.json.JsonNames
7
8
import java.time.ZonedDateTime
8
9
9
10
/* *
@@ -12,6 +13,7 @@ import java.time.ZonedDateTime
12
13
* Note: The data we receive is not always reliable, so everything is nullable and we validate the
13
14
* data in the [PushManager] as necessary.
14
15
*/
16
+ @OptIn(ExperimentalSerializationApi ::class )
15
17
@Serializable
16
18
sealed class NotificationPayload {
17
19
/* *
@@ -24,52 +26,52 @@ sealed class NotificationPayload {
24
26
*/
25
27
@Serializable
26
28
data class SyncCipherNotification (
27
- @SerialName (" Id" ) val cipherId : String? ,
28
- @SerialName (" UserId" ) override val userId : String? ,
29
- @SerialName (" OrganizationId" ) val organizationId : String? ,
30
- @SerialName (" CollectionIds" ) val collectionIds : List <String >? ,
29
+ @JsonNames (" Id" , " id " ) val cipherId : String? ,
30
+ @JsonNames (" UserId" , " userId " ) override val userId : String? ,
31
+ @JsonNames (" OrganizationId" , " organizationId " ) val organizationId : String? ,
32
+ @JsonNames (" CollectionIds" , " collectionIds " ) val collectionIds : List <String >? ,
31
33
@Contextual
32
- @SerialName (" RevisionDate" ) val revisionDate : ZonedDateTime ? ,
34
+ @JsonNames (" RevisionDate" , " revisionDate " ) val revisionDate : ZonedDateTime ? ,
33
35
) : NotificationPayload()
34
36
35
37
/* *
36
38
* A notification payload for sync folder operations.
37
39
*/
38
40
@Serializable
39
41
data class SyncFolderNotification (
40
- @SerialName (" Id" ) val folderId : String? ,
41
- @SerialName (" UserId" ) override val userId : String? ,
42
+ @JsonNames (" Id" , " id " ) val folderId : String? ,
43
+ @JsonNames (" UserId" , " userId " ) override val userId : String? ,
42
44
@Contextual
43
- @SerialName (" RevisionDate" ) val revisionDate : ZonedDateTime ? ,
45
+ @JsonNames (" RevisionDate" , " revisionDate " ) val revisionDate : ZonedDateTime ? ,
44
46
) : NotificationPayload()
45
47
46
48
/* *
47
49
* A notification payload for user-based operations.
48
50
*/
49
51
@Serializable
50
52
data class UserNotification (
51
- @SerialName (" UserId" ) override val userId : String? ,
53
+ @JsonNames (" UserId" , " userId " ) override val userId : String? ,
52
54
@Contextual
53
- @SerialName (" Date" ) val date : ZonedDateTime ? ,
55
+ @JsonNames (" Date" , " date " ) val date : ZonedDateTime ? ,
54
56
) : NotificationPayload()
55
57
56
58
/* *
57
59
* A notification payload for sync send operations.
58
60
*/
59
61
@Serializable
60
62
data class SyncSendNotification (
61
- @SerialName (" Id" ) val sendId : String? ,
62
- @SerialName (" UserId" ) override val userId : String? ,
63
+ @JsonNames (" Id" , " id " ) val sendId : String? ,
64
+ @JsonNames (" UserId" , " userId " ) override val userId : String? ,
63
65
@Contextual
64
- @SerialName (" RevisionDate" ) val revisionDate : ZonedDateTime ? ,
66
+ @JsonNames (" RevisionDate" , " revisionDate " ) val revisionDate : ZonedDateTime ? ,
65
67
) : NotificationPayload()
66
68
67
69
/* *
68
70
* A notification payload for passwordless requests.
69
71
*/
70
72
@Serializable
71
73
data class PasswordlessRequestNotification (
72
- @SerialName (" UserId" ) override val userId : String? ,
73
- @SerialName (" Id" ) val loginRequestId : String? ,
74
+ @JsonNames (" UserId" , " userId " ) override val userId : String? ,
75
+ @JsonNames (" Id" , " id " ) val loginRequestId : String? ,
74
76
) : NotificationPayload()
75
77
}
0 commit comments