ffi-bindings 1.0.3 → 1.0.4

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,816 @@
1
+ // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
2
+ // Trust me, you don't want to mess with it!
3
+
4
+ /* tslint:disable */
5
+ /* eslint-disable */
6
+ // @ts-nocheck
7
+ import * as wasmBundle from "./wasm-bindgen/index.js";
8
+ import {
9
+ type UniffiByteArray,
10
+ AbstractFfiConverterByteArray,
11
+ FfiConverterBool,
12
+ FfiConverterInt32,
13
+ RustBuffer,
14
+ UniffiEnum,
15
+ UniffiInternalError,
16
+ UniffiRustCaller,
17
+ uniffiCreateFfiConverterString,
18
+ uniffiTypeNameSymbol } from "uniffi-bindgen-react-native";
19
+
20
+ // Get converters from the other files, if any.
21
+ const nativeModule = () => wasmBundle;
22
+ const uniffiCaller = new UniffiRustCaller(() => new wasmBundle.RustCallStatus());
23
+
24
+ const uniffiIsDebug =
25
+ // @ts-ignore -- The process global might not be defined
26
+ typeof process !== "object" ||
27
+ // @ts-ignore -- The process global might not be defined
28
+ process?.env?.NODE_ENV !== "production" ||
29
+ false;
30
+ // Public interface members begin here.
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+ const stringConverter = (() => {
39
+ const encoder = new TextEncoder();
40
+ const decoder = new TextDecoder();
41
+ return {
42
+ stringToBytes: (s: string) => encoder.encode(s),
43
+ bytesToString: (ab: UniffiByteArray) => decoder.decode(ab),
44
+ stringByteLength: (s: string) => encoder.encode(s).byteLength,
45
+ };
46
+ })();
47
+ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
48
+
49
+
50
+ /**
51
+ * Where this event came.
52
+ */
53
+ export enum EventItemOrigin {
54
+ /**
55
+ * The event was created locally.
56
+ */
57
+ Local,
58
+ /**
59
+ * The event came from a sync response.
60
+ */
61
+ Sync,
62
+ /**
63
+ * The event came from pagination.
64
+ */
65
+ Pagination,
66
+ /**
67
+ * The event came from a cache.
68
+ */
69
+ Cache
70
+ }
71
+
72
+ const FfiConverterTypeEventItemOrigin = (() => {
73
+ const ordinalConverter = FfiConverterInt32;
74
+ type TypeName = EventItemOrigin;
75
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
76
+ read(from: RustBuffer): TypeName {
77
+ switch (ordinalConverter.read(from)) {
78
+ case 1: return EventItemOrigin.Local;
79
+ case 2: return EventItemOrigin.Sync;
80
+ case 3: return EventItemOrigin.Pagination;
81
+ case 4: return EventItemOrigin.Cache;
82
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
83
+ }
84
+ }
85
+ write(value: TypeName, into: RustBuffer): void {
86
+ switch (value) {
87
+ case EventItemOrigin.Local: return ordinalConverter.write(1, into);
88
+ case EventItemOrigin.Sync: return ordinalConverter.write(2, into);
89
+ case EventItemOrigin.Pagination: return ordinalConverter.write(3, into);
90
+ case EventItemOrigin.Cache: return ordinalConverter.write(4, into);
91
+ }
92
+ }
93
+ allocationSize(value: TypeName): number {
94
+ return ordinalConverter.allocationSize(0);
95
+ }
96
+ }
97
+ return new FFIConverter();
98
+ })();
99
+
100
+
101
+
102
+
103
+
104
+ export enum LatestEventValueLocalState {
105
+ IsSending,
106
+ HasBeenSent,
107
+ CannotBeSent
108
+ }
109
+
110
+ const FfiConverterTypeLatestEventValueLocalState = (() => {
111
+ const ordinalConverter = FfiConverterInt32;
112
+ type TypeName = LatestEventValueLocalState;
113
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
114
+ read(from: RustBuffer): TypeName {
115
+ switch (ordinalConverter.read(from)) {
116
+ case 1: return LatestEventValueLocalState.IsSending;
117
+ case 2: return LatestEventValueLocalState.HasBeenSent;
118
+ case 3: return LatestEventValueLocalState.CannotBeSent;
119
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
120
+ }
121
+ }
122
+ write(value: TypeName, into: RustBuffer): void {
123
+ switch (value) {
124
+ case LatestEventValueLocalState.IsSending: return ordinalConverter.write(1, into);
125
+ case LatestEventValueLocalState.HasBeenSent: return ordinalConverter.write(2, into);
126
+ case LatestEventValueLocalState.CannotBeSent: return ordinalConverter.write(3, into);
127
+ }
128
+ }
129
+ allocationSize(value: TypeName): number {
130
+ return ordinalConverter.allocationSize(0);
131
+ }
132
+ }
133
+ return new FFIConverter();
134
+ })();
135
+
136
+
137
+
138
+
139
+
140
+ /**
141
+ * The type of change between the previous and current pinned events.
142
+ */
143
+ export enum RoomPinnedEventsChange {
144
+ /**
145
+ * Only new event ids were added.
146
+ */
147
+ Added,
148
+ /**
149
+ * Only event ids were removed.
150
+ */
151
+ Removed,
152
+ /**
153
+ * Some change other than only adding or only removing ids happened.
154
+ */
155
+ Changed
156
+ }
157
+
158
+ const FfiConverterTypeRoomPinnedEventsChange = (() => {
159
+ const ordinalConverter = FfiConverterInt32;
160
+ type TypeName = RoomPinnedEventsChange;
161
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
162
+ read(from: RustBuffer): TypeName {
163
+ switch (ordinalConverter.read(from)) {
164
+ case 1: return RoomPinnedEventsChange.Added;
165
+ case 2: return RoomPinnedEventsChange.Removed;
166
+ case 3: return RoomPinnedEventsChange.Changed;
167
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
168
+ }
169
+ }
170
+ write(value: TypeName, into: RustBuffer): void {
171
+ switch (value) {
172
+ case RoomPinnedEventsChange.Added: return ordinalConverter.write(1, into);
173
+ case RoomPinnedEventsChange.Removed: return ordinalConverter.write(2, into);
174
+ case RoomPinnedEventsChange.Changed: return ordinalConverter.write(3, into);
175
+ }
176
+ }
177
+ allocationSize(value: TypeName): number {
178
+ return ordinalConverter.allocationSize(0);
179
+ }
180
+ }
181
+ return new FFIConverter();
182
+ })();
183
+
184
+
185
+
186
+
187
+
188
+ // Enum: SpaceRoomListPaginationState
189
+ export enum SpaceRoomListPaginationState_Tags {
190
+ Idle = "Idle",
191
+ Loading = "Loading"
192
+ }
193
+ export const SpaceRoomListPaginationState = (() => {
194
+
195
+
196
+ type Idle__interface = {
197
+ tag: SpaceRoomListPaginationState_Tags.Idle;
198
+ inner: Readonly<{endReached: boolean}>
199
+ };
200
+
201
+
202
+ class Idle_ extends UniffiEnum implements Idle__interface {
203
+ /**
204
+ * @private
205
+ * This field is private and should not be used, use `tag` instead.
206
+ */
207
+ readonly [uniffiTypeNameSymbol] = "SpaceRoomListPaginationState";
208
+ readonly tag = SpaceRoomListPaginationState_Tags.Idle;
209
+ readonly inner: Readonly<{endReached: boolean}>;
210
+ constructor(inner: { endReached: boolean }) {
211
+ super("SpaceRoomListPaginationState", "Idle");
212
+ this.inner = Object.freeze(inner);
213
+ }
214
+
215
+ static new(inner: { endReached: boolean }): Idle_ {
216
+ return new Idle_(inner);
217
+ }
218
+
219
+ static instanceOf(obj: any): obj is Idle_ {
220
+ return obj.tag === SpaceRoomListPaginationState_Tags.Idle;
221
+ }
222
+
223
+
224
+
225
+
226
+ }
227
+
228
+
229
+ type Loading__interface = {
230
+ tag: SpaceRoomListPaginationState_Tags.Loading
231
+ };
232
+
233
+
234
+ class Loading_ extends UniffiEnum implements Loading__interface {
235
+ /**
236
+ * @private
237
+ * This field is private and should not be used, use `tag` instead.
238
+ */
239
+ readonly [uniffiTypeNameSymbol] = "SpaceRoomListPaginationState";
240
+ readonly tag = SpaceRoomListPaginationState_Tags.Loading;
241
+ constructor() {
242
+ super("SpaceRoomListPaginationState", "Loading");
243
+ }
244
+
245
+ static new(): Loading_ {
246
+ return new Loading_();
247
+ }
248
+
249
+ static instanceOf(obj: any): obj is Loading_ {
250
+ return obj.tag === SpaceRoomListPaginationState_Tags.Loading;
251
+ }
252
+
253
+
254
+
255
+
256
+ }
257
+
258
+ function instanceOf(obj: any): obj is SpaceRoomListPaginationState {
259
+ return obj[uniffiTypeNameSymbol] === "SpaceRoomListPaginationState";
260
+ }
261
+
262
+ return Object.freeze({
263
+ instanceOf,
264
+ Idle: Idle_,
265
+ Loading: Loading_
266
+ });
267
+
268
+ })();
269
+
270
+
271
+
272
+ export type SpaceRoomListPaginationState = InstanceType<
273
+ typeof SpaceRoomListPaginationState[keyof Omit<typeof SpaceRoomListPaginationState, 'instanceOf'>]
274
+ >;
275
+
276
+ // FfiConverter for enum SpaceRoomListPaginationState
277
+ const FfiConverterTypeSpaceRoomListPaginationState = (() => {
278
+ const ordinalConverter = FfiConverterInt32;
279
+ type TypeName = SpaceRoomListPaginationState;
280
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
281
+ read(from: RustBuffer): TypeName {
282
+ switch (ordinalConverter.read(from)) {
283
+ case 1: return new SpaceRoomListPaginationState.Idle({endReached: FfiConverterBool.read(from) });
284
+ case 2: return new SpaceRoomListPaginationState.Loading();
285
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
286
+ }
287
+ }
288
+ write(value: TypeName, into: RustBuffer): void {
289
+ switch (value.tag) {
290
+ case SpaceRoomListPaginationState_Tags.Idle: {
291
+ ordinalConverter.write(1, into);
292
+ const inner = value.inner;
293
+ FfiConverterBool.write(inner.endReached, into);
294
+ return;
295
+ }
296
+ case SpaceRoomListPaginationState_Tags.Loading: {
297
+ ordinalConverter.write(2, into);
298
+ return;
299
+ }
300
+ default:
301
+ // Throwing from here means that SpaceRoomListPaginationState_Tags hasn't matched an ordinal.
302
+ throw new UniffiInternalError.UnexpectedEnumCase();
303
+ }
304
+ }
305
+ allocationSize(value: TypeName): number {
306
+ switch (value.tag) {
307
+ case SpaceRoomListPaginationState_Tags.Idle: {
308
+ const inner = value.inner;
309
+ let size = ordinalConverter.allocationSize(1);
310
+ size += FfiConverterBool.allocationSize(inner.endReached);
311
+ return size;
312
+ }
313
+ case SpaceRoomListPaginationState_Tags.Loading: {
314
+ return ordinalConverter.allocationSize(2);
315
+ }
316
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
317
+ }
318
+ }
319
+ }
320
+ return new FFIConverter();
321
+ })();
322
+
323
+
324
+
325
+ // Enum: ThreadListPaginationState
326
+ export enum ThreadListPaginationState_Tags {
327
+ Idle = "Idle",
328
+ Loading = "Loading"
329
+ }
330
+ /**
331
+ * The pagination state of a [`ThreadListService`].
332
+ */
333
+ export const ThreadListPaginationState = (() => {
334
+
335
+
336
+ type Idle__interface = {
337
+ tag: ThreadListPaginationState_Tags.Idle;
338
+ inner: Readonly<{endReached: boolean}>
339
+ };
340
+
341
+
342
+ /**
343
+ * The list is idle (not currently loading).
344
+ */
345
+ class Idle_ extends UniffiEnum implements Idle__interface {
346
+ /**
347
+ * @private
348
+ * This field is private and should not be used, use `tag` instead.
349
+ */
350
+ readonly [uniffiTypeNameSymbol] = "ThreadListPaginationState";
351
+ readonly tag = ThreadListPaginationState_Tags.Idle;
352
+ readonly inner: Readonly<{endReached: boolean}>;
353
+ constructor(inner: {
354
+ /**
355
+ * Whether the end of the thread list has been reached (no more pages
356
+ * to load).
357
+ */endReached: boolean }) {
358
+ super("ThreadListPaginationState", "Idle");
359
+ this.inner = Object.freeze(inner);
360
+ }
361
+
362
+ static new(inner: {
363
+ /**
364
+ * Whether the end of the thread list has been reached (no more pages
365
+ * to load).
366
+ */endReached: boolean }): Idle_ {
367
+ return new Idle_(inner);
368
+ }
369
+
370
+ static instanceOf(obj: any): obj is Idle_ {
371
+ return obj.tag === ThreadListPaginationState_Tags.Idle;
372
+ }
373
+
374
+
375
+
376
+
377
+ }
378
+
379
+
380
+ type Loading__interface = {
381
+ tag: ThreadListPaginationState_Tags.Loading
382
+ };
383
+
384
+
385
+ /**
386
+ * The list is currently loading the next page.
387
+ */
388
+ class Loading_ extends UniffiEnum implements Loading__interface {
389
+ /**
390
+ * @private
391
+ * This field is private and should not be used, use `tag` instead.
392
+ */
393
+ readonly [uniffiTypeNameSymbol] = "ThreadListPaginationState";
394
+ readonly tag = ThreadListPaginationState_Tags.Loading;
395
+ constructor() {
396
+ super("ThreadListPaginationState", "Loading");
397
+ }
398
+
399
+ static new(): Loading_ {
400
+ return new Loading_();
401
+ }
402
+
403
+ static instanceOf(obj: any): obj is Loading_ {
404
+ return obj.tag === ThreadListPaginationState_Tags.Loading;
405
+ }
406
+
407
+
408
+
409
+
410
+ }
411
+
412
+ function instanceOf(obj: any): obj is ThreadListPaginationState {
413
+ return obj[uniffiTypeNameSymbol] === "ThreadListPaginationState";
414
+ }
415
+
416
+ return Object.freeze({
417
+ instanceOf,
418
+ Idle: Idle_,
419
+ Loading: Loading_
420
+ });
421
+
422
+ })();
423
+
424
+
425
+ /**
426
+ * The pagination state of a [`ThreadListService`].
427
+ */
428
+
429
+ export type ThreadListPaginationState = InstanceType<
430
+ typeof ThreadListPaginationState[keyof Omit<typeof ThreadListPaginationState, 'instanceOf'>]
431
+ >;
432
+
433
+ // FfiConverter for enum ThreadListPaginationState
434
+ const FfiConverterTypeThreadListPaginationState = (() => {
435
+ const ordinalConverter = FfiConverterInt32;
436
+ type TypeName = ThreadListPaginationState;
437
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
438
+ read(from: RustBuffer): TypeName {
439
+ switch (ordinalConverter.read(from)) {
440
+ case 1: return new ThreadListPaginationState.Idle({endReached: FfiConverterBool.read(from) });
441
+ case 2: return new ThreadListPaginationState.Loading();
442
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
443
+ }
444
+ }
445
+ write(value: TypeName, into: RustBuffer): void {
446
+ switch (value.tag) {
447
+ case ThreadListPaginationState_Tags.Idle: {
448
+ ordinalConverter.write(1, into);
449
+ const inner = value.inner;
450
+ FfiConverterBool.write(inner.endReached, into);
451
+ return;
452
+ }
453
+ case ThreadListPaginationState_Tags.Loading: {
454
+ ordinalConverter.write(2, into);
455
+ return;
456
+ }
457
+ default:
458
+ // Throwing from here means that ThreadListPaginationState_Tags hasn't matched an ordinal.
459
+ throw new UniffiInternalError.UnexpectedEnumCase();
460
+ }
461
+ }
462
+ allocationSize(value: TypeName): number {
463
+ switch (value.tag) {
464
+ case ThreadListPaginationState_Tags.Idle: {
465
+ const inner = value.inner;
466
+ let size = ordinalConverter.allocationSize(1);
467
+ size += FfiConverterBool.allocationSize(inner.endReached);
468
+ return size;
469
+ }
470
+ case ThreadListPaginationState_Tags.Loading: {
471
+ return ordinalConverter.allocationSize(2);
472
+ }
473
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
474
+ }
475
+ }
476
+ }
477
+ return new FFIConverter();
478
+ })();
479
+
480
+
481
+
482
+ // Enum: TimelineEventFocusThreadMode
483
+ export enum TimelineEventFocusThreadMode_Tags {
484
+ ForceThread = "ForceThread",
485
+ Automatic = "Automatic"
486
+ }
487
+ /**
488
+ * Options for controlling the behaviour of [`TimelineFocus::Event`]
489
+ * for threaded events.
490
+ */
491
+ export const TimelineEventFocusThreadMode = (() => {
492
+
493
+
494
+ type ForceThread__interface = {
495
+ tag: TimelineEventFocusThreadMode_Tags.ForceThread
496
+ };
497
+
498
+
499
+ /**
500
+ * Force the timeline into threaded mode.
501
+ *
502
+ * When the focused event is part of a thread, the timeline will be focused
503
+ * on that thread's root. Otherwise, the timeline will treat the target
504
+ * event itself as the thread root. Threaded events will never be
505
+ * hidden.
506
+ */
507
+ class ForceThread_ extends UniffiEnum implements ForceThread__interface {
508
+ /**
509
+ * @private
510
+ * This field is private and should not be used, use `tag` instead.
511
+ */
512
+ readonly [uniffiTypeNameSymbol] = "TimelineEventFocusThreadMode";
513
+ readonly tag = TimelineEventFocusThreadMode_Tags.ForceThread;
514
+ constructor() {
515
+ super("TimelineEventFocusThreadMode", "ForceThread");
516
+ }
517
+
518
+ static new(): ForceThread_ {
519
+ return new ForceThread_();
520
+ }
521
+
522
+ static instanceOf(obj: any): obj is ForceThread_ {
523
+ return obj.tag === TimelineEventFocusThreadMode_Tags.ForceThread;
524
+ }
525
+
526
+
527
+
528
+
529
+ }
530
+
531
+
532
+ type Automatic__interface = {
533
+ tag: TimelineEventFocusThreadMode_Tags.Automatic;
534
+ inner: Readonly<{hideThreadedEvents: boolean}>
535
+ };
536
+
537
+
538
+ /**
539
+ * Automatically determine if the target event is part of a thread or not.
540
+ *
541
+ * If the event is part of a thread, the timeline
542
+ * will be filtered to on-thread events.
543
+ */
544
+ class Automatic_ extends UniffiEnum implements Automatic__interface {
545
+ /**
546
+ * @private
547
+ * This field is private and should not be used, use `tag` instead.
548
+ */
549
+ readonly [uniffiTypeNameSymbol] = "TimelineEventFocusThreadMode";
550
+ readonly tag = TimelineEventFocusThreadMode_Tags.Automatic;
551
+ readonly inner: Readonly<{hideThreadedEvents: boolean}>;
552
+ constructor(inner: {
553
+ /**
554
+ * When the target event is not part of a thread, whether to
555
+ * hide in-thread replies from the live timeline.
556
+ *
557
+ * Has no effect when the target event is part of a thread.
558
+ *
559
+ * This should be set to true when the client can create
560
+ * [`TimelineFocus::Thread`]-focused timelines from the thread roots
561
+ * themselves and doesn't use the [`Self::ForceThread`] mode.
562
+ */hideThreadedEvents: boolean }) {
563
+ super("TimelineEventFocusThreadMode", "Automatic");
564
+ this.inner = Object.freeze(inner);
565
+ }
566
+
567
+ static new(inner: {
568
+ /**
569
+ * When the target event is not part of a thread, whether to
570
+ * hide in-thread replies from the live timeline.
571
+ *
572
+ * Has no effect when the target event is part of a thread.
573
+ *
574
+ * This should be set to true when the client can create
575
+ * [`TimelineFocus::Thread`]-focused timelines from the thread roots
576
+ * themselves and doesn't use the [`Self::ForceThread`] mode.
577
+ */hideThreadedEvents: boolean }): Automatic_ {
578
+ return new Automatic_(inner);
579
+ }
580
+
581
+ static instanceOf(obj: any): obj is Automatic_ {
582
+ return obj.tag === TimelineEventFocusThreadMode_Tags.Automatic;
583
+ }
584
+
585
+
586
+
587
+
588
+ }
589
+
590
+ function instanceOf(obj: any): obj is TimelineEventFocusThreadMode {
591
+ return obj[uniffiTypeNameSymbol] === "TimelineEventFocusThreadMode";
592
+ }
593
+
594
+ return Object.freeze({
595
+ instanceOf,
596
+ ForceThread: ForceThread_,
597
+ Automatic: Automatic_
598
+ });
599
+
600
+ })();
601
+
602
+
603
+ /**
604
+ * Options for controlling the behaviour of [`TimelineFocus::Event`]
605
+ * for threaded events.
606
+ */
607
+
608
+ export type TimelineEventFocusThreadMode = InstanceType<
609
+ typeof TimelineEventFocusThreadMode[keyof Omit<typeof TimelineEventFocusThreadMode, 'instanceOf'>]
610
+ >;
611
+
612
+ // FfiConverter for enum TimelineEventFocusThreadMode
613
+ const FfiConverterTypeTimelineEventFocusThreadMode = (() => {
614
+ const ordinalConverter = FfiConverterInt32;
615
+ type TypeName = TimelineEventFocusThreadMode;
616
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
617
+ read(from: RustBuffer): TypeName {
618
+ switch (ordinalConverter.read(from)) {
619
+ case 1: return new TimelineEventFocusThreadMode.ForceThread();
620
+ case 2: return new TimelineEventFocusThreadMode.Automatic({hideThreadedEvents: FfiConverterBool.read(from) });
621
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
622
+ }
623
+ }
624
+ write(value: TypeName, into: RustBuffer): void {
625
+ switch (value.tag) {
626
+ case TimelineEventFocusThreadMode_Tags.ForceThread: {
627
+ ordinalConverter.write(1, into);
628
+ return;
629
+ }
630
+ case TimelineEventFocusThreadMode_Tags.Automatic: {
631
+ ordinalConverter.write(2, into);
632
+ const inner = value.inner;
633
+ FfiConverterBool.write(inner.hideThreadedEvents, into);
634
+ return;
635
+ }
636
+ default:
637
+ // Throwing from here means that TimelineEventFocusThreadMode_Tags hasn't matched an ordinal.
638
+ throw new UniffiInternalError.UnexpectedEnumCase();
639
+ }
640
+ }
641
+ allocationSize(value: TypeName): number {
642
+ switch (value.tag) {
643
+ case TimelineEventFocusThreadMode_Tags.ForceThread: {
644
+ return ordinalConverter.allocationSize(1);
645
+ }
646
+ case TimelineEventFocusThreadMode_Tags.Automatic: {
647
+ const inner = value.inner;
648
+ let size = ordinalConverter.allocationSize(2);
649
+ size += FfiConverterBool.allocationSize(inner.hideThreadedEvents);
650
+ return size;
651
+ }
652
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
653
+ }
654
+ }
655
+ }
656
+ return new FFIConverter();
657
+ })();
658
+
659
+
660
+
661
+ /**
662
+ * Extends [`ShieldStateCode`] to allow for a `SentInClear` code.
663
+ */
664
+ export enum TimelineEventShieldStateCode {
665
+ /**
666
+ * Not enough information available to check the authenticity.
667
+ */
668
+ AuthenticityNotGuaranteed,
669
+ /**
670
+ * The sending device isn't yet known by the Client.
671
+ */
672
+ UnknownDevice,
673
+ /**
674
+ * The sending device hasn't been verified by the sender.
675
+ */
676
+ UnsignedDevice,
677
+ /**
678
+ * The sender hasn't been verified by the Client's user.
679
+ */
680
+ UnverifiedIdentity,
681
+ /**
682
+ * The sender was previously verified but changed their identity.
683
+ */
684
+ VerificationViolation,
685
+ /**
686
+ * The `sender` field on the event does not match the owner of the device
687
+ * that established the Megolm session.
688
+ */
689
+ MismatchedSender,
690
+ /**
691
+ * An unencrypted event in an encrypted room.
692
+ */
693
+ SentInClear
694
+ }
695
+
696
+ const FfiConverterTypeTimelineEventShieldStateCode = (() => {
697
+ const ordinalConverter = FfiConverterInt32;
698
+ type TypeName = TimelineEventShieldStateCode;
699
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
700
+ read(from: RustBuffer): TypeName {
701
+ switch (ordinalConverter.read(from)) {
702
+ case 1: return TimelineEventShieldStateCode.AuthenticityNotGuaranteed;
703
+ case 2: return TimelineEventShieldStateCode.UnknownDevice;
704
+ case 3: return TimelineEventShieldStateCode.UnsignedDevice;
705
+ case 4: return TimelineEventShieldStateCode.UnverifiedIdentity;
706
+ case 5: return TimelineEventShieldStateCode.VerificationViolation;
707
+ case 6: return TimelineEventShieldStateCode.MismatchedSender;
708
+ case 7: return TimelineEventShieldStateCode.SentInClear;
709
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
710
+ }
711
+ }
712
+ write(value: TypeName, into: RustBuffer): void {
713
+ switch (value) {
714
+ case TimelineEventShieldStateCode.AuthenticityNotGuaranteed: return ordinalConverter.write(1, into);
715
+ case TimelineEventShieldStateCode.UnknownDevice: return ordinalConverter.write(2, into);
716
+ case TimelineEventShieldStateCode.UnsignedDevice: return ordinalConverter.write(3, into);
717
+ case TimelineEventShieldStateCode.UnverifiedIdentity: return ordinalConverter.write(4, into);
718
+ case TimelineEventShieldStateCode.VerificationViolation: return ordinalConverter.write(5, into);
719
+ case TimelineEventShieldStateCode.MismatchedSender: return ordinalConverter.write(6, into);
720
+ case TimelineEventShieldStateCode.SentInClear: return ordinalConverter.write(7, into);
721
+ }
722
+ }
723
+ allocationSize(value: TypeName): number {
724
+ return ordinalConverter.allocationSize(0);
725
+ }
726
+ }
727
+ return new FFIConverter();
728
+ })();
729
+
730
+
731
+
732
+
733
+
734
+ /**
735
+ * The level of read receipt tracking for the timeline.
736
+ */
737
+ export enum TimelineReadReceiptTracking {
738
+ /**
739
+ * Track read receipts for all events.
740
+ */
741
+ AllEvents,
742
+ /**
743
+ * Track read receipts only for message-like events.
744
+ */
745
+ MessageLikeEvents,
746
+ /**
747
+ * Disable read receipt tracking.
748
+ */
749
+ Disabled
750
+ }
751
+
752
+ const FfiConverterTypeTimelineReadReceiptTracking = (() => {
753
+ const ordinalConverter = FfiConverterInt32;
754
+ type TypeName = TimelineReadReceiptTracking;
755
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
756
+ read(from: RustBuffer): TypeName {
757
+ switch (ordinalConverter.read(from)) {
758
+ case 1: return TimelineReadReceiptTracking.AllEvents;
759
+ case 2: return TimelineReadReceiptTracking.MessageLikeEvents;
760
+ case 3: return TimelineReadReceiptTracking.Disabled;
761
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
762
+ }
763
+ }
764
+ write(value: TypeName, into: RustBuffer): void {
765
+ switch (value) {
766
+ case TimelineReadReceiptTracking.AllEvents: return ordinalConverter.write(1, into);
767
+ case TimelineReadReceiptTracking.MessageLikeEvents: return ordinalConverter.write(2, into);
768
+ case TimelineReadReceiptTracking.Disabled: return ordinalConverter.write(3, into);
769
+ }
770
+ }
771
+ allocationSize(value: TypeName): number {
772
+ return ordinalConverter.allocationSize(0);
773
+ }
774
+ }
775
+ return new FFIConverter();
776
+ })();
777
+
778
+
779
+
780
+
781
+
782
+
783
+ /**
784
+ * This should be called before anything else.
785
+ *
786
+ * It is likely that this is being done for you by the library's `index.ts`.
787
+ *
788
+ * It checks versions of uniffi between when the Rust scaffolding was generated
789
+ * and when the bindings were generated.
790
+ *
791
+ * It also initializes the machinery to enable Rust to talk back to Javascript.
792
+ */
793
+ function uniffiEnsureInitialized() {
794
+ // Get the bindings contract version from our ComponentInterface
795
+ const bindingsContractVersion = 30;
796
+ // Get the scaffolding contract version by calling the into the dylib
797
+ const scaffoldingContractVersion = nativeModule().ubrn_ffi_matrix_sdk_ui_uniffi_contract_version();
798
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
799
+ throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
800
+ }
801
+
802
+ }
803
+
804
+ export default Object.freeze({
805
+ initialize: uniffiEnsureInitialized,
806
+ converters: {
807
+ FfiConverterTypeEventItemOrigin,
808
+ FfiConverterTypeLatestEventValueLocalState,
809
+ FfiConverterTypeRoomPinnedEventsChange,
810
+ FfiConverterTypeSpaceRoomListPaginationState,
811
+ FfiConverterTypeThreadListPaginationState,
812
+ FfiConverterTypeTimelineEventFocusThreadMode,
813
+ FfiConverterTypeTimelineEventShieldStateCode,
814
+ FfiConverterTypeTimelineReadReceiptTracking,
815
+ }
816
+ });