@@ -4,190 +4,244 @@ import com.simplito.java.privmx_endpoint_extra.events.EventType
44import Stacks.JavaKotlin.endpointSession
55
66// START: Connection events snippets
7- fun handlingConnectionEvents (){
7+ fun handlingConnectionEvents () {
88 val callbacksId = " CALLBACKS_ID"
99
1010 endpointSession.registerCallback(
1111 callbacksId,
1212 EventType .ConnectedEvent
13- ){
13+ ) {
1414 // some actions when lib was connected
1515 }
1616
1717 endpointSession.registerCallback(
1818 callbacksId,
1919 EventType .DisconnectedEvent
20- ){
20+ ) {
2121 // some actions when lib was disconnected
2222 }
2323}
2424// END: Connection events snippets
2525
2626
2727// START: Threads events snippets
28- fun handlingThreadEvents (){
28+ fun handlingThreadEvents () {
2929 val callbacksId = " CALLBACKS_ID"
3030
3131 endpointSession.registerCallback(
3232 callbacksId,
3333 EventType .ThreadCreatedEvent
34- ){ newThreadData ->
34+ ) { newThreadData ->
3535 // some actions when new thread created
3636 }
3737
3838 endpointSession.registerCallback(
3939 callbacksId,
4040 EventType .ThreadUpdatedEvent
41- ){ threadUpdateData ->
41+ ) { threadUpdateData ->
4242 // some actions when thread updated
4343 }
4444
4545 endpointSession.registerCallback(
4646 callbacksId,
4747 EventType .ThreadStatsChangedEvent
48- ){ threadStatsUpdateData ->
48+ ) { threadStatsUpdateData ->
4949 // some actions when thread stats changed
5050 }
5151
5252 endpointSession.registerCallback(
5353 callbacksId,
5454 EventType .ThreadDeletedEvent
55- ){ deletedThreadData ->
55+ ) { deletedThreadData ->
5656 // some actions when thread deleted
5757 }
5858}
5959
60- fun handlingMessageEvents (){
60+ fun handlingMessageEvents () {
6161 val callbacksId = " CALLBACKS_ID"
6262 val threadID = " THREAD_ID"
6363
6464 endpointSession.registerCallback(
6565 callbacksId,
6666 EventType .ThreadNewMessageEvent (threadID)
67- ){ newMessageData ->
67+ ) { newMessageData ->
6868 // some actions on new message
6969 }
7070
7171 endpointSession.registerCallback(
7272 callbacksId,
7373 EventType .ThreadMessageUpdatedEvent (threadID)
74- ){ updatedMessageData ->
74+ ) { updatedMessageData ->
7575 // some actions when message updated
7676 }
7777
7878 endpointSession.registerCallback(
7979 callbacksId,
8080 EventType .ThreadMessageDeletedEvent (threadID)
81- ){ deletedMessageData ->
81+ ) { deletedMessageData ->
8282 // some actions when message deleted
8383 }
8484}
8585// END: Threads events snippets
8686
8787
8888// START: Stores events snippets
89- fun handlingStoreEvents (){
89+ fun handlingStoreEvents () {
9090 val callbacksId = " CALLBACKS_ID"
9191
9292 endpointSession.registerCallback(
9393 callbacksId,
9494 EventType .StoreCreatedEvent
95- ){ newStoreData ->
95+ ) { newStoreData ->
9696 // some actions when new store created
9797 }
9898
9999 endpointSession.registerCallback(
100100 callbacksId,
101101 EventType .StoreUpdatedEvent
102- ){ storeUpdateData ->
102+ ) { storeUpdateData ->
103103 // some actions when store updated
104104 }
105105
106106 endpointSession.registerCallback(
107107 callbacksId,
108108 EventType .StoreStatsChangedEvent
109- ){ storeStatsUpdateData ->
109+ ) { storeStatsUpdateData ->
110110 // some actions when store stats changed
111111 }
112112
113113 endpointSession.registerCallback(
114114 callbacksId,
115115 EventType .StoreDeletedEvent
116- ){ deletedStoreData ->
116+ ) { deletedStoreData ->
117117 // some actions when store deleted
118118 }
119119}
120120
121- fun handlingFileEvents (){
121+ fun handlingFileEvents () {
122122 val callbacksId = " CALLBACKS_ID"
123123 val storeID = " STORE_ID"
124124
125125 endpointSession.registerCallback(
126126 callbacksId,
127127 EventType .StoreFileCreatedEvent (storeID)
128- ){ newFileData ->
128+ ) { newFileData ->
129129 // some actions on new file
130130 }
131131
132132 endpointSession.registerCallback(
133133 callbacksId,
134134 EventType .StoreFileUpdatedEvent (storeID)
135- ){ updatedFileData ->
135+ ) { updatedFileData ->
136136 // some actions when file updated
137137 }
138138
139139 endpointSession.registerCallback(
140140 callbacksId,
141141 EventType .StoreFileDeletedEvent (storeID)
142- ){ deletedFileData ->
142+ ) { deletedFileData ->
143143 // some actions when file deleted
144144 }
145145}
146146// END: Stores events snippets
147147
148148
149149// START: Inboxes events snippets
150- fun handlingInboxEvents (){
150+ fun handlingInboxEvents () {
151151 val callbacksId = " CALLBACKS_ID"
152152
153153 endpointSession.registerCallback(
154154 callbacksId,
155155 EventType .InboxCreatedEvent
156- ){ newInboxData ->
156+ ) { newInboxData ->
157157 // some actions when new inbox created
158158 }
159159
160160 endpointSession.registerCallback(
161161 callbacksId,
162162 EventType .InboxUpdatedEvent
163- ){ inboxUpdateData ->
163+ ) { inboxUpdateData ->
164164 // some actions when inbox updated
165165 }
166166
167167 endpointSession.registerCallback(
168168 callbacksId,
169169 EventType .InboxDeletedEvent
170- ){ deletedInboxData ->
170+ ) { deletedInboxData ->
171171 // some actions when inbox deleted
172172 }
173173}
174174
175- fun handlingEntriesEvents (){
175+ fun handlingEntriesEvents () {
176176 val callbacksId = " CALLBACKS_ID"
177177 val inboxID = " INBOX_ID"
178178
179179 endpointSession.registerCallback(
180180 callbacksId,
181181 EventType .InboxEntryCreatedEvent (inboxID)
182- ){ newEntryData ->
182+ ) { newEntryData ->
183183 // some actions on new entry
184184 }
185185
186186 endpointSession.registerCallback(
187187 callbacksId,
188188 EventType .InboxEntryDeletedEvent (inboxID)
189- ){ deletedEntryData ->
189+ ) { deletedEntryData ->
190190 // some actions when entry deleted
191191 }
192192}
193- // END: Inboxes events snippets
193+ // END: Inboxes events snippets
194+
195+
196+ // START: KVDBs events snippets
197+ fun handlingKvdbsEvents () {
198+ val callbacksId = " CALLBACKS_ID"
199+
200+ endpointSession.registerCallback(
201+ callbacksId,
202+ EventType .KvdbCreatedEvent
203+ ) { kvdbCreatedData ->
204+ // some actions when new KVDB created
205+ }
206+
207+ endpointSession.registerCallback(
208+ callbacksId,
209+ EventType .KvdbUpdatedEvent
210+ ) { kvdbUpdatedData ->
211+ // some actions when KVDB updated
212+ }
213+
214+ endpointSession.registerCallback(
215+ callbacksId,
216+ EventType .KvdbDeletedEvent
217+ ) { kvdbDeletedData ->
218+ // some actions when KVDB deleted
219+ }
220+ }
221+
222+ fun handlingKvdbEntriesEvents () {
223+ val callbacksId = " CALLBACKS_ID"
224+ val kvdbID = " KVDB_ID"
225+
226+ endpointSession.registerCallback(
227+ callbacksId,
228+ EventType .KvdbNewEntryEvent (kvdbID)
229+ ) { newEntryData ->
230+ // some actions on new KVDB entry
231+ }
232+
233+ endpointSession.registerCallback(
234+ callbacksId,
235+ EventType .KvdbEntryUpdatedEvent (kvdbID)
236+ ) { updatedEntryData ->
237+ // some actions when KVDB entry updated
238+ }
239+
240+ endpointSession.registerCallback(
241+ callbacksId,
242+ EventType .KvdbEntryDeletedEvent (kvdbID)
243+ ) { deletedEntryData ->
244+ // some actions when KVDB entry deleted
245+ }
246+ }
247+ // END: KVDBs events snippets
0 commit comments