ffi-bindings 1.0.2 → 1.0.3

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.
@@ -1,1843 +0,0 @@
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 FfiConverter,
10
- type UniffiByteArray,
11
- type UniffiGcObject,
12
- type UniffiHandle,
13
- type UniffiObjectFactory,
14
- AbstractFfiConverterByteArray,
15
- FfiConverterBool,
16
- FfiConverterFloat64,
17
- FfiConverterInt32,
18
- FfiConverterInt64,
19
- FfiConverterObject,
20
- FfiConverterOptional,
21
- FfiConverterUInt64,
22
- RustBuffer,
23
- UniffiAbstractObject,
24
- UniffiEnum,
25
- UniffiError,
26
- UniffiInternalError,
27
- UniffiRustCaller,
28
- destructorGuardSymbol,
29
- pointerLiteralSymbol,
30
- uniffiCreateFfiConverterString,
31
- uniffiCreateRecord,
32
- uniffiTypeNameSymbol,
33
- variantOrdinalSymbol } from "uniffi-bindgen-react-native";
34
-
35
- // Get converters from the other files, if any.
36
- const nativeModule = () => wasmBundle;
37
- const uniffiCaller = new UniffiRustCaller(() => new wasmBundle.RustCallStatus());
38
-
39
- const uniffiIsDebug =
40
- // @ts-ignore -- The process global might not be defined
41
- typeof process !== "object" ||
42
- // @ts-ignore -- The process global might not be defined
43
- process?.env?.NODE_ENV !== "production" ||
44
- false;
45
- // Public interface members begin here.
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
- /**
58
- * A set of common power levels required for various operations within a room,
59
- * that can be applied as a single operation. When updating these
60
- * settings, any levels that are `None` will remain unchanged.
61
- */
62
- export type RoomPowerLevelChanges = {
63
- /**
64
- * The level required to ban a user.
65
- */
66
- ban?: /*i64*/bigint,
67
- /**
68
- * The level required to invite a user.
69
- */
70
- invite?: /*i64*/bigint,
71
- /**
72
- * The level required to kick a user.
73
- */
74
- kick?: /*i64*/bigint,
75
- /**
76
- * The level required to redact an event.
77
- */
78
- redact?: /*i64*/bigint,
79
- /**
80
- * The default level required to send message events.
81
- */
82
- eventsDefault?: /*i64*/bigint,
83
- /**
84
- * The default level required to send state events.
85
- */
86
- stateDefault?: /*i64*/bigint,
87
- /**
88
- * The default power level for every user in the room.
89
- */
90
- usersDefault?: /*i64*/bigint,
91
- /**
92
- * The level required to change the room's name.
93
- */
94
- roomName?: /*i64*/bigint,
95
- /**
96
- * The level required to change the room's avatar.
97
- */
98
- roomAvatar?: /*i64*/bigint,
99
- /**
100
- * The level required to change the room's topic.
101
- */
102
- roomTopic?: /*i64*/bigint,
103
- /**
104
- * The level required to change the space's children.
105
- */
106
- spaceChild?: /*i64*/bigint
107
- }
108
-
109
- /**
110
- * Generated factory for {@link RoomPowerLevelChanges} record objects.
111
- */
112
- export const RoomPowerLevelChanges = (() => {
113
- const defaults = () => ({ban: undefined,invite: undefined,kick: undefined,redact: undefined,eventsDefault: undefined,stateDefault: undefined,usersDefault: undefined,roomName: undefined,roomAvatar: undefined,roomTopic: undefined,spaceChild: undefined
114
- });
115
- const create = (() => {
116
- return uniffiCreateRecord<RoomPowerLevelChanges, ReturnType<typeof defaults>>(defaults);
117
- })();
118
- return Object.freeze({
119
- create,
120
- new: create,
121
- defaults: () => Object.freeze(defaults()) as Partial<RoomPowerLevelChanges>,
122
-
123
- });
124
- })();
125
-
126
- const FfiConverterTypeRoomPowerLevelChanges = (() => {
127
- type TypeName = RoomPowerLevelChanges;
128
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
129
- read(from: RustBuffer): TypeName {
130
- return {
131
- ban: FfiConverterOptionalInt64.read(from),
132
- invite: FfiConverterOptionalInt64.read(from),
133
- kick: FfiConverterOptionalInt64.read(from),
134
- redact: FfiConverterOptionalInt64.read(from),
135
- eventsDefault: FfiConverterOptionalInt64.read(from),
136
- stateDefault: FfiConverterOptionalInt64.read(from),
137
- usersDefault: FfiConverterOptionalInt64.read(from),
138
- roomName: FfiConverterOptionalInt64.read(from),
139
- roomAvatar: FfiConverterOptionalInt64.read(from),
140
- roomTopic: FfiConverterOptionalInt64.read(from),
141
- spaceChild: FfiConverterOptionalInt64.read(from)
142
- };
143
- }
144
- write(value: TypeName, into: RustBuffer): void {
145
- FfiConverterOptionalInt64.write(value.ban, into);
146
- FfiConverterOptionalInt64.write(value.invite, into);
147
- FfiConverterOptionalInt64.write(value.kick, into);
148
- FfiConverterOptionalInt64.write(value.redact, into);
149
- FfiConverterOptionalInt64.write(value.eventsDefault, into);
150
- FfiConverterOptionalInt64.write(value.stateDefault, into);
151
- FfiConverterOptionalInt64.write(value.usersDefault, into);
152
- FfiConverterOptionalInt64.write(value.roomName, into);
153
- FfiConverterOptionalInt64.write(value.roomAvatar, into);
154
- FfiConverterOptionalInt64.write(value.roomTopic, into);
155
- FfiConverterOptionalInt64.write(value.spaceChild, into);
156
- }
157
- allocationSize(value: TypeName): number {
158
- return FfiConverterOptionalInt64.allocationSize(value.ban) +
159
- FfiConverterOptionalInt64.allocationSize(value.invite) +
160
- FfiConverterOptionalInt64.allocationSize(value.kick) +
161
- FfiConverterOptionalInt64.allocationSize(value.redact) +
162
- FfiConverterOptionalInt64.allocationSize(value.eventsDefault) +
163
- FfiConverterOptionalInt64.allocationSize(value.stateDefault) +
164
- FfiConverterOptionalInt64.allocationSize(value.usersDefault) +
165
- FfiConverterOptionalInt64.allocationSize(value.roomName) +
166
- FfiConverterOptionalInt64.allocationSize(value.roomAvatar) +
167
- FfiConverterOptionalInt64.allocationSize(value.roomTopic) +
168
- FfiConverterOptionalInt64.allocationSize(value.spaceChild);
169
-
170
- }
171
- };
172
- return new FFIConverter();
173
- })();
174
-
175
-
176
- /**
177
- * Information about the server vendor obtained from the federation API.
178
- */
179
- export type ServerVendorInfo = {
180
- /**
181
- * The server name.
182
- */
183
- serverName: string,
184
- /**
185
- * The server version.
186
- */
187
- version: string
188
- }
189
-
190
- /**
191
- * Generated factory for {@link ServerVendorInfo} record objects.
192
- */
193
- export const ServerVendorInfo = (() => {
194
- const defaults = () => ({
195
- });
196
- const create = (() => {
197
- return uniffiCreateRecord<ServerVendorInfo, ReturnType<typeof defaults>>(defaults);
198
- })();
199
- return Object.freeze({
200
- create,
201
- new: create,
202
- defaults: () => Object.freeze(defaults()) as Partial<ServerVendorInfo>,
203
-
204
- });
205
- })();
206
-
207
- const FfiConverterTypeServerVendorInfo = (() => {
208
- type TypeName = ServerVendorInfo;
209
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
210
- read(from: RustBuffer): TypeName {
211
- return {
212
- serverName: FfiConverterString.read(from),
213
- version: FfiConverterString.read(from)
214
- };
215
- }
216
- write(value: TypeName, into: RustBuffer): void {
217
- FfiConverterString.write(value.serverName, into);
218
- FfiConverterString.write(value.version, into);
219
- }
220
- allocationSize(value: TypeName): number {
221
- return FfiConverterString.allocationSize(value.serverName) +
222
- FfiConverterString.allocationSize(value.version);
223
-
224
- }
225
- };
226
- return new FFIConverter();
227
- })();
228
-
229
-
230
- /**
231
- * Configuration parameters, to create a new virtual Element Call widget.
232
- *
233
- * If `intent` is provided the appropriate default values for all other
234
- * parameters will be used by element call.
235
- * In most cases its enough to only set the intent. Use the other properties
236
- * only if you want to deviate from the `intent` defaults.
237
- *
238
- * Set [`docs/url-params.md`](https://github.com/element-hq/element-call/blob/livekit/docs/url-params.md)
239
- * to find out more about the parameters and their defaults.
240
- */
241
- export type VirtualElementCallWidgetConfig = {
242
- /**
243
- * The intent of showing the call.
244
- * If the user wants to start a call or join an existing one.
245
- * Controls if the lobby is skipped or not.
246
- */
247
- intent?: Intent,
248
- /**
249
- * Skip the lobby when joining a call.
250
- */
251
- skipLobby?: boolean,
252
- /**
253
- * Whether the branding header of Element call should be shown or if a
254
- * mobile header navbar should be render.
255
- *
256
- * Default: [`HeaderStyle::Standard`]
257
- */
258
- header?: HeaderStyle,
259
- /**
260
- * Whether the branding header of Element call should be hidden.
261
- *
262
- * Default: `true`
263
- */
264
- hideHeader?: boolean,
265
- /**
266
- * If set, the lobby will be skipped and the widget will join the
267
- * call on the `io.element.join` action.
268
- *
269
- * Default: `false`
270
- */
271
- preload?: boolean,
272
- /**
273
- * Whether element call should prompt the user to open in the browser or
274
- * the app.
275
- *
276
- * Default: `false`
277
- */
278
- appPrompt?: boolean,
279
- /**
280
- * Make it not possible to get to the calls list in the webview.
281
- *
282
- * Default: `true`
283
- */
284
- confineToRoom?: boolean,
285
- /**
286
- * Do not show the screenshare button.
287
- */
288
- hideScreensharing?: boolean,
289
- /**
290
- * Make the audio devices be controlled by the os instead of the
291
- * element-call webview.
292
- */
293
- controlledAudioDevices?: boolean,
294
- /**
295
- * Whether and what type of notification Element Call should send, when
296
- * starting a call.
297
- */
298
- sendNotificationType?: NotificationType
299
- }
300
-
301
- /**
302
- * Generated factory for {@link VirtualElementCallWidgetConfig} record objects.
303
- */
304
- export const VirtualElementCallWidgetConfig = (() => {
305
- const defaults = () => ({skipLobby: undefined,header: undefined,hideHeader: undefined,preload: undefined,appPrompt: undefined,confineToRoom: undefined,hideScreensharing: undefined,controlledAudioDevices: undefined,sendNotificationType: undefined
306
- });
307
- const create = (() => {
308
- return uniffiCreateRecord<VirtualElementCallWidgetConfig, ReturnType<typeof defaults>>(defaults);
309
- })();
310
- return Object.freeze({
311
- create,
312
- new: create,
313
- defaults: () => Object.freeze(defaults()) as Partial<VirtualElementCallWidgetConfig>,
314
-
315
- });
316
- })();
317
-
318
- const FfiConverterTypeVirtualElementCallWidgetConfig = (() => {
319
- type TypeName = VirtualElementCallWidgetConfig;
320
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
321
- read(from: RustBuffer): TypeName {
322
- return {
323
- intent: FfiConverterOptionalTypeIntent.read(from),
324
- skipLobby: FfiConverterOptionalBool.read(from),
325
- header: FfiConverterOptionalTypeHeaderStyle.read(from),
326
- hideHeader: FfiConverterOptionalBool.read(from),
327
- preload: FfiConverterOptionalBool.read(from),
328
- appPrompt: FfiConverterOptionalBool.read(from),
329
- confineToRoom: FfiConverterOptionalBool.read(from),
330
- hideScreensharing: FfiConverterOptionalBool.read(from),
331
- controlledAudioDevices: FfiConverterOptionalBool.read(from),
332
- sendNotificationType: FfiConverterOptionalTypeNotificationType.read(from)
333
- };
334
- }
335
- write(value: TypeName, into: RustBuffer): void {
336
- FfiConverterOptionalTypeIntent.write(value.intent, into);
337
- FfiConverterOptionalBool.write(value.skipLobby, into);
338
- FfiConverterOptionalTypeHeaderStyle.write(value.header, into);
339
- FfiConverterOptionalBool.write(value.hideHeader, into);
340
- FfiConverterOptionalBool.write(value.preload, into);
341
- FfiConverterOptionalBool.write(value.appPrompt, into);
342
- FfiConverterOptionalBool.write(value.confineToRoom, into);
343
- FfiConverterOptionalBool.write(value.hideScreensharing, into);
344
- FfiConverterOptionalBool.write(value.controlledAudioDevices, into);
345
- FfiConverterOptionalTypeNotificationType.write(value.sendNotificationType, into);
346
- }
347
- allocationSize(value: TypeName): number {
348
- return FfiConverterOptionalTypeIntent.allocationSize(value.intent) +
349
- FfiConverterOptionalBool.allocationSize(value.skipLobby) +
350
- FfiConverterOptionalTypeHeaderStyle.allocationSize(value.header) +
351
- FfiConverterOptionalBool.allocationSize(value.hideHeader) +
352
- FfiConverterOptionalBool.allocationSize(value.preload) +
353
- FfiConverterOptionalBool.allocationSize(value.appPrompt) +
354
- FfiConverterOptionalBool.allocationSize(value.confineToRoom) +
355
- FfiConverterOptionalBool.allocationSize(value.hideScreensharing) +
356
- FfiConverterOptionalBool.allocationSize(value.controlledAudioDevices) +
357
- FfiConverterOptionalTypeNotificationType.allocationSize(value.sendNotificationType);
358
-
359
- }
360
- };
361
- return new FFIConverter();
362
- })();
363
-
364
-
365
- /**
366
- * Properties to create a new virtual Element Call widget.
367
- *
368
- * All these are required to start the widget in the first place.
369
- * This is different from the `VirtualElementCallWidgetConfiguration` which
370
- * configures the widgets behavior.
371
- */
372
- export type VirtualElementCallWidgetProperties = {
373
- /**
374
- * The url to the app.
375
- *
376
- * E.g. <https://call.element.io>, <https://call.element.dev>, <https://call.element.dev/room>
377
- */
378
- elementCallUrl: string,
379
- /**
380
- * The widget id.
381
- */
382
- widgetId: string,
383
- /**
384
- * The url that is used as the target for the PostMessages sent
385
- * by the widget (to the client).
386
- *
387
- * For a web app client this is the client url. In case of using other
388
- * platforms the client most likely is setup up to listen to
389
- * postmessages in the same webview the widget is hosted. In this case
390
- * the `parent_url` is set to the url of the webview with the widget. Be
391
- * aware that this means that the widget will receive its own postmessage
392
- * messages. The `matrix-widget-api` (js) ignores those so this works but
393
- * it might break custom implementations.
394
- *
395
- * Defaults to `element_call_url` for the non-iframe (dedicated webview)
396
- * usecase.
397
- */
398
- parentUrl?: string,
399
- /**
400
- * The font scale which will be used inside element call.
401
- *
402
- * Default: `1`
403
- */
404
- fontScale?: /*f64*/number,
405
- /**
406
- * The font to use, to adapt to the system font.
407
- */
408
- font?: string,
409
- /**
410
- * The encryption system to use.
411
- *
412
- * Use `EncryptionSystem::Unencrypted` to disable encryption.
413
- */
414
- encryption: EncryptionSystem,
415
- /**
416
- * Can be used to pass a PostHog id to element call.
417
- */
418
- posthogUserId?: string,
419
- /**
420
- * The host of the posthog api.
421
- * This is only used by the embedded package of Element Call.
422
- */
423
- posthogApiHost?: string,
424
- /**
425
- * The key for the posthog api.
426
- * This is only used by the embedded package of Element Call.
427
- */
428
- posthogApiKey?: string,
429
- /**
430
- * The url to use for submitting rageshakes.
431
- * This is only used by the embedded package of Element Call.
432
- */
433
- rageshakeSubmitUrl?: string,
434
- /**
435
- * Sentry [DSN](https://docs.sentry.io/concepts/key-terms/dsn-explainer/)
436
- * This is only used by the embedded package of Element Call.
437
- */
438
- sentryDsn?: string,
439
- /**
440
- * Sentry [environment](https://docs.sentry.io/concepts/key-terms/key-terms/)
441
- * This is only used by the embedded package of Element Call.
442
- */
443
- sentryEnvironment?: string
444
- }
445
-
446
- /**
447
- * Generated factory for {@link VirtualElementCallWidgetProperties} record objects.
448
- */
449
- export const VirtualElementCallWidgetProperties = (() => {
450
- const defaults = () => ({parentUrl: undefined,fontScale: undefined,font: undefined,posthogUserId: undefined,posthogApiHost: undefined,posthogApiKey: undefined,rageshakeSubmitUrl: undefined,sentryDsn: undefined,sentryEnvironment: undefined
451
- });
452
- const create = (() => {
453
- return uniffiCreateRecord<VirtualElementCallWidgetProperties, ReturnType<typeof defaults>>(defaults);
454
- })();
455
- return Object.freeze({
456
- create,
457
- new: create,
458
- defaults: () => Object.freeze(defaults()) as Partial<VirtualElementCallWidgetProperties>,
459
-
460
- });
461
- })();
462
-
463
- const FfiConverterTypeVirtualElementCallWidgetProperties = (() => {
464
- type TypeName = VirtualElementCallWidgetProperties;
465
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
466
- read(from: RustBuffer): TypeName {
467
- return {
468
- elementCallUrl: FfiConverterString.read(from),
469
- widgetId: FfiConverterString.read(from),
470
- parentUrl: FfiConverterOptionalString.read(from),
471
- fontScale: FfiConverterOptionalFloat64.read(from),
472
- font: FfiConverterOptionalString.read(from),
473
- encryption: FfiConverterTypeEncryptionSystem.read(from),
474
- posthogUserId: FfiConverterOptionalString.read(from),
475
- posthogApiHost: FfiConverterOptionalString.read(from),
476
- posthogApiKey: FfiConverterOptionalString.read(from),
477
- rageshakeSubmitUrl: FfiConverterOptionalString.read(from),
478
- sentryDsn: FfiConverterOptionalString.read(from),
479
- sentryEnvironment: FfiConverterOptionalString.read(from)
480
- };
481
- }
482
- write(value: TypeName, into: RustBuffer): void {
483
- FfiConverterString.write(value.elementCallUrl, into);
484
- FfiConverterString.write(value.widgetId, into);
485
- FfiConverterOptionalString.write(value.parentUrl, into);
486
- FfiConverterOptionalFloat64.write(value.fontScale, into);
487
- FfiConverterOptionalString.write(value.font, into);
488
- FfiConverterTypeEncryptionSystem.write(value.encryption, into);
489
- FfiConverterOptionalString.write(value.posthogUserId, into);
490
- FfiConverterOptionalString.write(value.posthogApiHost, into);
491
- FfiConverterOptionalString.write(value.posthogApiKey, into);
492
- FfiConverterOptionalString.write(value.rageshakeSubmitUrl, into);
493
- FfiConverterOptionalString.write(value.sentryDsn, into);
494
- FfiConverterOptionalString.write(value.sentryEnvironment, into);
495
- }
496
- allocationSize(value: TypeName): number {
497
- return FfiConverterString.allocationSize(value.elementCallUrl) +
498
- FfiConverterString.allocationSize(value.widgetId) +
499
- FfiConverterOptionalString.allocationSize(value.parentUrl) +
500
- FfiConverterOptionalFloat64.allocationSize(value.fontScale) +
501
- FfiConverterOptionalString.allocationSize(value.font) +
502
- FfiConverterTypeEncryptionSystem.allocationSize(value.encryption) +
503
- FfiConverterOptionalString.allocationSize(value.posthogUserId) +
504
- FfiConverterOptionalString.allocationSize(value.posthogApiHost) +
505
- FfiConverterOptionalString.allocationSize(value.posthogApiKey) +
506
- FfiConverterOptionalString.allocationSize(value.rageshakeSubmitUrl) +
507
- FfiConverterOptionalString.allocationSize(value.sentryDsn) +
508
- FfiConverterOptionalString.allocationSize(value.sentryEnvironment);
509
-
510
- }
511
- };
512
- return new FFIConverter();
513
- })();
514
-
515
-
516
- const stringConverter = (() => {
517
- const encoder = new TextEncoder();
518
- const decoder = new TextDecoder();
519
- return {
520
- stringToBytes: (s: string) => encoder.encode(s),
521
- bytesToString: (ab: UniffiByteArray) => decoder.decode(ab),
522
- stringByteLength: (s: string) => encoder.encode(s).byteLength,
523
- };
524
- })();
525
- const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
526
-
527
-
528
-
529
-
530
- /**
531
- * Settings for end-to-end encryption features.
532
- */
533
- export enum BackupDownloadStrategy {
534
- /**
535
- * Automatically download all room keys from the backup when the backup
536
- * recovery key has been received. The backup recovery key can be received
537
- * in two ways:
538
- *
539
- * 1. Received as a `m.secret.send` to-device event, after a successful
540
- * interactive verification.
541
- * 2. Imported from secret storage (4S) using the
542
- * [`SecretStore::import_secrets()`] method.
543
- *
544
- * [`SecretStore::import_secrets()`]: crate::encryption::secret_storage::SecretStore::import_secrets
545
- */
546
- OneShot,
547
- /**
548
- * Attempt to download a single room key if an event fails to be decrypted.
549
- */
550
- AfterDecryptionFailure,
551
- /**
552
- * Don't download any room keys automatically. The user can manually
553
- * download room keys using the [`Backups::download_room_key()`] methods.
554
- *
555
- * This is the default option.
556
- */
557
- Manual
558
- }
559
-
560
- const FfiConverterTypeBackupDownloadStrategy = (() => {
561
- const ordinalConverter = FfiConverterInt32;
562
- type TypeName = BackupDownloadStrategy;
563
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
564
- read(from: RustBuffer): TypeName {
565
- switch (ordinalConverter.read(from)) {
566
- case 1: return BackupDownloadStrategy.OneShot;
567
- case 2: return BackupDownloadStrategy.AfterDecryptionFailure;
568
- case 3: return BackupDownloadStrategy.Manual;
569
- default: throw new UniffiInternalError.UnexpectedEnumCase();
570
- }
571
- }
572
- write(value: TypeName, into: RustBuffer): void {
573
- switch (value) {
574
- case BackupDownloadStrategy.OneShot: return ordinalConverter.write(1, into);
575
- case BackupDownloadStrategy.AfterDecryptionFailure: return ordinalConverter.write(2, into);
576
- case BackupDownloadStrategy.Manual: return ordinalConverter.write(3, into);
577
- }
578
- }
579
- allocationSize(value: TypeName): number {
580
- return ordinalConverter.allocationSize(0);
581
- }
582
- }
583
- return new FFIConverter();
584
- })();
585
-
586
-
587
-
588
-
589
-
590
- // Enum: EncryptionSystem
591
- export enum EncryptionSystem_Tags {
592
- Unencrypted = "Unencrypted",
593
- PerParticipantKeys = "PerParticipantKeys",
594
- SharedSecret = "SharedSecret"
595
- }
596
- /**
597
- * Defines if a call is encrypted and which encryption system should be used.
598
- *
599
- * This controls the url parameters: `perParticipantE2EE`, `password`.
600
- */
601
- export const EncryptionSystem = (() => {
602
-
603
-
604
- type Unencrypted__interface = {
605
- tag: EncryptionSystem_Tags.Unencrypted
606
- };
607
-
608
-
609
- /**
610
- * Equivalent to the element call url parameter: `perParticipantE2EE=false`
611
- * and no password.
612
- */
613
- class Unencrypted_ extends UniffiEnum implements Unencrypted__interface {
614
- /**
615
- * @private
616
- * This field is private and should not be used, use `tag` instead.
617
- */
618
- readonly [uniffiTypeNameSymbol] = "EncryptionSystem";
619
- readonly tag = EncryptionSystem_Tags.Unencrypted;
620
- constructor() {
621
- super("EncryptionSystem", "Unencrypted");
622
- }
623
-
624
- static new(): Unencrypted_ {
625
- return new Unencrypted_();
626
- }
627
-
628
- static instanceOf(obj: any): obj is Unencrypted_ {
629
- return obj.tag === EncryptionSystem_Tags.Unencrypted;
630
- }
631
-
632
-
633
-
634
-
635
- }
636
-
637
-
638
- type PerParticipantKeys__interface = {
639
- tag: EncryptionSystem_Tags.PerParticipantKeys
640
- };
641
-
642
-
643
- /**
644
- * Equivalent to the element call url parameters:
645
- * `perParticipantE2EE=true`
646
- */
647
- class PerParticipantKeys_ extends UniffiEnum implements PerParticipantKeys__interface {
648
- /**
649
- * @private
650
- * This field is private and should not be used, use `tag` instead.
651
- */
652
- readonly [uniffiTypeNameSymbol] = "EncryptionSystem";
653
- readonly tag = EncryptionSystem_Tags.PerParticipantKeys;
654
- constructor() {
655
- super("EncryptionSystem", "PerParticipantKeys");
656
- }
657
-
658
- static new(): PerParticipantKeys_ {
659
- return new PerParticipantKeys_();
660
- }
661
-
662
- static instanceOf(obj: any): obj is PerParticipantKeys_ {
663
- return obj.tag === EncryptionSystem_Tags.PerParticipantKeys;
664
- }
665
-
666
-
667
-
668
-
669
- }
670
-
671
-
672
- type SharedSecret__interface = {
673
- tag: EncryptionSystem_Tags.SharedSecret;
674
- inner: Readonly<{secret: string}>
675
- };
676
-
677
-
678
- /**
679
- * Equivalent to the element call url parameters:
680
- * `password={secret}`
681
- */
682
- class SharedSecret_ extends UniffiEnum implements SharedSecret__interface {
683
- /**
684
- * @private
685
- * This field is private and should not be used, use `tag` instead.
686
- */
687
- readonly [uniffiTypeNameSymbol] = "EncryptionSystem";
688
- readonly tag = EncryptionSystem_Tags.SharedSecret;
689
- readonly inner: Readonly<{secret: string}>;
690
- constructor(inner: {
691
- /**
692
- * The secret/password which is used in the url.
693
- */secret: string }) {
694
- super("EncryptionSystem", "SharedSecret");
695
- this.inner = Object.freeze(inner);
696
- }
697
-
698
- static new(inner: {
699
- /**
700
- * The secret/password which is used in the url.
701
- */secret: string }): SharedSecret_ {
702
- return new SharedSecret_(inner);
703
- }
704
-
705
- static instanceOf(obj: any): obj is SharedSecret_ {
706
- return obj.tag === EncryptionSystem_Tags.SharedSecret;
707
- }
708
-
709
-
710
-
711
-
712
- }
713
-
714
- function instanceOf(obj: any): obj is EncryptionSystem {
715
- return obj[uniffiTypeNameSymbol] === "EncryptionSystem";
716
- }
717
-
718
- return Object.freeze({
719
- instanceOf,
720
- Unencrypted: Unencrypted_,
721
- PerParticipantKeys: PerParticipantKeys_,
722
- SharedSecret: SharedSecret_
723
- });
724
-
725
- })();
726
-
727
-
728
- /**
729
- * Defines if a call is encrypted and which encryption system should be used.
730
- *
731
- * This controls the url parameters: `perParticipantE2EE`, `password`.
732
- */
733
-
734
- export type EncryptionSystem = InstanceType<
735
- typeof EncryptionSystem[keyof Omit<typeof EncryptionSystem, 'instanceOf'>]
736
- >;
737
-
738
- // FfiConverter for enum EncryptionSystem
739
- const FfiConverterTypeEncryptionSystem = (() => {
740
- const ordinalConverter = FfiConverterInt32;
741
- type TypeName = EncryptionSystem;
742
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
743
- read(from: RustBuffer): TypeName {
744
- switch (ordinalConverter.read(from)) {
745
- case 1: return new EncryptionSystem.Unencrypted();
746
- case 2: return new EncryptionSystem.PerParticipantKeys();
747
- case 3: return new EncryptionSystem.SharedSecret({secret: FfiConverterString.read(from) });
748
- default: throw new UniffiInternalError.UnexpectedEnumCase();
749
- }
750
- }
751
- write(value: TypeName, into: RustBuffer): void {
752
- switch (value.tag) {
753
- case EncryptionSystem_Tags.Unencrypted: {
754
- ordinalConverter.write(1, into);
755
- return;
756
- }
757
- case EncryptionSystem_Tags.PerParticipantKeys: {
758
- ordinalConverter.write(2, into);
759
- return;
760
- }
761
- case EncryptionSystem_Tags.SharedSecret: {
762
- ordinalConverter.write(3, into);
763
- const inner = value.inner;
764
- FfiConverterString.write(inner.secret, into);
765
- return;
766
- }
767
- default:
768
- // Throwing from here means that EncryptionSystem_Tags hasn't matched an ordinal.
769
- throw new UniffiInternalError.UnexpectedEnumCase();
770
- }
771
- }
772
- allocationSize(value: TypeName): number {
773
- switch (value.tag) {
774
- case EncryptionSystem_Tags.Unencrypted: {
775
- return ordinalConverter.allocationSize(1);
776
- }
777
- case EncryptionSystem_Tags.PerParticipantKeys: {
778
- return ordinalConverter.allocationSize(2);
779
- }
780
- case EncryptionSystem_Tags.SharedSecret: {
781
- const inner = value.inner;
782
- let size = ordinalConverter.allocationSize(3);
783
- size += FfiConverterString.allocationSize(inner.secret);
784
- return size;
785
- }
786
- default: throw new UniffiInternalError.UnexpectedEnumCase();
787
- }
788
- }
789
- }
790
- return new FFIConverter();
791
- })();
792
-
793
-
794
-
795
- /**
796
- * Defines how (if) element-call renders a header.
797
- */
798
- export enum HeaderStyle {
799
- /**
800
- * The normal header with branding.
801
- */
802
- Standard,
803
- /**
804
- * Render a header with a back button (useful on mobile platforms).
805
- */
806
- AppBar,
807
- /**
808
- * No Header (useful for webapps).
809
- */
810
- None
811
- }
812
-
813
- const FfiConverterTypeHeaderStyle = (() => {
814
- const ordinalConverter = FfiConverterInt32;
815
- type TypeName = HeaderStyle;
816
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
817
- read(from: RustBuffer): TypeName {
818
- switch (ordinalConverter.read(from)) {
819
- case 1: return HeaderStyle.Standard;
820
- case 2: return HeaderStyle.AppBar;
821
- case 3: return HeaderStyle.None;
822
- default: throw new UniffiInternalError.UnexpectedEnumCase();
823
- }
824
- }
825
- write(value: TypeName, into: RustBuffer): void {
826
- switch (value) {
827
- case HeaderStyle.Standard: return ordinalConverter.write(1, into);
828
- case HeaderStyle.AppBar: return ordinalConverter.write(2, into);
829
- case HeaderStyle.None: return ordinalConverter.write(3, into);
830
- }
831
- }
832
- allocationSize(value: TypeName): number {
833
- return ordinalConverter.allocationSize(0);
834
- }
835
- }
836
- return new FFIConverter();
837
- })();
838
-
839
-
840
-
841
-
842
-
843
- /**
844
- * Defines the intent of showing the call.
845
- *
846
- * This controls whether to show or skip the lobby.
847
- */
848
- export enum Intent {
849
- /**
850
- * The user wants to start a call.
851
- */
852
- StartCall,
853
- /**
854
- * The user wants to join an existing call.
855
- */
856
- JoinExisting,
857
- /**
858
- * The user wants to join an existing call that is a "Direct Message" (DM)
859
- * room.
860
- */
861
- JoinExistingDm,
862
- /**
863
- * The user wants to start a call in a "Direct Message" (DM) room.
864
- */
865
- StartCallDm,
866
- /**
867
- * The user wants to start a voice call in a "Direct Message" (DM) room.
868
- */
869
- StartCallDmVoice,
870
- /**
871
- * The user wants to join an existing voice call that is a "Direct
872
- * Message" (DM) room.
873
- */
874
- JoinExistingDmVoice
875
- }
876
-
877
- const FfiConverterTypeIntent = (() => {
878
- const ordinalConverter = FfiConverterInt32;
879
- type TypeName = Intent;
880
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
881
- read(from: RustBuffer): TypeName {
882
- switch (ordinalConverter.read(from)) {
883
- case 1: return Intent.StartCall;
884
- case 2: return Intent.JoinExisting;
885
- case 3: return Intent.JoinExistingDm;
886
- case 4: return Intent.StartCallDm;
887
- case 5: return Intent.StartCallDmVoice;
888
- case 6: return Intent.JoinExistingDmVoice;
889
- default: throw new UniffiInternalError.UnexpectedEnumCase();
890
- }
891
- }
892
- write(value: TypeName, into: RustBuffer): void {
893
- switch (value) {
894
- case Intent.StartCall: return ordinalConverter.write(1, into);
895
- case Intent.JoinExisting: return ordinalConverter.write(2, into);
896
- case Intent.JoinExistingDm: return ordinalConverter.write(3, into);
897
- case Intent.StartCallDm: return ordinalConverter.write(4, into);
898
- case Intent.StartCallDmVoice: return ordinalConverter.write(5, into);
899
- case Intent.JoinExistingDmVoice: return ordinalConverter.write(6, into);
900
- }
901
- }
902
- allocationSize(value: TypeName): number {
903
- return ordinalConverter.allocationSize(0);
904
- }
905
- }
906
- return new FFIConverter();
907
- })();
908
-
909
-
910
-
911
-
912
-
913
- /**
914
- * Types of call notifications.
915
- */
916
- export enum NotificationType {
917
- /**
918
- * The receiving client should display a visual notification.
919
- */
920
- Notification,
921
- /**
922
- * The receiving client should ring with an audible sound.
923
- */
924
- Ring
925
- }
926
-
927
- const FfiConverterTypeNotificationType = (() => {
928
- const ordinalConverter = FfiConverterInt32;
929
- type TypeName = NotificationType;
930
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
931
- read(from: RustBuffer): TypeName {
932
- switch (ordinalConverter.read(from)) {
933
- case 1: return NotificationType.Notification;
934
- case 2: return NotificationType.Ring;
935
- default: throw new UniffiInternalError.UnexpectedEnumCase();
936
- }
937
- }
938
- write(value: TypeName, into: RustBuffer): void {
939
- switch (value) {
940
- case NotificationType.Notification: return ordinalConverter.write(1, into);
941
- case NotificationType.Ring: return ordinalConverter.write(2, into);
942
- }
943
- }
944
- allocationSize(value: TypeName): number {
945
- return ordinalConverter.allocationSize(0);
946
- }
947
- }
948
- return new FFIConverter();
949
- })();
950
-
951
-
952
-
953
-
954
-
955
- // Enum: PaginationStatus
956
- export enum PaginationStatus_Tags {
957
- Idle = "Idle",
958
- Paginating = "Paginating"
959
- }
960
- /**
961
- * Status for the pagination on a cache.
962
- */
963
- export const PaginationStatus = (() => {
964
-
965
-
966
- type Idle__interface = {
967
- tag: PaginationStatus_Tags.Idle;
968
- inner: Readonly<{hitTimelineStart: boolean}>
969
- };
970
-
971
-
972
- /**
973
- * No pagination is happening right now.
974
- */
975
- class Idle_ extends UniffiEnum implements Idle__interface {
976
- /**
977
- * @private
978
- * This field is private and should not be used, use `tag` instead.
979
- */
980
- readonly [uniffiTypeNameSymbol] = "PaginationStatus";
981
- readonly tag = PaginationStatus_Tags.Idle;
982
- readonly inner: Readonly<{hitTimelineStart: boolean}>;
983
- constructor(inner: {
984
- /**
985
- * Have we hit the start of the timeline, i.e. paginating wouldn't
986
- * have any effect?
987
- */hitTimelineStart: boolean }) {
988
- super("PaginationStatus", "Idle");
989
- this.inner = Object.freeze(inner);
990
- }
991
-
992
- static new(inner: {
993
- /**
994
- * Have we hit the start of the timeline, i.e. paginating wouldn't
995
- * have any effect?
996
- */hitTimelineStart: boolean }): Idle_ {
997
- return new Idle_(inner);
998
- }
999
-
1000
- static instanceOf(obj: any): obj is Idle_ {
1001
- return obj.tag === PaginationStatus_Tags.Idle;
1002
- }
1003
-
1004
-
1005
-
1006
-
1007
- }
1008
-
1009
-
1010
- type Paginating__interface = {
1011
- tag: PaginationStatus_Tags.Paginating
1012
- };
1013
-
1014
-
1015
- /**
1016
- * Pagination is already running in the background.
1017
- */
1018
- class Paginating_ extends UniffiEnum implements Paginating__interface {
1019
- /**
1020
- * @private
1021
- * This field is private and should not be used, use `tag` instead.
1022
- */
1023
- readonly [uniffiTypeNameSymbol] = "PaginationStatus";
1024
- readonly tag = PaginationStatus_Tags.Paginating;
1025
- constructor() {
1026
- super("PaginationStatus", "Paginating");
1027
- }
1028
-
1029
- static new(): Paginating_ {
1030
- return new Paginating_();
1031
- }
1032
-
1033
- static instanceOf(obj: any): obj is Paginating_ {
1034
- return obj.tag === PaginationStatus_Tags.Paginating;
1035
- }
1036
-
1037
-
1038
-
1039
-
1040
- }
1041
-
1042
- function instanceOf(obj: any): obj is PaginationStatus {
1043
- return obj[uniffiTypeNameSymbol] === "PaginationStatus";
1044
- }
1045
-
1046
- return Object.freeze({
1047
- instanceOf,
1048
- Idle: Idle_,
1049
- Paginating: Paginating_
1050
- });
1051
-
1052
- })();
1053
-
1054
-
1055
- /**
1056
- * Status for the pagination on a cache.
1057
- */
1058
-
1059
- export type PaginationStatus = InstanceType<
1060
- typeof PaginationStatus[keyof Omit<typeof PaginationStatus, 'instanceOf'>]
1061
- >;
1062
-
1063
- // FfiConverter for enum PaginationStatus
1064
- const FfiConverterTypePaginationStatus = (() => {
1065
- const ordinalConverter = FfiConverterInt32;
1066
- type TypeName = PaginationStatus;
1067
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1068
- read(from: RustBuffer): TypeName {
1069
- switch (ordinalConverter.read(from)) {
1070
- case 1: return new PaginationStatus.Idle({hitTimelineStart: FfiConverterBool.read(from) });
1071
- case 2: return new PaginationStatus.Paginating();
1072
- default: throw new UniffiInternalError.UnexpectedEnumCase();
1073
- }
1074
- }
1075
- write(value: TypeName, into: RustBuffer): void {
1076
- switch (value.tag) {
1077
- case PaginationStatus_Tags.Idle: {
1078
- ordinalConverter.write(1, into);
1079
- const inner = value.inner;
1080
- FfiConverterBool.write(inner.hitTimelineStart, into);
1081
- return;
1082
- }
1083
- case PaginationStatus_Tags.Paginating: {
1084
- ordinalConverter.write(2, into);
1085
- return;
1086
- }
1087
- default:
1088
- // Throwing from here means that PaginationStatus_Tags hasn't matched an ordinal.
1089
- throw new UniffiInternalError.UnexpectedEnumCase();
1090
- }
1091
- }
1092
- allocationSize(value: TypeName): number {
1093
- switch (value.tag) {
1094
- case PaginationStatus_Tags.Idle: {
1095
- const inner = value.inner;
1096
- let size = ordinalConverter.allocationSize(1);
1097
- size += FfiConverterBool.allocationSize(inner.hitTimelineStart);
1098
- return size;
1099
- }
1100
- case PaginationStatus_Tags.Paginating: {
1101
- return ordinalConverter.allocationSize(2);
1102
- }
1103
- default: throw new UniffiInternalError.UnexpectedEnumCase();
1104
- }
1105
- }
1106
- }
1107
- return new FFIConverter();
1108
- })();
1109
-
1110
-
1111
-
1112
- /**
1113
- * Current state of a [`Paginator`].
1114
- */
1115
- export enum PaginatorState {
1116
- /**
1117
- * The initial state of the paginator.
1118
- */
1119
- Initial,
1120
- /**
1121
- * The paginator is fetching the target initial event.
1122
- */
1123
- FetchingTargetEvent,
1124
- /**
1125
- * The target initial event could be found, zero or more paginations have
1126
- * happened since then, and the paginator is at rest now.
1127
- */
1128
- Idle,
1129
- /**
1130
- * The paginator is… paginating one direction or another.
1131
- */
1132
- Paginating
1133
- }
1134
-
1135
- const FfiConverterTypePaginatorState = (() => {
1136
- const ordinalConverter = FfiConverterInt32;
1137
- type TypeName = PaginatorState;
1138
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1139
- read(from: RustBuffer): TypeName {
1140
- switch (ordinalConverter.read(from)) {
1141
- case 1: return PaginatorState.Initial;
1142
- case 2: return PaginatorState.FetchingTargetEvent;
1143
- case 3: return PaginatorState.Idle;
1144
- case 4: return PaginatorState.Paginating;
1145
- default: throw new UniffiInternalError.UnexpectedEnumCase();
1146
- }
1147
- }
1148
- write(value: TypeName, into: RustBuffer): void {
1149
- switch (value) {
1150
- case PaginatorState.Initial: return ordinalConverter.write(1, into);
1151
- case PaginatorState.FetchingTargetEvent: return ordinalConverter.write(2, into);
1152
- case PaginatorState.Idle: return ordinalConverter.write(3, into);
1153
- case PaginatorState.Paginating: return ordinalConverter.write(4, into);
1154
- }
1155
- }
1156
- allocationSize(value: TypeName): number {
1157
- return ordinalConverter.allocationSize(0);
1158
- }
1159
- }
1160
- return new FFIConverter();
1161
- })();
1162
-
1163
-
1164
-
1165
-
1166
-
1167
-
1168
- // Flat error type: QrCodeLoginError
1169
- export enum QrCodeLoginError_Tags {
1170
- OAuth = "OAuth",
1171
- LoginFailure = "LoginFailure",
1172
- UnexpectedMessage = "UnexpectedMessage",
1173
- SecureChannel = "SecureChannel",
1174
- NotFound = "NotFound",
1175
- CrossProcessRefreshLock = "CrossProcessRefreshLock",
1176
- UserIdDiscovery = "UserIdDiscovery",
1177
- SessionTokens = "SessionTokens",
1178
- DeviceKeyUpload = "DeviceKeyUpload",
1179
- SecretImport = "SecretImport",
1180
- ServerReset = "ServerReset"
1181
- }
1182
- /**
1183
- * The error type for failures while trying to log in a new device using a QR
1184
- * code.
1185
- */
1186
- export const QrCodeLoginError = (() => {
1187
- /**
1188
- * An error happened while we were communicating with the OAuth 2.0
1189
- * authorization server.
1190
- */
1191
- class OAuth extends UniffiError {
1192
- /**
1193
- * @private
1194
- * This field is private and should not be used.
1195
- */
1196
- readonly [uniffiTypeNameSymbol]: string = "QrCodeLoginError";
1197
- /**
1198
- * @private
1199
- * This field is private and should not be used.
1200
- */
1201
- readonly [variantOrdinalSymbol] = 1;
1202
-
1203
- readonly tag = QrCodeLoginError_Tags.OAuth;
1204
-
1205
- constructor(message: string) {
1206
- super("QrCodeLoginError", "OAuth", message);
1207
- }
1208
-
1209
- static instanceOf(e: any): e is OAuth {
1210
- return (
1211
- instanceOf(e) && (e as any)[variantOrdinalSymbol] === 1
1212
- );
1213
- }
1214
- }
1215
- /**
1216
- * The other device has signaled to us that the login has failed.
1217
- */
1218
- class LoginFailure extends UniffiError {
1219
- /**
1220
- * @private
1221
- * This field is private and should not be used.
1222
- */
1223
- readonly [uniffiTypeNameSymbol]: string = "QrCodeLoginError";
1224
- /**
1225
- * @private
1226
- * This field is private and should not be used.
1227
- */
1228
- readonly [variantOrdinalSymbol] = 2;
1229
-
1230
- readonly tag = QrCodeLoginError_Tags.LoginFailure;
1231
-
1232
- constructor(message: string) {
1233
- super("QrCodeLoginError", "LoginFailure", message);
1234
- }
1235
-
1236
- static instanceOf(e: any): e is LoginFailure {
1237
- return (
1238
- instanceOf(e) && (e as any)[variantOrdinalSymbol] === 2
1239
- );
1240
- }
1241
- }
1242
- /**
1243
- * An unexpected message was received from the other device.
1244
- */
1245
- class UnexpectedMessage extends UniffiError {
1246
- /**
1247
- * @private
1248
- * This field is private and should not be used.
1249
- */
1250
- readonly [uniffiTypeNameSymbol]: string = "QrCodeLoginError";
1251
- /**
1252
- * @private
1253
- * This field is private and should not be used.
1254
- */
1255
- readonly [variantOrdinalSymbol] = 3;
1256
-
1257
- readonly tag = QrCodeLoginError_Tags.UnexpectedMessage;
1258
-
1259
- constructor(message: string) {
1260
- super("QrCodeLoginError", "UnexpectedMessage", message);
1261
- }
1262
-
1263
- static instanceOf(e: any): e is UnexpectedMessage {
1264
- return (
1265
- instanceOf(e) && (e as any)[variantOrdinalSymbol] === 3
1266
- );
1267
- }
1268
- }
1269
- /**
1270
- * An error happened while exchanging messages with the other device.
1271
- */
1272
- class SecureChannel extends UniffiError {
1273
- /**
1274
- * @private
1275
- * This field is private and should not be used.
1276
- */
1277
- readonly [uniffiTypeNameSymbol]: string = "QrCodeLoginError";
1278
- /**
1279
- * @private
1280
- * This field is private and should not be used.
1281
- */
1282
- readonly [variantOrdinalSymbol] = 4;
1283
-
1284
- readonly tag = QrCodeLoginError_Tags.SecureChannel;
1285
-
1286
- constructor(message: string) {
1287
- super("QrCodeLoginError", "SecureChannel", message);
1288
- }
1289
-
1290
- static instanceOf(e: any): e is SecureChannel {
1291
- return (
1292
- instanceOf(e) && (e as any)[variantOrdinalSymbol] === 4
1293
- );
1294
- }
1295
- }
1296
- /**
1297
- * The rendezvous session was not found and might have expired.
1298
- */
1299
- class NotFound extends UniffiError {
1300
- /**
1301
- * @private
1302
- * This field is private and should not be used.
1303
- */
1304
- readonly [uniffiTypeNameSymbol]: string = "QrCodeLoginError";
1305
- /**
1306
- * @private
1307
- * This field is private and should not be used.
1308
- */
1309
- readonly [variantOrdinalSymbol] = 5;
1310
-
1311
- readonly tag = QrCodeLoginError_Tags.NotFound;
1312
-
1313
- constructor(message: string) {
1314
- super("QrCodeLoginError", "NotFound", message);
1315
- }
1316
-
1317
- static instanceOf(e: any): e is NotFound {
1318
- return (
1319
- instanceOf(e) && (e as any)[variantOrdinalSymbol] === 5
1320
- );
1321
- }
1322
- }
1323
- /**
1324
- * The cross-process refresh lock failed to be initialized.
1325
- */
1326
- class CrossProcessRefreshLock extends UniffiError {
1327
- /**
1328
- * @private
1329
- * This field is private and should not be used.
1330
- */
1331
- readonly [uniffiTypeNameSymbol]: string = "QrCodeLoginError";
1332
- /**
1333
- * @private
1334
- * This field is private and should not be used.
1335
- */
1336
- readonly [variantOrdinalSymbol] = 6;
1337
-
1338
- readonly tag = QrCodeLoginError_Tags.CrossProcessRefreshLock;
1339
-
1340
- constructor(message: string) {
1341
- super("QrCodeLoginError", "CrossProcessRefreshLock", message);
1342
- }
1343
-
1344
- static instanceOf(e: any): e is CrossProcessRefreshLock {
1345
- return (
1346
- instanceOf(e) && (e as any)[variantOrdinalSymbol] === 6
1347
- );
1348
- }
1349
- }
1350
- /**
1351
- * An error happened while we were trying to discover our user and device
1352
- * ID, after we have acquired an access token from the OAuth 2.0
1353
- * authorization server.
1354
- */
1355
- class UserIdDiscovery extends UniffiError {
1356
- /**
1357
- * @private
1358
- * This field is private and should not be used.
1359
- */
1360
- readonly [uniffiTypeNameSymbol]: string = "QrCodeLoginError";
1361
- /**
1362
- * @private
1363
- * This field is private and should not be used.
1364
- */
1365
- readonly [variantOrdinalSymbol] = 7;
1366
-
1367
- readonly tag = QrCodeLoginError_Tags.UserIdDiscovery;
1368
-
1369
- constructor(message: string) {
1370
- super("QrCodeLoginError", "UserIdDiscovery", message);
1371
- }
1372
-
1373
- static instanceOf(e: any): e is UserIdDiscovery {
1374
- return (
1375
- instanceOf(e) && (e as any)[variantOrdinalSymbol] === 7
1376
- );
1377
- }
1378
- }
1379
- /**
1380
- * We failed to set the session tokens after we figured out our device and
1381
- * user IDs.
1382
- */
1383
- class SessionTokens extends UniffiError {
1384
- /**
1385
- * @private
1386
- * This field is private and should not be used.
1387
- */
1388
- readonly [uniffiTypeNameSymbol]: string = "QrCodeLoginError";
1389
- /**
1390
- * @private
1391
- * This field is private and should not be used.
1392
- */
1393
- readonly [variantOrdinalSymbol] = 8;
1394
-
1395
- readonly tag = QrCodeLoginError_Tags.SessionTokens;
1396
-
1397
- constructor(message: string) {
1398
- super("QrCodeLoginError", "SessionTokens", message);
1399
- }
1400
-
1401
- static instanceOf(e: any): e is SessionTokens {
1402
- return (
1403
- instanceOf(e) && (e as any)[variantOrdinalSymbol] === 8
1404
- );
1405
- }
1406
- }
1407
- /**
1408
- * The device keys failed to be uploaded after we successfully logged in.
1409
- */
1410
- class DeviceKeyUpload extends UniffiError {
1411
- /**
1412
- * @private
1413
- * This field is private and should not be used.
1414
- */
1415
- readonly [uniffiTypeNameSymbol]: string = "QrCodeLoginError";
1416
- /**
1417
- * @private
1418
- * This field is private and should not be used.
1419
- */
1420
- readonly [variantOrdinalSymbol] = 9;
1421
-
1422
- readonly tag = QrCodeLoginError_Tags.DeviceKeyUpload;
1423
-
1424
- constructor(message: string) {
1425
- super("QrCodeLoginError", "DeviceKeyUpload", message);
1426
- }
1427
-
1428
- static instanceOf(e: any): e is DeviceKeyUpload {
1429
- return (
1430
- instanceOf(e) && (e as any)[variantOrdinalSymbol] === 9
1431
- );
1432
- }
1433
- }
1434
- /**
1435
- * The secrets bundle we received from the existing device failed to be
1436
- * imported.
1437
- */
1438
- class SecretImport extends UniffiError {
1439
- /**
1440
- * @private
1441
- * This field is private and should not be used.
1442
- */
1443
- readonly [uniffiTypeNameSymbol]: string = "QrCodeLoginError";
1444
- /**
1445
- * @private
1446
- * This field is private and should not be used.
1447
- */
1448
- readonly [variantOrdinalSymbol] = 10;
1449
-
1450
- readonly tag = QrCodeLoginError_Tags.SecretImport;
1451
-
1452
- constructor(message: string) {
1453
- super("QrCodeLoginError", "SecretImport", message);
1454
- }
1455
-
1456
- static instanceOf(e: any): e is SecretImport {
1457
- return (
1458
- instanceOf(e) && (e as any)[variantOrdinalSymbol] === 10
1459
- );
1460
- }
1461
- }
1462
- /**
1463
- * The other party told us to use a different homeserver but we failed to
1464
- * reset the server URL.
1465
- */
1466
- class ServerReset extends UniffiError {
1467
- /**
1468
- * @private
1469
- * This field is private and should not be used.
1470
- */
1471
- readonly [uniffiTypeNameSymbol]: string = "QrCodeLoginError";
1472
- /**
1473
- * @private
1474
- * This field is private and should not be used.
1475
- */
1476
- readonly [variantOrdinalSymbol] = 11;
1477
-
1478
- readonly tag = QrCodeLoginError_Tags.ServerReset;
1479
-
1480
- constructor(message: string) {
1481
- super("QrCodeLoginError", "ServerReset", message);
1482
- }
1483
-
1484
- static instanceOf(e: any): e is ServerReset {
1485
- return (
1486
- instanceOf(e) && (e as any)[variantOrdinalSymbol] === 11
1487
- );
1488
- }
1489
- }
1490
-
1491
- // Utility function which does not rely on instanceof.
1492
- function instanceOf(e: any): e is QrCodeLoginError {
1493
- return (e as any)[uniffiTypeNameSymbol] === "QrCodeLoginError";
1494
- }
1495
- return {
1496
- OAuth,
1497
- LoginFailure,
1498
- UnexpectedMessage,
1499
- SecureChannel,
1500
- NotFound,
1501
- CrossProcessRefreshLock,
1502
- UserIdDiscovery,
1503
- SessionTokens,
1504
- DeviceKeyUpload,
1505
- SecretImport,
1506
- ServerReset,
1507
- instanceOf,
1508
- };
1509
- })();
1510
-
1511
- // Union type for QrCodeLoginError error type.
1512
-
1513
- /**
1514
- * The error type for failures while trying to log in a new device using a QR
1515
- * code.
1516
- */
1517
-
1518
- export type QrCodeLoginError = InstanceType<
1519
- typeof QrCodeLoginError[keyof Omit<typeof QrCodeLoginError, 'instanceOf'>]
1520
- >;
1521
-
1522
- const FfiConverterTypeQRCodeLoginError = (() => {
1523
- const intConverter = FfiConverterInt32;
1524
- type TypeName = QrCodeLoginError;
1525
- class FfiConverter extends AbstractFfiConverterByteArray<TypeName> {
1526
- read(from: RustBuffer): TypeName {
1527
- switch (intConverter.read(from)) {
1528
- case 1: return new QrCodeLoginError.OAuth(FfiConverterString.read(from)
1529
- );
1530
-
1531
- case 2: return new QrCodeLoginError.LoginFailure(FfiConverterString.read(from)
1532
- );
1533
-
1534
- case 3: return new QrCodeLoginError.UnexpectedMessage(FfiConverterString.read(from)
1535
- );
1536
-
1537
- case 4: return new QrCodeLoginError.SecureChannel(FfiConverterString.read(from)
1538
- );
1539
-
1540
- case 5: return new QrCodeLoginError.NotFound(FfiConverterString.read(from)
1541
- );
1542
-
1543
- case 6: return new QrCodeLoginError.CrossProcessRefreshLock(FfiConverterString.read(from)
1544
- );
1545
-
1546
- case 7: return new QrCodeLoginError.UserIdDiscovery(FfiConverterString.read(from)
1547
- );
1548
-
1549
- case 8: return new QrCodeLoginError.SessionTokens(FfiConverterString.read(from)
1550
- );
1551
-
1552
- case 9: return new QrCodeLoginError.DeviceKeyUpload(FfiConverterString.read(from)
1553
- );
1554
-
1555
- case 10: return new QrCodeLoginError.SecretImport(FfiConverterString.read(from)
1556
- );
1557
-
1558
- case 11: return new QrCodeLoginError.ServerReset(FfiConverterString.read(from)
1559
- );
1560
-
1561
- default: throw new UniffiInternalError.UnexpectedEnumCase();
1562
- }
1563
- }
1564
- write(value: TypeName, into: RustBuffer): void {
1565
- const obj = value as any;
1566
- const index = obj[variantOrdinalSymbol] as number;
1567
- intConverter.write(index, into);
1568
- }
1569
- allocationSize(value: TypeName): number {
1570
- return intConverter.allocationSize(0);
1571
- }
1572
- }
1573
- return new FfiConverter();
1574
- })();
1575
-
1576
-
1577
- /**
1578
- * The role of a member in a room.
1579
- */
1580
- export enum RoomMemberRole {
1581
- /**
1582
- * The member is a creator.
1583
- *
1584
- * A creator has an infinite power level and cannot be demoted, so this
1585
- * role is immutable. A room can have several creators.
1586
- *
1587
- * It is available in room versions where
1588
- * `explicitly_privilege_room_creators` in [`AuthorizationRules`] is set to
1589
- * `true`.
1590
- *
1591
- * [`AuthorizationRules`]: ruma::room_version_rules::AuthorizationRules
1592
- */
1593
- Creator,
1594
- /**
1595
- * The member is an administrator.
1596
- */
1597
- Administrator,
1598
- /**
1599
- * The member is a moderator.
1600
- */
1601
- Moderator,
1602
- /**
1603
- * The member is a regular user.
1604
- */
1605
- User
1606
- }
1607
-
1608
- const FfiConverterTypeRoomMemberRole = (() => {
1609
- const ordinalConverter = FfiConverterInt32;
1610
- type TypeName = RoomMemberRole;
1611
- class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
1612
- read(from: RustBuffer): TypeName {
1613
- switch (ordinalConverter.read(from)) {
1614
- case 1: return RoomMemberRole.Creator;
1615
- case 2: return RoomMemberRole.Administrator;
1616
- case 3: return RoomMemberRole.Moderator;
1617
- case 4: return RoomMemberRole.User;
1618
- default: throw new UniffiInternalError.UnexpectedEnumCase();
1619
- }
1620
- }
1621
- write(value: TypeName, into: RustBuffer): void {
1622
- switch (value) {
1623
- case RoomMemberRole.Creator: return ordinalConverter.write(1, into);
1624
- case RoomMemberRole.Administrator: return ordinalConverter.write(2, into);
1625
- case RoomMemberRole.Moderator: return ordinalConverter.write(3, into);
1626
- case RoomMemberRole.User: return ordinalConverter.write(4, into);
1627
- }
1628
- }
1629
- allocationSize(value: TypeName): number {
1630
- return ordinalConverter.allocationSize(0);
1631
- }
1632
- }
1633
- return new FFIConverter();
1634
- })();
1635
-
1636
-
1637
-
1638
-
1639
-
1640
- /**
1641
- * The data needed to perform authorization using OAuth 2.0.
1642
- */
1643
- export interface OAuthAuthorizationDataLike {
1644
-
1645
- /**
1646
- * The login URL to use for authorization.
1647
- */
1648
- loginUrl() : string;
1649
- }
1650
- /**
1651
- * @deprecated Use `OAuthAuthorizationDataLike` instead.
1652
- */
1653
- export type OAuthAuthorizationDataInterface = OAuthAuthorizationDataLike;
1654
-
1655
-
1656
- /**
1657
- * The data needed to perform authorization using OAuth 2.0.
1658
- */
1659
- export class OAuthAuthorizationData extends UniffiAbstractObject implements OAuthAuthorizationDataLike {
1660
-
1661
- readonly [uniffiTypeNameSymbol] = "OAuthAuthorizationData";
1662
- readonly [destructorGuardSymbol]: UniffiGcObject;
1663
- readonly [pointerLiteralSymbol]: UniffiHandle;
1664
- // No primary constructor declared for this class.
1665
- private constructor(pointer: UniffiHandle) {
1666
- super();
1667
- this[pointerLiteralSymbol] = pointer;
1668
- this[destructorGuardSymbol] = uniffiTypeOAuthAuthorizationDataObjectFactory.bless(pointer);
1669
- }
1670
-
1671
-
1672
-
1673
-
1674
- /**
1675
- * The login URL to use for authorization.
1676
- */
1677
- loginUrl(): string {
1678
- return FfiConverterString.lift(uniffiCaller.rustCall(
1679
- /*caller:*/ (callStatus) => {
1680
- return nativeModule().ubrn_uniffi_matrix_sdk_fn_method_oauthauthorizationdata_login_url(uniffiTypeOAuthAuthorizationDataObjectFactory.clonePointer(this),
1681
- callStatus);
1682
- },
1683
- /*liftString:*/ FfiConverterString.lift,
1684
- ));
1685
- }
1686
-
1687
-
1688
- /**
1689
- * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1690
- */
1691
- uniffiDestroy(): void {
1692
- const ptr = (this as any)[destructorGuardSymbol];
1693
- if (ptr !== undefined) {
1694
- const pointer = uniffiTypeOAuthAuthorizationDataObjectFactory.pointer(this);
1695
- uniffiTypeOAuthAuthorizationDataObjectFactory.freePointer(pointer);
1696
- uniffiTypeOAuthAuthorizationDataObjectFactory.unbless(ptr);
1697
- delete (this as any)[destructorGuardSymbol];
1698
- }
1699
- }
1700
-
1701
- static instanceOf(obj: any): obj is OAuthAuthorizationData {
1702
- return uniffiTypeOAuthAuthorizationDataObjectFactory.isConcreteType(obj);
1703
- }
1704
-
1705
-
1706
- }
1707
-
1708
- const uniffiTypeOAuthAuthorizationDataObjectFactory: UniffiObjectFactory<OAuthAuthorizationDataLike> = (() => {
1709
-
1710
- /// <reference lib="es2021" />
1711
- const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
1712
- uniffiTypeOAuthAuthorizationDataObjectFactory.freePointer(heldValue);
1713
- }) : null;
1714
-
1715
- return {
1716
- create(pointer: UniffiHandle): OAuthAuthorizationDataLike {
1717
- const instance = Object.create(OAuthAuthorizationData.prototype);
1718
- instance[pointerLiteralSymbol] = pointer;
1719
- instance[destructorGuardSymbol] = this.bless(pointer);
1720
- instance[uniffiTypeNameSymbol] = "OAuthAuthorizationData";
1721
- return instance;
1722
- },
1723
-
1724
-
1725
- bless(p: UniffiHandle): UniffiGcObject {
1726
- const ptr = {
1727
- p, // make sure this object doesn't get optimized away.
1728
- markDestroyed: () => undefined,
1729
- };
1730
- if (registry) {
1731
- registry.register(ptr, p, ptr);
1732
- }
1733
- return ptr;
1734
- },
1735
-
1736
- unbless(ptr: UniffiGcObject) {
1737
- if (registry) {
1738
- registry.unregister(ptr);
1739
- }
1740
- },
1741
-
1742
- pointer(obj: OAuthAuthorizationDataLike): UniffiHandle {
1743
- if ((obj as any)[destructorGuardSymbol] === undefined) {
1744
- throw new UniffiInternalError.UnexpectedNullPointer();
1745
- }
1746
- return (obj as any)[pointerLiteralSymbol];
1747
- },
1748
-
1749
- clonePointer(obj: OAuthAuthorizationDataLike): UniffiHandle {
1750
- const pointer = this.pointer(obj);
1751
- return uniffiCaller.rustCall(
1752
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_sdk_fn_clone_oauthauthorizationdata(pointer, callStatus),
1753
- /*liftString:*/ FfiConverterString.lift
1754
- );
1755
- },
1756
-
1757
- freePointer(pointer: UniffiHandle): void {
1758
- uniffiCaller.rustCall(
1759
- /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_sdk_fn_free_oauthauthorizationdata(pointer, callStatus),
1760
- /*liftString:*/ FfiConverterString.lift
1761
- );
1762
- },
1763
-
1764
- isConcreteType(obj: any): obj is OAuthAuthorizationDataLike {
1765
- return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "OAuthAuthorizationData";
1766
- },
1767
- }})();
1768
- // FfiConverter for OAuthAuthorizationDataLike
1769
- const FfiConverterTypeOAuthAuthorizationData = new FfiConverterObject(uniffiTypeOAuthAuthorizationDataObjectFactory);
1770
-
1771
-
1772
- // FfiConverter for boolean | undefined
1773
- const FfiConverterOptionalBool = new FfiConverterOptional(FfiConverterBool);
1774
-
1775
-
1776
- // FfiConverter for /*f64*/number | undefined
1777
- const FfiConverterOptionalFloat64 = new FfiConverterOptional(FfiConverterFloat64);
1778
-
1779
-
1780
- // FfiConverter for /*i64*/bigint | undefined
1781
- const FfiConverterOptionalInt64 = new FfiConverterOptional(FfiConverterInt64);
1782
-
1783
-
1784
- // FfiConverter for string | undefined
1785
- const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
1786
-
1787
-
1788
- // FfiConverter for HeaderStyle | undefined
1789
- const FfiConverterOptionalTypeHeaderStyle = new FfiConverterOptional(FfiConverterTypeHeaderStyle);
1790
-
1791
-
1792
- // FfiConverter for Intent | undefined
1793
- const FfiConverterOptionalTypeIntent = new FfiConverterOptional(FfiConverterTypeIntent);
1794
-
1795
-
1796
- // FfiConverter for NotificationType | undefined
1797
- const FfiConverterOptionalTypeNotificationType = new FfiConverterOptional(FfiConverterTypeNotificationType);
1798
-
1799
-
1800
-
1801
- /**
1802
- * This should be called before anything else.
1803
- *
1804
- * It is likely that this is being done for you by the library's `index.ts`.
1805
- *
1806
- * It checks versions of uniffi between when the Rust scaffolding was generated
1807
- * and when the bindings were generated.
1808
- *
1809
- * It also initializes the machinery to enable Rust to talk back to Javascript.
1810
- */
1811
- function uniffiEnsureInitialized() {
1812
- // Get the bindings contract version from our ComponentInterface
1813
- const bindingsContractVersion = 30;
1814
- // Get the scaffolding contract version by calling the into the dylib
1815
- const scaffoldingContractVersion = nativeModule().ubrn_ffi_matrix_sdk_uniffi_contract_version();
1816
- if (bindingsContractVersion !== scaffoldingContractVersion) {
1817
- throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
1818
- }
1819
- if (nativeModule().ubrn_uniffi_matrix_sdk_checksum_method_oauthauthorizationdata_login_url() !== 47865) {
1820
- throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_sdk_checksum_method_oauthauthorizationdata_login_url");
1821
- }
1822
-
1823
- }
1824
-
1825
- export default Object.freeze({
1826
- initialize: uniffiEnsureInitialized,
1827
- converters: {
1828
- FfiConverterTypeBackupDownloadStrategy,
1829
- FfiConverterTypeEncryptionSystem,
1830
- FfiConverterTypeHeaderStyle,
1831
- FfiConverterTypeIntent,
1832
- FfiConverterTypeNotificationType,
1833
- FfiConverterTypeOAuthAuthorizationData,
1834
- FfiConverterTypePaginationStatus,
1835
- FfiConverterTypePaginatorState,
1836
- FfiConverterTypeQRCodeLoginError,
1837
- FfiConverterTypeRoomMemberRole,
1838
- FfiConverterTypeRoomPowerLevelChanges,
1839
- FfiConverterTypeServerVendorInfo,
1840
- FfiConverterTypeVirtualElementCallWidgetConfig,
1841
- FfiConverterTypeVirtualElementCallWidgetProperties,
1842
- }
1843
- });