matrix-sdk-python 0.18.0a1__cp314-cp314-win_amd64.whl
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.
- matrix_sdk_python/__init__.py +23 -0
- matrix_sdk_python/_generated/__init__.py +1 -0
- matrix_sdk_python/_generated/matrix_sdk.py +2533 -0
- matrix_sdk_python/_generated/matrix_sdk_base.py +1061 -0
- matrix_sdk_python/_generated/matrix_sdk_common.py +1101 -0
- matrix_sdk_python/_generated/matrix_sdk_contentscanner.py +942 -0
- matrix_sdk_python/_generated/matrix_sdk_crypto.py +1876 -0
- matrix_sdk_python/_generated/matrix_sdk_ffi.dll +0 -0
- matrix_sdk_python/_generated/matrix_sdk_ffi.py +65464 -0
- matrix_sdk_python/_generated/matrix_sdk_ui.py +1542 -0
- matrix_sdk_python/_version.py +1 -0
- matrix_sdk_python/py.typed +1 -0
- matrix_sdk_python-0.18.0a1.dist-info/METADATA +87 -0
- matrix_sdk_python-0.18.0a1.dist-info/RECORD +16 -0
- matrix_sdk_python-0.18.0a1.dist-info/WHEEL +5 -0
- matrix_sdk_python-0.18.0a1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,2533 @@
|
|
|
1
|
+
# This file was autogenerated by some hot garbage in the `uniffi` crate.
|
|
2
|
+
# Trust me, you don't want to mess with it!
|
|
3
|
+
|
|
4
|
+
# Common helper code.
|
|
5
|
+
#
|
|
6
|
+
# Ideally this would live in a separate .py file where it can be unittested etc
|
|
7
|
+
# in isolation, and perhaps even published as a re-useable package.
|
|
8
|
+
#
|
|
9
|
+
# However, it's important that the details of how this helper code works (e.g. the
|
|
10
|
+
# way that different builtin types are passed across the FFI) exactly match what's
|
|
11
|
+
# expected by the rust code on the other side of the interface. In practice right
|
|
12
|
+
# now that means coming from the exact some version of `uniffi` that was used to
|
|
13
|
+
# compile the rust component. The easiest way to ensure this is to bundle the Python
|
|
14
|
+
# helpers directly inline like we're doing here.
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import os
|
|
18
|
+
import sys
|
|
19
|
+
import ctypes
|
|
20
|
+
from dataclasses import dataclass
|
|
21
|
+
import enum
|
|
22
|
+
import struct
|
|
23
|
+
import contextlib
|
|
24
|
+
import datetime
|
|
25
|
+
import threading
|
|
26
|
+
import itertools
|
|
27
|
+
import traceback
|
|
28
|
+
import typing
|
|
29
|
+
import platform
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# Used for default argument values
|
|
33
|
+
_DEFAULT = object() # type: typing.Any
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class _UniffiRustBuffer(ctypes.Structure):
|
|
37
|
+
_fields_ = [
|
|
38
|
+
("capacity", ctypes.c_uint64),
|
|
39
|
+
("len", ctypes.c_uint64),
|
|
40
|
+
("data", ctypes.POINTER(ctypes.c_char)),
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
@staticmethod
|
|
44
|
+
def default():
|
|
45
|
+
return _UniffiRustBuffer(0, 0, None)
|
|
46
|
+
|
|
47
|
+
@staticmethod
|
|
48
|
+
def alloc(size):
|
|
49
|
+
return _uniffi_rust_call(_UniffiLib.ffi_matrix_sdk_rustbuffer_alloc, size)
|
|
50
|
+
|
|
51
|
+
@staticmethod
|
|
52
|
+
def reserve(rbuf, additional):
|
|
53
|
+
return _uniffi_rust_call(_UniffiLib.ffi_matrix_sdk_rustbuffer_reserve, rbuf, additional)
|
|
54
|
+
|
|
55
|
+
def free(self):
|
|
56
|
+
return _uniffi_rust_call(_UniffiLib.ffi_matrix_sdk_rustbuffer_free, self)
|
|
57
|
+
|
|
58
|
+
def __str__(self):
|
|
59
|
+
return "_UniffiRustBuffer(capacity={}, len={}, data={})".format(
|
|
60
|
+
self.capacity,
|
|
61
|
+
self.len,
|
|
62
|
+
self.data[0:self.len]
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
@contextlib.contextmanager
|
|
66
|
+
def alloc_with_builder(*args):
|
|
67
|
+
"""Context-manger to allocate a buffer using a _UniffiRustBufferBuilder.
|
|
68
|
+
|
|
69
|
+
The allocated buffer will be automatically freed if an error occurs, ensuring that
|
|
70
|
+
we don't accidentally leak it.
|
|
71
|
+
"""
|
|
72
|
+
builder = _UniffiRustBufferBuilder()
|
|
73
|
+
try:
|
|
74
|
+
yield builder
|
|
75
|
+
except:
|
|
76
|
+
builder.discard()
|
|
77
|
+
raise
|
|
78
|
+
|
|
79
|
+
@contextlib.contextmanager
|
|
80
|
+
def consume_with_stream(self):
|
|
81
|
+
"""Context-manager to consume a buffer using a _UniffiRustBufferStream.
|
|
82
|
+
|
|
83
|
+
The _UniffiRustBuffer will be freed once the context-manager exits, ensuring that we don't
|
|
84
|
+
leak it even if an error occurs.
|
|
85
|
+
"""
|
|
86
|
+
try:
|
|
87
|
+
s = _UniffiRustBufferStream.from_rust_buffer(self)
|
|
88
|
+
yield s
|
|
89
|
+
if s.remaining() != 0:
|
|
90
|
+
raise RuntimeError(f"junk data left in buffer at end of consume_with_stream {s.remaining()}")
|
|
91
|
+
finally:
|
|
92
|
+
self.free()
|
|
93
|
+
|
|
94
|
+
@contextlib.contextmanager
|
|
95
|
+
def read_with_stream(self):
|
|
96
|
+
"""Context-manager to read a buffer using a _UniffiRustBufferStream.
|
|
97
|
+
|
|
98
|
+
This is like consume_with_stream, but doesn't free the buffer afterwards.
|
|
99
|
+
It should only be used with borrowed `_UniffiRustBuffer` data.
|
|
100
|
+
"""
|
|
101
|
+
s = _UniffiRustBufferStream.from_rust_buffer(self)
|
|
102
|
+
yield s
|
|
103
|
+
if s.remaining() != 0:
|
|
104
|
+
raise RuntimeError(f"junk data left in buffer at end of read_with_stream {s.remaining()}")
|
|
105
|
+
|
|
106
|
+
class _UniffiForeignBytes(ctypes.Structure):
|
|
107
|
+
_fields_ = [
|
|
108
|
+
("len", ctypes.c_int32),
|
|
109
|
+
("data", ctypes.POINTER(ctypes.c_char)),
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
def __str__(self):
|
|
113
|
+
return "_UniffiForeignBytes(len={}, data={})".format(self.len, self.data[0:self.len])
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class _UniffiRustBufferStream:
|
|
117
|
+
"""
|
|
118
|
+
Helper for structured reading of bytes from a _UniffiRustBuffer
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
def __init__(self, data, len):
|
|
122
|
+
self.data = data
|
|
123
|
+
self.len = len
|
|
124
|
+
self.offset = 0
|
|
125
|
+
|
|
126
|
+
@classmethod
|
|
127
|
+
def from_rust_buffer(cls, buf):
|
|
128
|
+
return cls(buf.data, buf.len)
|
|
129
|
+
|
|
130
|
+
def remaining(self):
|
|
131
|
+
return self.len - self.offset
|
|
132
|
+
|
|
133
|
+
def _unpack_from(self, size, format):
|
|
134
|
+
if self.offset + size > self.len:
|
|
135
|
+
raise InternalError("read past end of rust buffer")
|
|
136
|
+
value = struct.unpack(format, self.data[self.offset:self.offset+size])[0]
|
|
137
|
+
self.offset += size
|
|
138
|
+
return value
|
|
139
|
+
|
|
140
|
+
def read(self, size):
|
|
141
|
+
if self.offset + size > self.len:
|
|
142
|
+
raise InternalError("read past end of rust buffer")
|
|
143
|
+
data = self.data[self.offset:self.offset+size]
|
|
144
|
+
self.offset += size
|
|
145
|
+
return data
|
|
146
|
+
|
|
147
|
+
def read_i8(self):
|
|
148
|
+
return self._unpack_from(1, ">b")
|
|
149
|
+
|
|
150
|
+
def read_u8(self):
|
|
151
|
+
return self._unpack_from(1, ">B")
|
|
152
|
+
|
|
153
|
+
def read_i16(self):
|
|
154
|
+
return self._unpack_from(2, ">h")
|
|
155
|
+
|
|
156
|
+
def read_u16(self):
|
|
157
|
+
return self._unpack_from(2, ">H")
|
|
158
|
+
|
|
159
|
+
def read_i32(self):
|
|
160
|
+
return self._unpack_from(4, ">i")
|
|
161
|
+
|
|
162
|
+
def read_u32(self):
|
|
163
|
+
return self._unpack_from(4, ">I")
|
|
164
|
+
|
|
165
|
+
def read_i64(self):
|
|
166
|
+
return self._unpack_from(8, ">q")
|
|
167
|
+
|
|
168
|
+
def read_u64(self):
|
|
169
|
+
return self._unpack_from(8, ">Q")
|
|
170
|
+
|
|
171
|
+
def read_float(self):
|
|
172
|
+
v = self._unpack_from(4, ">f")
|
|
173
|
+
return v
|
|
174
|
+
|
|
175
|
+
def read_double(self):
|
|
176
|
+
return self._unpack_from(8, ">d")
|
|
177
|
+
|
|
178
|
+
class _UniffiRustBufferBuilder:
|
|
179
|
+
"""
|
|
180
|
+
Helper for structured writing of bytes into a _UniffiRustBuffer.
|
|
181
|
+
"""
|
|
182
|
+
|
|
183
|
+
def __init__(self):
|
|
184
|
+
self.rbuf = _UniffiRustBuffer.alloc(16)
|
|
185
|
+
self.rbuf.len = 0
|
|
186
|
+
|
|
187
|
+
def finalize(self):
|
|
188
|
+
rbuf = self.rbuf
|
|
189
|
+
self.rbuf = None
|
|
190
|
+
return rbuf
|
|
191
|
+
|
|
192
|
+
def discard(self):
|
|
193
|
+
if self.rbuf is not None:
|
|
194
|
+
rbuf = self.finalize()
|
|
195
|
+
rbuf.free()
|
|
196
|
+
|
|
197
|
+
@contextlib.contextmanager
|
|
198
|
+
def _reserve(self, num_bytes):
|
|
199
|
+
if self.rbuf.len + num_bytes > self.rbuf.capacity:
|
|
200
|
+
self.rbuf = _UniffiRustBuffer.reserve(self.rbuf, num_bytes)
|
|
201
|
+
yield None
|
|
202
|
+
self.rbuf.len += num_bytes
|
|
203
|
+
|
|
204
|
+
def _pack_into(self, size, format, value):
|
|
205
|
+
with self._reserve(size):
|
|
206
|
+
# XXX TODO: I feel like I should be able to use `struct.pack_into` here but can't figure it out.
|
|
207
|
+
for i, byte in enumerate(struct.pack(format, value)):
|
|
208
|
+
self.rbuf.data[self.rbuf.len + i] = byte
|
|
209
|
+
|
|
210
|
+
def write(self, value):
|
|
211
|
+
with self._reserve(len(value)):
|
|
212
|
+
for i, byte in enumerate(value):
|
|
213
|
+
self.rbuf.data[self.rbuf.len + i] = byte
|
|
214
|
+
|
|
215
|
+
def write_i8(self, v):
|
|
216
|
+
self._pack_into(1, ">b", v)
|
|
217
|
+
|
|
218
|
+
def write_u8(self, v):
|
|
219
|
+
self._pack_into(1, ">B", v)
|
|
220
|
+
|
|
221
|
+
def write_i16(self, v):
|
|
222
|
+
self._pack_into(2, ">h", v)
|
|
223
|
+
|
|
224
|
+
def write_u16(self, v):
|
|
225
|
+
self._pack_into(2, ">H", v)
|
|
226
|
+
|
|
227
|
+
def write_i32(self, v):
|
|
228
|
+
self._pack_into(4, ">i", v)
|
|
229
|
+
|
|
230
|
+
def write_u32(self, v):
|
|
231
|
+
self._pack_into(4, ">I", v)
|
|
232
|
+
|
|
233
|
+
def write_i64(self, v):
|
|
234
|
+
self._pack_into(8, ">q", v)
|
|
235
|
+
|
|
236
|
+
def write_u64(self, v):
|
|
237
|
+
self._pack_into(8, ">Q", v)
|
|
238
|
+
|
|
239
|
+
def write_float(self, v):
|
|
240
|
+
self._pack_into(4, ">f", v)
|
|
241
|
+
|
|
242
|
+
def write_double(self, v):
|
|
243
|
+
self._pack_into(8, ">d", v)
|
|
244
|
+
|
|
245
|
+
def write_c_size_t(self, v):
|
|
246
|
+
self._pack_into(ctypes.sizeof(ctypes.c_size_t) , "@N", v)
|
|
247
|
+
# A handful of classes and functions to support the generated data structures.
|
|
248
|
+
# This would be a good candidate for isolating in its own ffi-support lib.
|
|
249
|
+
|
|
250
|
+
class InternalError(Exception):
|
|
251
|
+
pass
|
|
252
|
+
|
|
253
|
+
class _UniffiRustCallStatus(ctypes.Structure):
|
|
254
|
+
"""
|
|
255
|
+
Error runtime.
|
|
256
|
+
"""
|
|
257
|
+
_fields_ = [
|
|
258
|
+
("code", ctypes.c_int8),
|
|
259
|
+
("error_buf", _UniffiRustBuffer),
|
|
260
|
+
]
|
|
261
|
+
|
|
262
|
+
# These match the values from the uniffi::rustcalls module
|
|
263
|
+
CALL_SUCCESS = 0
|
|
264
|
+
CALL_ERROR = 1
|
|
265
|
+
CALL_UNEXPECTED_ERROR = 2
|
|
266
|
+
|
|
267
|
+
@staticmethod
|
|
268
|
+
def default():
|
|
269
|
+
return _UniffiRustCallStatus(code=_UniffiRustCallStatus.CALL_SUCCESS, error_buf=_UniffiRustBuffer.default())
|
|
270
|
+
|
|
271
|
+
def __str__(self):
|
|
272
|
+
if self.code == _UniffiRustCallStatus.CALL_SUCCESS:
|
|
273
|
+
return "_UniffiRustCallStatus(CALL_SUCCESS)"
|
|
274
|
+
elif self.code == _UniffiRustCallStatus.CALL_ERROR:
|
|
275
|
+
return "_UniffiRustCallStatus(CALL_ERROR)"
|
|
276
|
+
elif self.code == _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR:
|
|
277
|
+
return "_UniffiRustCallStatus(CALL_UNEXPECTED_ERROR)"
|
|
278
|
+
else:
|
|
279
|
+
return "_UniffiRustCallStatus(<invalid code>)"
|
|
280
|
+
|
|
281
|
+
def _uniffi_rust_call(fn, *args):
|
|
282
|
+
# Call a rust function
|
|
283
|
+
return _uniffi_rust_call_with_error(None, fn, *args)
|
|
284
|
+
|
|
285
|
+
def _uniffi_rust_call_with_error(error_ffi_converter, fn, *args):
|
|
286
|
+
# Call a rust function and handle any errors
|
|
287
|
+
#
|
|
288
|
+
# This function is used for rust calls that return Result<> and therefore can set the CALL_ERROR status code.
|
|
289
|
+
# error_ffi_converter must be set to the _UniffiConverter for the error class that corresponds to the result.
|
|
290
|
+
call_status = _UniffiRustCallStatus.default()
|
|
291
|
+
|
|
292
|
+
args_with_error = args + (ctypes.byref(call_status),)
|
|
293
|
+
result = fn(*args_with_error)
|
|
294
|
+
_uniffi_check_call_status(error_ffi_converter, call_status)
|
|
295
|
+
return result
|
|
296
|
+
|
|
297
|
+
def _uniffi_check_call_status(error_ffi_converter, call_status):
|
|
298
|
+
if call_status.code == _UniffiRustCallStatus.CALL_SUCCESS:
|
|
299
|
+
pass
|
|
300
|
+
elif call_status.code == _UniffiRustCallStatus.CALL_ERROR:
|
|
301
|
+
if error_ffi_converter is None:
|
|
302
|
+
call_status.error_buf.free()
|
|
303
|
+
raise InternalError("_uniffi_rust_call_with_error: CALL_ERROR, but error_ffi_converter is None")
|
|
304
|
+
else:
|
|
305
|
+
raise error_ffi_converter.lift(call_status.error_buf)
|
|
306
|
+
elif call_status.code == _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR:
|
|
307
|
+
# When the rust code sees a panic, it tries to construct a _UniffiRustBuffer
|
|
308
|
+
# with the message. But if that code panics, then it just sends back
|
|
309
|
+
# an empty buffer.
|
|
310
|
+
if call_status.error_buf.len > 0:
|
|
311
|
+
msg = _UniffiFfiConverterString.lift(call_status.error_buf)
|
|
312
|
+
else:
|
|
313
|
+
msg = "Unknown rust panic"
|
|
314
|
+
raise InternalError(msg)
|
|
315
|
+
else:
|
|
316
|
+
raise InternalError("Invalid _UniffiRustCallStatus code: {}".format(
|
|
317
|
+
call_status.code))
|
|
318
|
+
|
|
319
|
+
def _uniffi_trait_interface_call(call_status, make_call, write_return_value):
|
|
320
|
+
try:
|
|
321
|
+
return write_return_value(make_call())
|
|
322
|
+
except Exception as e:
|
|
323
|
+
call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR
|
|
324
|
+
call_status.error_buf = _UniffiFfiConverterString.lower(repr(e))
|
|
325
|
+
|
|
326
|
+
def _uniffi_trait_interface_call_with_error(call_status, make_call, write_return_value, error_type, lower_error):
|
|
327
|
+
try:
|
|
328
|
+
try:
|
|
329
|
+
return write_return_value(make_call())
|
|
330
|
+
except error_type as e:
|
|
331
|
+
call_status.code = _UniffiRustCallStatus.CALL_ERROR
|
|
332
|
+
call_status.error_buf = lower_error(e)
|
|
333
|
+
except Exception as e:
|
|
334
|
+
call_status.code = _UniffiRustCallStatus.CALL_UNEXPECTED_ERROR
|
|
335
|
+
call_status.error_buf = _UniffiFfiConverterString.lower(repr(e))
|
|
336
|
+
# Initial value and increment amount for handles.
|
|
337
|
+
# These ensure that Python-generated handles always have the lowest bit set
|
|
338
|
+
_UNIFFI_HANDLEMAP_INITIAL = 1
|
|
339
|
+
_UNIFFI_HANDLEMAP_DELTA = 2
|
|
340
|
+
|
|
341
|
+
class _UniffiHandleMap:
|
|
342
|
+
"""
|
|
343
|
+
A map where inserting, getting and removing data is synchronized with a lock.
|
|
344
|
+
"""
|
|
345
|
+
|
|
346
|
+
def __init__(self):
|
|
347
|
+
# type Handle = int
|
|
348
|
+
self._map = {} # type: Dict[Handle, Any]
|
|
349
|
+
self._lock = threading.Lock()
|
|
350
|
+
self._counter = _UNIFFI_HANDLEMAP_INITIAL
|
|
351
|
+
|
|
352
|
+
def insert(self, obj):
|
|
353
|
+
with self._lock:
|
|
354
|
+
return self._insert(obj)
|
|
355
|
+
|
|
356
|
+
"""Low-level insert, this assumes `self._lock` is held."""
|
|
357
|
+
def _insert(self, obj):
|
|
358
|
+
handle = self._counter
|
|
359
|
+
self._counter += _UNIFFI_HANDLEMAP_DELTA
|
|
360
|
+
self._map[handle] = obj
|
|
361
|
+
return handle
|
|
362
|
+
|
|
363
|
+
def get(self, handle):
|
|
364
|
+
try:
|
|
365
|
+
with self._lock:
|
|
366
|
+
return self._map[handle]
|
|
367
|
+
except KeyError:
|
|
368
|
+
raise InternalError(f"_UniffiHandleMap.get: Invalid handle {handle}")
|
|
369
|
+
|
|
370
|
+
def clone(self, handle):
|
|
371
|
+
try:
|
|
372
|
+
with self._lock:
|
|
373
|
+
obj = self._map[handle]
|
|
374
|
+
return self._insert(obj)
|
|
375
|
+
except KeyError:
|
|
376
|
+
raise InternalError(f"_UniffiHandleMap.clone: Invalid handle {handle}")
|
|
377
|
+
|
|
378
|
+
def remove(self, handle):
|
|
379
|
+
try:
|
|
380
|
+
with self._lock:
|
|
381
|
+
return self._map.pop(handle)
|
|
382
|
+
except KeyError:
|
|
383
|
+
raise InternalError(f"_UniffiHandleMap.remove: Invalid handle: {handle}")
|
|
384
|
+
|
|
385
|
+
def __len__(self):
|
|
386
|
+
return len(self._map)
|
|
387
|
+
# Types conforming to `_UniffiConverterPrimitive` pass themselves directly over the FFI.
|
|
388
|
+
class _UniffiConverterPrimitive:
|
|
389
|
+
@classmethod
|
|
390
|
+
def lift(cls, value):
|
|
391
|
+
return value
|
|
392
|
+
|
|
393
|
+
@classmethod
|
|
394
|
+
def lower(cls, value):
|
|
395
|
+
return value
|
|
396
|
+
|
|
397
|
+
class _UniffiConverterPrimitiveInt(_UniffiConverterPrimitive):
|
|
398
|
+
@classmethod
|
|
399
|
+
def check_lower(cls, value):
|
|
400
|
+
try:
|
|
401
|
+
value = value.__index__()
|
|
402
|
+
except Exception:
|
|
403
|
+
raise TypeError("'{}' object cannot be interpreted as an integer".format(type(value).__name__))
|
|
404
|
+
if not isinstance(value, int):
|
|
405
|
+
raise TypeError("__index__ returned non-int (type {})".format(type(value).__name__))
|
|
406
|
+
if not cls.VALUE_MIN <= value < cls.VALUE_MAX:
|
|
407
|
+
raise ValueError("{} requires {} <= value < {}".format(cls.CLASS_NAME, cls.VALUE_MIN, cls.VALUE_MAX))
|
|
408
|
+
|
|
409
|
+
class _UniffiConverterPrimitiveFloat(_UniffiConverterPrimitive):
|
|
410
|
+
@classmethod
|
|
411
|
+
def check_lower(cls, value):
|
|
412
|
+
try:
|
|
413
|
+
value = value.__float__()
|
|
414
|
+
except Exception:
|
|
415
|
+
raise TypeError("must be real number, not {}".format(type(value).__name__))
|
|
416
|
+
if not isinstance(value, float):
|
|
417
|
+
raise TypeError("__float__ returned non-float (type {})".format(type(value).__name__))
|
|
418
|
+
|
|
419
|
+
# Helper class for wrapper types that will always go through a _UniffiRustBuffer.
|
|
420
|
+
# Classes should inherit from this and implement the `read` and `write` static methods.
|
|
421
|
+
class _UniffiConverterRustBuffer:
|
|
422
|
+
@classmethod
|
|
423
|
+
def lift(cls, rbuf):
|
|
424
|
+
with rbuf.consume_with_stream() as stream:
|
|
425
|
+
return cls.read(stream)
|
|
426
|
+
|
|
427
|
+
@classmethod
|
|
428
|
+
def lower(cls, value):
|
|
429
|
+
with _UniffiRustBuffer.alloc_with_builder() as builder:
|
|
430
|
+
cls.write(value, builder)
|
|
431
|
+
return builder.finalize()
|
|
432
|
+
|
|
433
|
+
# Contains loading, initialization code, and the FFI Function declarations.
|
|
434
|
+
# Define some ctypes FFI types that we use in the library
|
|
435
|
+
|
|
436
|
+
"""
|
|
437
|
+
Function pointer for a Rust task, which a callback function that takes a opaque pointer
|
|
438
|
+
"""
|
|
439
|
+
_UNIFFI_RUST_TASK = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int8)
|
|
440
|
+
|
|
441
|
+
def _uniffi_future_callback_t(return_type):
|
|
442
|
+
"""
|
|
443
|
+
Factory function to create callback function types for async functions
|
|
444
|
+
"""
|
|
445
|
+
return ctypes.CFUNCTYPE(None, ctypes.c_uint64, return_type, _UniffiRustCallStatus)
|
|
446
|
+
|
|
447
|
+
def _uniffi_load_indirect():
|
|
448
|
+
"""
|
|
449
|
+
This is how we find and load the dynamic library provided by the component.
|
|
450
|
+
For now we just look it up by name.
|
|
451
|
+
"""
|
|
452
|
+
if sys.platform == "darwin":
|
|
453
|
+
libname = "lib{}.dylib"
|
|
454
|
+
elif sys.platform.startswith("win"):
|
|
455
|
+
# As of python3.8, ctypes does not seem to search $PATH when loading DLLs.
|
|
456
|
+
# We could use `os.add_dll_directory` to configure the search path, but
|
|
457
|
+
# it doesn't feel right to mess with application-wide settings. Let's
|
|
458
|
+
# assume that the `.dll` is next to the `.py` file and load by full path.
|
|
459
|
+
libname = os.path.join(
|
|
460
|
+
os.path.dirname(__file__),
|
|
461
|
+
"{}.dll",
|
|
462
|
+
)
|
|
463
|
+
else:
|
|
464
|
+
# Anything else must be an ELF platform - Linux, *BSD, Solaris/illumos
|
|
465
|
+
libname = "lib{}.so"
|
|
466
|
+
|
|
467
|
+
libname = libname.format("matrix_sdk_ffi")
|
|
468
|
+
path = os.path.join(os.path.dirname(__file__), libname)
|
|
469
|
+
lib = ctypes.cdll.LoadLibrary(path)
|
|
470
|
+
return lib
|
|
471
|
+
|
|
472
|
+
def _uniffi_check_contract_api_version(lib):
|
|
473
|
+
# Get the bindings contract version from our ComponentInterface
|
|
474
|
+
bindings_contract_version = 30
|
|
475
|
+
# Get the scaffolding contract version by calling the into the dylib
|
|
476
|
+
scaffolding_contract_version = lib.ffi_matrix_sdk_uniffi_contract_version()
|
|
477
|
+
if bindings_contract_version != scaffolding_contract_version:
|
|
478
|
+
raise InternalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
|
|
479
|
+
|
|
480
|
+
def _uniffi_check_api_checksums(lib):
|
|
481
|
+
if lib.uniffi_matrix_sdk_checksum_method_oauthauthorizationdata_login_url() != 47865:
|
|
482
|
+
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
483
|
+
|
|
484
|
+
# A ctypes library to expose the extern-C FFI definitions.
|
|
485
|
+
# This is an implementation detail which will be called internally by the public API.
|
|
486
|
+
|
|
487
|
+
_UniffiLib = _uniffi_load_indirect()
|
|
488
|
+
_UniffiLib.ffi_matrix_sdk_rustbuffer_alloc.argtypes = (
|
|
489
|
+
ctypes.c_uint64,
|
|
490
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
491
|
+
)
|
|
492
|
+
_UniffiLib.ffi_matrix_sdk_rustbuffer_alloc.restype = _UniffiRustBuffer
|
|
493
|
+
_UniffiLib.ffi_matrix_sdk_rustbuffer_from_bytes.argtypes = (
|
|
494
|
+
_UniffiForeignBytes,
|
|
495
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
496
|
+
)
|
|
497
|
+
_UniffiLib.ffi_matrix_sdk_rustbuffer_from_bytes.restype = _UniffiRustBuffer
|
|
498
|
+
_UniffiLib.ffi_matrix_sdk_rustbuffer_free.argtypes = (
|
|
499
|
+
_UniffiRustBuffer,
|
|
500
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
501
|
+
)
|
|
502
|
+
_UniffiLib.ffi_matrix_sdk_rustbuffer_free.restype = None
|
|
503
|
+
_UniffiLib.ffi_matrix_sdk_rustbuffer_reserve.argtypes = (
|
|
504
|
+
_UniffiRustBuffer,
|
|
505
|
+
ctypes.c_uint64,
|
|
506
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
507
|
+
)
|
|
508
|
+
_UniffiLib.ffi_matrix_sdk_rustbuffer_reserve.restype = _UniffiRustBuffer
|
|
509
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK = ctypes.CFUNCTYPE(None,ctypes.c_uint64,ctypes.c_int8,
|
|
510
|
+
)
|
|
511
|
+
_UNIFFI_FOREIGN_FUTURE_DROPPED_CALLBACK = ctypes.CFUNCTYPE(None,ctypes.c_uint64,
|
|
512
|
+
)
|
|
513
|
+
class _UniffiForeignFutureDroppedCallbackStruct(ctypes.Structure):
|
|
514
|
+
_fields_ = [
|
|
515
|
+
("handle", ctypes.c_uint64),
|
|
516
|
+
("free", _UNIFFI_FOREIGN_FUTURE_DROPPED_CALLBACK),
|
|
517
|
+
]
|
|
518
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_u8.argtypes = (
|
|
519
|
+
ctypes.c_uint64,
|
|
520
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
521
|
+
ctypes.c_uint64,
|
|
522
|
+
)
|
|
523
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_u8.restype = None
|
|
524
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_u8.argtypes = (
|
|
525
|
+
ctypes.c_uint64,
|
|
526
|
+
)
|
|
527
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_u8.restype = None
|
|
528
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_u8.argtypes = (
|
|
529
|
+
ctypes.c_uint64,
|
|
530
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
531
|
+
)
|
|
532
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_u8.restype = ctypes.c_uint8
|
|
533
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_u8.argtypes = (
|
|
534
|
+
ctypes.c_uint64,
|
|
535
|
+
)
|
|
536
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_u8.restype = None
|
|
537
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_i8.argtypes = (
|
|
538
|
+
ctypes.c_uint64,
|
|
539
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
540
|
+
ctypes.c_uint64,
|
|
541
|
+
)
|
|
542
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_i8.restype = None
|
|
543
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_i8.argtypes = (
|
|
544
|
+
ctypes.c_uint64,
|
|
545
|
+
)
|
|
546
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_i8.restype = None
|
|
547
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_i8.argtypes = (
|
|
548
|
+
ctypes.c_uint64,
|
|
549
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
550
|
+
)
|
|
551
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_i8.restype = ctypes.c_int8
|
|
552
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_i8.argtypes = (
|
|
553
|
+
ctypes.c_uint64,
|
|
554
|
+
)
|
|
555
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_i8.restype = None
|
|
556
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_u16.argtypes = (
|
|
557
|
+
ctypes.c_uint64,
|
|
558
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
559
|
+
ctypes.c_uint64,
|
|
560
|
+
)
|
|
561
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_u16.restype = None
|
|
562
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_u16.argtypes = (
|
|
563
|
+
ctypes.c_uint64,
|
|
564
|
+
)
|
|
565
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_u16.restype = None
|
|
566
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_u16.argtypes = (
|
|
567
|
+
ctypes.c_uint64,
|
|
568
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
569
|
+
)
|
|
570
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_u16.restype = ctypes.c_uint16
|
|
571
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_u16.argtypes = (
|
|
572
|
+
ctypes.c_uint64,
|
|
573
|
+
)
|
|
574
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_u16.restype = None
|
|
575
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_i16.argtypes = (
|
|
576
|
+
ctypes.c_uint64,
|
|
577
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
578
|
+
ctypes.c_uint64,
|
|
579
|
+
)
|
|
580
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_i16.restype = None
|
|
581
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_i16.argtypes = (
|
|
582
|
+
ctypes.c_uint64,
|
|
583
|
+
)
|
|
584
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_i16.restype = None
|
|
585
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_i16.argtypes = (
|
|
586
|
+
ctypes.c_uint64,
|
|
587
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
588
|
+
)
|
|
589
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_i16.restype = ctypes.c_int16
|
|
590
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_i16.argtypes = (
|
|
591
|
+
ctypes.c_uint64,
|
|
592
|
+
)
|
|
593
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_i16.restype = None
|
|
594
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_u32.argtypes = (
|
|
595
|
+
ctypes.c_uint64,
|
|
596
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
597
|
+
ctypes.c_uint64,
|
|
598
|
+
)
|
|
599
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_u32.restype = None
|
|
600
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_u32.argtypes = (
|
|
601
|
+
ctypes.c_uint64,
|
|
602
|
+
)
|
|
603
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_u32.restype = None
|
|
604
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_u32.argtypes = (
|
|
605
|
+
ctypes.c_uint64,
|
|
606
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
607
|
+
)
|
|
608
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_u32.restype = ctypes.c_uint32
|
|
609
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_u32.argtypes = (
|
|
610
|
+
ctypes.c_uint64,
|
|
611
|
+
)
|
|
612
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_u32.restype = None
|
|
613
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_i32.argtypes = (
|
|
614
|
+
ctypes.c_uint64,
|
|
615
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
616
|
+
ctypes.c_uint64,
|
|
617
|
+
)
|
|
618
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_i32.restype = None
|
|
619
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_i32.argtypes = (
|
|
620
|
+
ctypes.c_uint64,
|
|
621
|
+
)
|
|
622
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_i32.restype = None
|
|
623
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_i32.argtypes = (
|
|
624
|
+
ctypes.c_uint64,
|
|
625
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
626
|
+
)
|
|
627
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_i32.restype = ctypes.c_int32
|
|
628
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_i32.argtypes = (
|
|
629
|
+
ctypes.c_uint64,
|
|
630
|
+
)
|
|
631
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_i32.restype = None
|
|
632
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_u64.argtypes = (
|
|
633
|
+
ctypes.c_uint64,
|
|
634
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
635
|
+
ctypes.c_uint64,
|
|
636
|
+
)
|
|
637
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_u64.restype = None
|
|
638
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_u64.argtypes = (
|
|
639
|
+
ctypes.c_uint64,
|
|
640
|
+
)
|
|
641
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_u64.restype = None
|
|
642
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_u64.argtypes = (
|
|
643
|
+
ctypes.c_uint64,
|
|
644
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
645
|
+
)
|
|
646
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_u64.restype = ctypes.c_uint64
|
|
647
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_u64.argtypes = (
|
|
648
|
+
ctypes.c_uint64,
|
|
649
|
+
)
|
|
650
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_u64.restype = None
|
|
651
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_i64.argtypes = (
|
|
652
|
+
ctypes.c_uint64,
|
|
653
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
654
|
+
ctypes.c_uint64,
|
|
655
|
+
)
|
|
656
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_i64.restype = None
|
|
657
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_i64.argtypes = (
|
|
658
|
+
ctypes.c_uint64,
|
|
659
|
+
)
|
|
660
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_i64.restype = None
|
|
661
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_i64.argtypes = (
|
|
662
|
+
ctypes.c_uint64,
|
|
663
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
664
|
+
)
|
|
665
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_i64.restype = ctypes.c_int64
|
|
666
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_i64.argtypes = (
|
|
667
|
+
ctypes.c_uint64,
|
|
668
|
+
)
|
|
669
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_i64.restype = None
|
|
670
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_f32.argtypes = (
|
|
671
|
+
ctypes.c_uint64,
|
|
672
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
673
|
+
ctypes.c_uint64,
|
|
674
|
+
)
|
|
675
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_f32.restype = None
|
|
676
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_f32.argtypes = (
|
|
677
|
+
ctypes.c_uint64,
|
|
678
|
+
)
|
|
679
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_f32.restype = None
|
|
680
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_f32.argtypes = (
|
|
681
|
+
ctypes.c_uint64,
|
|
682
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
683
|
+
)
|
|
684
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_f32.restype = ctypes.c_float
|
|
685
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_f32.argtypes = (
|
|
686
|
+
ctypes.c_uint64,
|
|
687
|
+
)
|
|
688
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_f32.restype = None
|
|
689
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_f64.argtypes = (
|
|
690
|
+
ctypes.c_uint64,
|
|
691
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
692
|
+
ctypes.c_uint64,
|
|
693
|
+
)
|
|
694
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_f64.restype = None
|
|
695
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_f64.argtypes = (
|
|
696
|
+
ctypes.c_uint64,
|
|
697
|
+
)
|
|
698
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_f64.restype = None
|
|
699
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_f64.argtypes = (
|
|
700
|
+
ctypes.c_uint64,
|
|
701
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
702
|
+
)
|
|
703
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_f64.restype = ctypes.c_double
|
|
704
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_f64.argtypes = (
|
|
705
|
+
ctypes.c_uint64,
|
|
706
|
+
)
|
|
707
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_f64.restype = None
|
|
708
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_rust_buffer.argtypes = (
|
|
709
|
+
ctypes.c_uint64,
|
|
710
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
711
|
+
ctypes.c_uint64,
|
|
712
|
+
)
|
|
713
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_rust_buffer.restype = None
|
|
714
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_rust_buffer.argtypes = (
|
|
715
|
+
ctypes.c_uint64,
|
|
716
|
+
)
|
|
717
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_rust_buffer.restype = None
|
|
718
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_rust_buffer.argtypes = (
|
|
719
|
+
ctypes.c_uint64,
|
|
720
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
721
|
+
)
|
|
722
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_rust_buffer.restype = _UniffiRustBuffer
|
|
723
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_rust_buffer.argtypes = (
|
|
724
|
+
ctypes.c_uint64,
|
|
725
|
+
)
|
|
726
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_rust_buffer.restype = None
|
|
727
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_void.argtypes = (
|
|
728
|
+
ctypes.c_uint64,
|
|
729
|
+
_UNIFFI_RUST_FUTURE_CONTINUATION_CALLBACK,
|
|
730
|
+
ctypes.c_uint64,
|
|
731
|
+
)
|
|
732
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_poll_void.restype = None
|
|
733
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_void.argtypes = (
|
|
734
|
+
ctypes.c_uint64,
|
|
735
|
+
)
|
|
736
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_cancel_void.restype = None
|
|
737
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_void.argtypes = (
|
|
738
|
+
ctypes.c_uint64,
|
|
739
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
740
|
+
)
|
|
741
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_complete_void.restype = None
|
|
742
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_void.argtypes = (
|
|
743
|
+
ctypes.c_uint64,
|
|
744
|
+
)
|
|
745
|
+
_UniffiLib.ffi_matrix_sdk_rust_future_free_void.restype = None
|
|
746
|
+
_UniffiLib.uniffi_matrix_sdk_fn_clone_oauthauthorizationdata.argtypes = (
|
|
747
|
+
ctypes.c_uint64,
|
|
748
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
749
|
+
)
|
|
750
|
+
_UniffiLib.uniffi_matrix_sdk_fn_clone_oauthauthorizationdata.restype = ctypes.c_uint64
|
|
751
|
+
_UniffiLib.uniffi_matrix_sdk_fn_free_oauthauthorizationdata.argtypes = (
|
|
752
|
+
ctypes.c_uint64,
|
|
753
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
754
|
+
)
|
|
755
|
+
_UniffiLib.uniffi_matrix_sdk_fn_free_oauthauthorizationdata.restype = None
|
|
756
|
+
_UniffiLib.uniffi_matrix_sdk_fn_method_oauthauthorizationdata_login_url.argtypes = (
|
|
757
|
+
ctypes.c_uint64,
|
|
758
|
+
ctypes.POINTER(_UniffiRustCallStatus),
|
|
759
|
+
)
|
|
760
|
+
_UniffiLib.uniffi_matrix_sdk_fn_method_oauthauthorizationdata_login_url.restype = _UniffiRustBuffer
|
|
761
|
+
_UniffiLib.ffi_matrix_sdk_uniffi_contract_version.argtypes = (
|
|
762
|
+
)
|
|
763
|
+
_UniffiLib.ffi_matrix_sdk_uniffi_contract_version.restype = ctypes.c_uint32
|
|
764
|
+
_UniffiLib.uniffi_matrix_sdk_checksum_method_oauthauthorizationdata_login_url.argtypes = (
|
|
765
|
+
)
|
|
766
|
+
_UniffiLib.uniffi_matrix_sdk_checksum_method_oauthauthorizationdata_login_url.restype = ctypes.c_uint16
|
|
767
|
+
|
|
768
|
+
_uniffi_check_contract_api_version(_UniffiLib)
|
|
769
|
+
# _uniffi_check_api_checksums(_UniffiLib)
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
# Public interface members begin here.
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
class _UniffiFfiConverterInt64(_UniffiConverterPrimitiveInt):
|
|
777
|
+
CLASS_NAME = "i64"
|
|
778
|
+
VALUE_MIN = -2**63
|
|
779
|
+
VALUE_MAX = 2**63
|
|
780
|
+
|
|
781
|
+
@staticmethod
|
|
782
|
+
def read(buf):
|
|
783
|
+
return buf.read_i64()
|
|
784
|
+
|
|
785
|
+
@staticmethod
|
|
786
|
+
def write(value, buf):
|
|
787
|
+
buf.write_i64(value)
|
|
788
|
+
|
|
789
|
+
class _UniffiFfiConverterOptionalInt64(_UniffiConverterRustBuffer):
|
|
790
|
+
@classmethod
|
|
791
|
+
def check_lower(cls, value):
|
|
792
|
+
if value is not None:
|
|
793
|
+
_UniffiFfiConverterInt64.check_lower(value)
|
|
794
|
+
|
|
795
|
+
@classmethod
|
|
796
|
+
def write(cls, value, buf):
|
|
797
|
+
if value is None:
|
|
798
|
+
buf.write_u8(0)
|
|
799
|
+
return
|
|
800
|
+
|
|
801
|
+
buf.write_u8(1)
|
|
802
|
+
_UniffiFfiConverterInt64.write(value, buf)
|
|
803
|
+
|
|
804
|
+
@classmethod
|
|
805
|
+
def read(cls, buf):
|
|
806
|
+
flag = buf.read_u8()
|
|
807
|
+
if flag == 0:
|
|
808
|
+
return None
|
|
809
|
+
elif flag == 1:
|
|
810
|
+
return _UniffiFfiConverterInt64.read(buf)
|
|
811
|
+
else:
|
|
812
|
+
raise InternalError("Unexpected flag byte for optional type")
|
|
813
|
+
|
|
814
|
+
@dataclass
|
|
815
|
+
class RoomPowerLevelChanges:
|
|
816
|
+
"""
|
|
817
|
+
A set of common power levels required for various operations within a room,
|
|
818
|
+
that can be applied as a single operation. When updating these
|
|
819
|
+
settings, any levels that are `None` will remain unchanged.
|
|
820
|
+
"""
|
|
821
|
+
def __init__(self, *, ban:typing.Optional[int] = _DEFAULT, invite:typing.Optional[int] = _DEFAULT, kick:typing.Optional[int] = _DEFAULT, redact:typing.Optional[int] = _DEFAULT, events_default:typing.Optional[int] = _DEFAULT, state_default:typing.Optional[int] = _DEFAULT, users_default:typing.Optional[int] = _DEFAULT, room_name:typing.Optional[int] = _DEFAULT, room_avatar:typing.Optional[int] = _DEFAULT, room_topic:typing.Optional[int] = _DEFAULT, space_child:typing.Optional[int] = _DEFAULT, beacon:typing.Optional[int] = _DEFAULT, beacon_info:typing.Optional[int] = _DEFAULT):
|
|
822
|
+
if ban is _DEFAULT:
|
|
823
|
+
self.ban = None
|
|
824
|
+
else:
|
|
825
|
+
self.ban = ban
|
|
826
|
+
if invite is _DEFAULT:
|
|
827
|
+
self.invite = None
|
|
828
|
+
else:
|
|
829
|
+
self.invite = invite
|
|
830
|
+
if kick is _DEFAULT:
|
|
831
|
+
self.kick = None
|
|
832
|
+
else:
|
|
833
|
+
self.kick = kick
|
|
834
|
+
if redact is _DEFAULT:
|
|
835
|
+
self.redact = None
|
|
836
|
+
else:
|
|
837
|
+
self.redact = redact
|
|
838
|
+
if events_default is _DEFAULT:
|
|
839
|
+
self.events_default = None
|
|
840
|
+
else:
|
|
841
|
+
self.events_default = events_default
|
|
842
|
+
if state_default is _DEFAULT:
|
|
843
|
+
self.state_default = None
|
|
844
|
+
else:
|
|
845
|
+
self.state_default = state_default
|
|
846
|
+
if users_default is _DEFAULT:
|
|
847
|
+
self.users_default = None
|
|
848
|
+
else:
|
|
849
|
+
self.users_default = users_default
|
|
850
|
+
if room_name is _DEFAULT:
|
|
851
|
+
self.room_name = None
|
|
852
|
+
else:
|
|
853
|
+
self.room_name = room_name
|
|
854
|
+
if room_avatar is _DEFAULT:
|
|
855
|
+
self.room_avatar = None
|
|
856
|
+
else:
|
|
857
|
+
self.room_avatar = room_avatar
|
|
858
|
+
if room_topic is _DEFAULT:
|
|
859
|
+
self.room_topic = None
|
|
860
|
+
else:
|
|
861
|
+
self.room_topic = room_topic
|
|
862
|
+
if space_child is _DEFAULT:
|
|
863
|
+
self.space_child = None
|
|
864
|
+
else:
|
|
865
|
+
self.space_child = space_child
|
|
866
|
+
if beacon is _DEFAULT:
|
|
867
|
+
self.beacon = None
|
|
868
|
+
else:
|
|
869
|
+
self.beacon = beacon
|
|
870
|
+
if beacon_info is _DEFAULT:
|
|
871
|
+
self.beacon_info = None
|
|
872
|
+
else:
|
|
873
|
+
self.beacon_info = beacon_info
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
def __str__(self):
|
|
879
|
+
return "RoomPowerLevelChanges(ban={}, invite={}, kick={}, redact={}, events_default={}, state_default={}, users_default={}, room_name={}, room_avatar={}, room_topic={}, space_child={}, beacon={}, beacon_info={})".format(self.ban, self.invite, self.kick, self.redact, self.events_default, self.state_default, self.users_default, self.room_name, self.room_avatar, self.room_topic, self.space_child, self.beacon, self.beacon_info)
|
|
880
|
+
def __eq__(self, other):
|
|
881
|
+
if self.ban != other.ban:
|
|
882
|
+
return False
|
|
883
|
+
if self.invite != other.invite:
|
|
884
|
+
return False
|
|
885
|
+
if self.kick != other.kick:
|
|
886
|
+
return False
|
|
887
|
+
if self.redact != other.redact:
|
|
888
|
+
return False
|
|
889
|
+
if self.events_default != other.events_default:
|
|
890
|
+
return False
|
|
891
|
+
if self.state_default != other.state_default:
|
|
892
|
+
return False
|
|
893
|
+
if self.users_default != other.users_default:
|
|
894
|
+
return False
|
|
895
|
+
if self.room_name != other.room_name:
|
|
896
|
+
return False
|
|
897
|
+
if self.room_avatar != other.room_avatar:
|
|
898
|
+
return False
|
|
899
|
+
if self.room_topic != other.room_topic:
|
|
900
|
+
return False
|
|
901
|
+
if self.space_child != other.space_child:
|
|
902
|
+
return False
|
|
903
|
+
if self.beacon != other.beacon:
|
|
904
|
+
return False
|
|
905
|
+
if self.beacon_info != other.beacon_info:
|
|
906
|
+
return False
|
|
907
|
+
return True
|
|
908
|
+
|
|
909
|
+
class _UniffiFfiConverterTypeRoomPowerLevelChanges(_UniffiConverterRustBuffer):
|
|
910
|
+
@staticmethod
|
|
911
|
+
def read(buf):
|
|
912
|
+
return RoomPowerLevelChanges(
|
|
913
|
+
ban=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
914
|
+
invite=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
915
|
+
kick=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
916
|
+
redact=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
917
|
+
events_default=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
918
|
+
state_default=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
919
|
+
users_default=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
920
|
+
room_name=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
921
|
+
room_avatar=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
922
|
+
room_topic=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
923
|
+
space_child=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
924
|
+
beacon=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
925
|
+
beacon_info=_UniffiFfiConverterOptionalInt64.read(buf),
|
|
926
|
+
)
|
|
927
|
+
|
|
928
|
+
@staticmethod
|
|
929
|
+
def check_lower(value):
|
|
930
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.ban)
|
|
931
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.invite)
|
|
932
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.kick)
|
|
933
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.redact)
|
|
934
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.events_default)
|
|
935
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.state_default)
|
|
936
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.users_default)
|
|
937
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.room_name)
|
|
938
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.room_avatar)
|
|
939
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.room_topic)
|
|
940
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.space_child)
|
|
941
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.beacon)
|
|
942
|
+
_UniffiFfiConverterOptionalInt64.check_lower(value.beacon_info)
|
|
943
|
+
|
|
944
|
+
@staticmethod
|
|
945
|
+
def write(value, buf):
|
|
946
|
+
_UniffiFfiConverterOptionalInt64.write(value.ban, buf)
|
|
947
|
+
_UniffiFfiConverterOptionalInt64.write(value.invite, buf)
|
|
948
|
+
_UniffiFfiConverterOptionalInt64.write(value.kick, buf)
|
|
949
|
+
_UniffiFfiConverterOptionalInt64.write(value.redact, buf)
|
|
950
|
+
_UniffiFfiConverterOptionalInt64.write(value.events_default, buf)
|
|
951
|
+
_UniffiFfiConverterOptionalInt64.write(value.state_default, buf)
|
|
952
|
+
_UniffiFfiConverterOptionalInt64.write(value.users_default, buf)
|
|
953
|
+
_UniffiFfiConverterOptionalInt64.write(value.room_name, buf)
|
|
954
|
+
_UniffiFfiConverterOptionalInt64.write(value.room_avatar, buf)
|
|
955
|
+
_UniffiFfiConverterOptionalInt64.write(value.room_topic, buf)
|
|
956
|
+
_UniffiFfiConverterOptionalInt64.write(value.space_child, buf)
|
|
957
|
+
_UniffiFfiConverterOptionalInt64.write(value.beacon, buf)
|
|
958
|
+
_UniffiFfiConverterOptionalInt64.write(value.beacon_info, buf)
|
|
959
|
+
|
|
960
|
+
class _UniffiFfiConverterString:
|
|
961
|
+
@staticmethod
|
|
962
|
+
def check_lower(value):
|
|
963
|
+
if not isinstance(value, str):
|
|
964
|
+
raise TypeError("argument must be str, not {}".format(type(value).__name__))
|
|
965
|
+
return value
|
|
966
|
+
|
|
967
|
+
@staticmethod
|
|
968
|
+
def read(buf):
|
|
969
|
+
size = buf.read_i32()
|
|
970
|
+
if size < 0:
|
|
971
|
+
raise InternalError("Unexpected negative string length")
|
|
972
|
+
utf8_bytes = buf.read(size)
|
|
973
|
+
return utf8_bytes.decode("utf-8")
|
|
974
|
+
|
|
975
|
+
@staticmethod
|
|
976
|
+
def write(value, buf):
|
|
977
|
+
utf8_bytes = value.encode("utf-8")
|
|
978
|
+
buf.write_i32(len(utf8_bytes))
|
|
979
|
+
buf.write(utf8_bytes)
|
|
980
|
+
|
|
981
|
+
@staticmethod
|
|
982
|
+
def lift(buf):
|
|
983
|
+
with buf.consume_with_stream() as stream:
|
|
984
|
+
return stream.read(stream.remaining()).decode("utf-8")
|
|
985
|
+
|
|
986
|
+
@staticmethod
|
|
987
|
+
def lower(value):
|
|
988
|
+
with _UniffiRustBuffer.alloc_with_builder() as builder:
|
|
989
|
+
builder.write(value.encode("utf-8"))
|
|
990
|
+
return builder.finalize()
|
|
991
|
+
|
|
992
|
+
@dataclass
|
|
993
|
+
class ServerVendorInfo:
|
|
994
|
+
"""
|
|
995
|
+
Information about the server vendor obtained from the federation API.
|
|
996
|
+
"""
|
|
997
|
+
def __init__(self, *, server_name:str, version:str):
|
|
998
|
+
self.server_name = server_name
|
|
999
|
+
self.version = version
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
def __str__(self):
|
|
1005
|
+
return "ServerVendorInfo(server_name={}, version={})".format(self.server_name, self.version)
|
|
1006
|
+
def __eq__(self, other):
|
|
1007
|
+
if self.server_name != other.server_name:
|
|
1008
|
+
return False
|
|
1009
|
+
if self.version != other.version:
|
|
1010
|
+
return False
|
|
1011
|
+
return True
|
|
1012
|
+
|
|
1013
|
+
class _UniffiFfiConverterTypeServerVendorInfo(_UniffiConverterRustBuffer):
|
|
1014
|
+
@staticmethod
|
|
1015
|
+
def read(buf):
|
|
1016
|
+
return ServerVendorInfo(
|
|
1017
|
+
server_name=_UniffiFfiConverterString.read(buf),
|
|
1018
|
+
version=_UniffiFfiConverterString.read(buf),
|
|
1019
|
+
)
|
|
1020
|
+
|
|
1021
|
+
@staticmethod
|
|
1022
|
+
def check_lower(value):
|
|
1023
|
+
_UniffiFfiConverterString.check_lower(value.server_name)
|
|
1024
|
+
_UniffiFfiConverterString.check_lower(value.version)
|
|
1025
|
+
|
|
1026
|
+
@staticmethod
|
|
1027
|
+
def write(value, buf):
|
|
1028
|
+
_UniffiFfiConverterString.write(value.server_name, buf)
|
|
1029
|
+
_UniffiFfiConverterString.write(value.version, buf)
|
|
1030
|
+
|
|
1031
|
+
@dataclass
|
|
1032
|
+
class TileServerInfo:
|
|
1033
|
+
"""
|
|
1034
|
+
Information about a map tile server advertised by the homeserver through the
|
|
1035
|
+
`tile_server` field of the matrix client well-known (MSC3488).
|
|
1036
|
+
"""
|
|
1037
|
+
def __init__(self, *, map_style_url:str):
|
|
1038
|
+
self.map_style_url = map_style_url
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
def __str__(self):
|
|
1044
|
+
return "TileServerInfo(map_style_url={})".format(self.map_style_url)
|
|
1045
|
+
def __eq__(self, other):
|
|
1046
|
+
if self.map_style_url != other.map_style_url:
|
|
1047
|
+
return False
|
|
1048
|
+
return True
|
|
1049
|
+
|
|
1050
|
+
class _UniffiFfiConverterTypeTileServerInfo(_UniffiConverterRustBuffer):
|
|
1051
|
+
@staticmethod
|
|
1052
|
+
def read(buf):
|
|
1053
|
+
return TileServerInfo(
|
|
1054
|
+
map_style_url=_UniffiFfiConverterString.read(buf),
|
|
1055
|
+
)
|
|
1056
|
+
|
|
1057
|
+
@staticmethod
|
|
1058
|
+
def check_lower(value):
|
|
1059
|
+
_UniffiFfiConverterString.check_lower(value.map_style_url)
|
|
1060
|
+
|
|
1061
|
+
@staticmethod
|
|
1062
|
+
def write(value, buf):
|
|
1063
|
+
_UniffiFfiConverterString.write(value.map_style_url, buf)
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
class Intent(enum.Enum):
|
|
1071
|
+
"""
|
|
1072
|
+
Defines the intent of showing the call.
|
|
1073
|
+
|
|
1074
|
+
This controls whether to show or skip the lobby.
|
|
1075
|
+
"""
|
|
1076
|
+
|
|
1077
|
+
START_CALL = 0
|
|
1078
|
+
"""
|
|
1079
|
+
The user wants to start a call.
|
|
1080
|
+
"""
|
|
1081
|
+
|
|
1082
|
+
JOIN_EXISTING = 1
|
|
1083
|
+
"""
|
|
1084
|
+
The user wants to join an existing call.
|
|
1085
|
+
"""
|
|
1086
|
+
|
|
1087
|
+
JOIN_EXISTING_DM = 2
|
|
1088
|
+
"""
|
|
1089
|
+
The user wants to join an existing call that is a "Direct Message" (DM)
|
|
1090
|
+
room.
|
|
1091
|
+
"""
|
|
1092
|
+
|
|
1093
|
+
START_CALL_DM = 3
|
|
1094
|
+
"""
|
|
1095
|
+
The user wants to start a call in a "Direct Message" (DM) room.
|
|
1096
|
+
"""
|
|
1097
|
+
|
|
1098
|
+
START_CALL_DM_VOICE = 4
|
|
1099
|
+
"""
|
|
1100
|
+
The user wants to start a voice call in a "Direct Message" (DM) room.
|
|
1101
|
+
"""
|
|
1102
|
+
|
|
1103
|
+
JOIN_EXISTING_DM_VOICE = 5
|
|
1104
|
+
"""
|
|
1105
|
+
The user wants to join an existing voice call that is a "Direct
|
|
1106
|
+
Message" (DM) room.
|
|
1107
|
+
"""
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
class _UniffiFfiConverterTypeIntent(_UniffiConverterRustBuffer):
|
|
1112
|
+
@staticmethod
|
|
1113
|
+
def read(buf):
|
|
1114
|
+
variant = buf.read_i32()
|
|
1115
|
+
if variant == 1:
|
|
1116
|
+
return Intent.START_CALL
|
|
1117
|
+
if variant == 2:
|
|
1118
|
+
return Intent.JOIN_EXISTING
|
|
1119
|
+
if variant == 3:
|
|
1120
|
+
return Intent.JOIN_EXISTING_DM
|
|
1121
|
+
if variant == 4:
|
|
1122
|
+
return Intent.START_CALL_DM
|
|
1123
|
+
if variant == 5:
|
|
1124
|
+
return Intent.START_CALL_DM_VOICE
|
|
1125
|
+
if variant == 6:
|
|
1126
|
+
return Intent.JOIN_EXISTING_DM_VOICE
|
|
1127
|
+
raise InternalError("Raw enum value doesn't match any cases")
|
|
1128
|
+
|
|
1129
|
+
@staticmethod
|
|
1130
|
+
def check_lower(value):
|
|
1131
|
+
if value == Intent.START_CALL:
|
|
1132
|
+
return
|
|
1133
|
+
if value == Intent.JOIN_EXISTING:
|
|
1134
|
+
return
|
|
1135
|
+
if value == Intent.JOIN_EXISTING_DM:
|
|
1136
|
+
return
|
|
1137
|
+
if value == Intent.START_CALL_DM:
|
|
1138
|
+
return
|
|
1139
|
+
if value == Intent.START_CALL_DM_VOICE:
|
|
1140
|
+
return
|
|
1141
|
+
if value == Intent.JOIN_EXISTING_DM_VOICE:
|
|
1142
|
+
return
|
|
1143
|
+
raise ValueError(value)
|
|
1144
|
+
|
|
1145
|
+
@staticmethod
|
|
1146
|
+
def write(value, buf):
|
|
1147
|
+
if value == Intent.START_CALL:
|
|
1148
|
+
buf.write_i32(1)
|
|
1149
|
+
if value == Intent.JOIN_EXISTING:
|
|
1150
|
+
buf.write_i32(2)
|
|
1151
|
+
if value == Intent.JOIN_EXISTING_DM:
|
|
1152
|
+
buf.write_i32(3)
|
|
1153
|
+
if value == Intent.START_CALL_DM:
|
|
1154
|
+
buf.write_i32(4)
|
|
1155
|
+
if value == Intent.START_CALL_DM_VOICE:
|
|
1156
|
+
buf.write_i32(5)
|
|
1157
|
+
if value == Intent.JOIN_EXISTING_DM_VOICE:
|
|
1158
|
+
buf.write_i32(6)
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
class _UniffiFfiConverterOptionalTypeIntent(_UniffiConverterRustBuffer):
|
|
1163
|
+
@classmethod
|
|
1164
|
+
def check_lower(cls, value):
|
|
1165
|
+
if value is not None:
|
|
1166
|
+
_UniffiFfiConverterTypeIntent.check_lower(value)
|
|
1167
|
+
|
|
1168
|
+
@classmethod
|
|
1169
|
+
def write(cls, value, buf):
|
|
1170
|
+
if value is None:
|
|
1171
|
+
buf.write_u8(0)
|
|
1172
|
+
return
|
|
1173
|
+
|
|
1174
|
+
buf.write_u8(1)
|
|
1175
|
+
_UniffiFfiConverterTypeIntent.write(value, buf)
|
|
1176
|
+
|
|
1177
|
+
@classmethod
|
|
1178
|
+
def read(cls, buf):
|
|
1179
|
+
flag = buf.read_u8()
|
|
1180
|
+
if flag == 0:
|
|
1181
|
+
return None
|
|
1182
|
+
elif flag == 1:
|
|
1183
|
+
return _UniffiFfiConverterTypeIntent.read(buf)
|
|
1184
|
+
else:
|
|
1185
|
+
raise InternalError("Unexpected flag byte for optional type")
|
|
1186
|
+
|
|
1187
|
+
class _UniffiFfiConverterBoolean:
|
|
1188
|
+
@classmethod
|
|
1189
|
+
def check_lower(cls, value):
|
|
1190
|
+
return not not value
|
|
1191
|
+
|
|
1192
|
+
@classmethod
|
|
1193
|
+
def lower(cls, value):
|
|
1194
|
+
return 1 if value else 0
|
|
1195
|
+
|
|
1196
|
+
@staticmethod
|
|
1197
|
+
def lift(value):
|
|
1198
|
+
return value != 0
|
|
1199
|
+
|
|
1200
|
+
@classmethod
|
|
1201
|
+
def read(cls, buf):
|
|
1202
|
+
return cls.lift(buf.read_u8())
|
|
1203
|
+
|
|
1204
|
+
@classmethod
|
|
1205
|
+
def write(cls, value, buf):
|
|
1206
|
+
buf.write_u8(value)
|
|
1207
|
+
|
|
1208
|
+
class _UniffiFfiConverterOptionalBoolean(_UniffiConverterRustBuffer):
|
|
1209
|
+
@classmethod
|
|
1210
|
+
def check_lower(cls, value):
|
|
1211
|
+
if value is not None:
|
|
1212
|
+
_UniffiFfiConverterBoolean.check_lower(value)
|
|
1213
|
+
|
|
1214
|
+
@classmethod
|
|
1215
|
+
def write(cls, value, buf):
|
|
1216
|
+
if value is None:
|
|
1217
|
+
buf.write_u8(0)
|
|
1218
|
+
return
|
|
1219
|
+
|
|
1220
|
+
buf.write_u8(1)
|
|
1221
|
+
_UniffiFfiConverterBoolean.write(value, buf)
|
|
1222
|
+
|
|
1223
|
+
@classmethod
|
|
1224
|
+
def read(cls, buf):
|
|
1225
|
+
flag = buf.read_u8()
|
|
1226
|
+
if flag == 0:
|
|
1227
|
+
return None
|
|
1228
|
+
elif flag == 1:
|
|
1229
|
+
return _UniffiFfiConverterBoolean.read(buf)
|
|
1230
|
+
else:
|
|
1231
|
+
raise InternalError("Unexpected flag byte for optional type")
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
class HeaderStyle(enum.Enum):
|
|
1239
|
+
"""
|
|
1240
|
+
Defines how (if) element-call renders a header.
|
|
1241
|
+
"""
|
|
1242
|
+
|
|
1243
|
+
STANDARD = 0
|
|
1244
|
+
"""
|
|
1245
|
+
The normal header with branding.
|
|
1246
|
+
"""
|
|
1247
|
+
|
|
1248
|
+
APP_BAR = 1
|
|
1249
|
+
"""
|
|
1250
|
+
Render a header with a back button (useful on mobile platforms).
|
|
1251
|
+
"""
|
|
1252
|
+
|
|
1253
|
+
NONE = 2
|
|
1254
|
+
"""
|
|
1255
|
+
No Header (useful for webapps).
|
|
1256
|
+
"""
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
class _UniffiFfiConverterTypeHeaderStyle(_UniffiConverterRustBuffer):
|
|
1261
|
+
@staticmethod
|
|
1262
|
+
def read(buf):
|
|
1263
|
+
variant = buf.read_i32()
|
|
1264
|
+
if variant == 1:
|
|
1265
|
+
return HeaderStyle.STANDARD
|
|
1266
|
+
if variant == 2:
|
|
1267
|
+
return HeaderStyle.APP_BAR
|
|
1268
|
+
if variant == 3:
|
|
1269
|
+
return HeaderStyle.NONE
|
|
1270
|
+
raise InternalError("Raw enum value doesn't match any cases")
|
|
1271
|
+
|
|
1272
|
+
@staticmethod
|
|
1273
|
+
def check_lower(value):
|
|
1274
|
+
if value == HeaderStyle.STANDARD:
|
|
1275
|
+
return
|
|
1276
|
+
if value == HeaderStyle.APP_BAR:
|
|
1277
|
+
return
|
|
1278
|
+
if value == HeaderStyle.NONE:
|
|
1279
|
+
return
|
|
1280
|
+
raise ValueError(value)
|
|
1281
|
+
|
|
1282
|
+
@staticmethod
|
|
1283
|
+
def write(value, buf):
|
|
1284
|
+
if value == HeaderStyle.STANDARD:
|
|
1285
|
+
buf.write_i32(1)
|
|
1286
|
+
if value == HeaderStyle.APP_BAR:
|
|
1287
|
+
buf.write_i32(2)
|
|
1288
|
+
if value == HeaderStyle.NONE:
|
|
1289
|
+
buf.write_i32(3)
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
class _UniffiFfiConverterOptionalTypeHeaderStyle(_UniffiConverterRustBuffer):
|
|
1294
|
+
@classmethod
|
|
1295
|
+
def check_lower(cls, value):
|
|
1296
|
+
if value is not None:
|
|
1297
|
+
_UniffiFfiConverterTypeHeaderStyle.check_lower(value)
|
|
1298
|
+
|
|
1299
|
+
@classmethod
|
|
1300
|
+
def write(cls, value, buf):
|
|
1301
|
+
if value is None:
|
|
1302
|
+
buf.write_u8(0)
|
|
1303
|
+
return
|
|
1304
|
+
|
|
1305
|
+
buf.write_u8(1)
|
|
1306
|
+
_UniffiFfiConverterTypeHeaderStyle.write(value, buf)
|
|
1307
|
+
|
|
1308
|
+
@classmethod
|
|
1309
|
+
def read(cls, buf):
|
|
1310
|
+
flag = buf.read_u8()
|
|
1311
|
+
if flag == 0:
|
|
1312
|
+
return None
|
|
1313
|
+
elif flag == 1:
|
|
1314
|
+
return _UniffiFfiConverterTypeHeaderStyle.read(buf)
|
|
1315
|
+
else:
|
|
1316
|
+
raise InternalError("Unexpected flag byte for optional type")
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
class NotificationType(enum.Enum):
|
|
1324
|
+
"""
|
|
1325
|
+
Types of call notifications.
|
|
1326
|
+
"""
|
|
1327
|
+
|
|
1328
|
+
NOTIFICATION = 0
|
|
1329
|
+
"""
|
|
1330
|
+
The receiving client should display a visual notification.
|
|
1331
|
+
"""
|
|
1332
|
+
|
|
1333
|
+
RING = 1
|
|
1334
|
+
"""
|
|
1335
|
+
The receiving client should ring with an audible sound.
|
|
1336
|
+
"""
|
|
1337
|
+
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
class _UniffiFfiConverterTypeNotificationType(_UniffiConverterRustBuffer):
|
|
1341
|
+
@staticmethod
|
|
1342
|
+
def read(buf):
|
|
1343
|
+
variant = buf.read_i32()
|
|
1344
|
+
if variant == 1:
|
|
1345
|
+
return NotificationType.NOTIFICATION
|
|
1346
|
+
if variant == 2:
|
|
1347
|
+
return NotificationType.RING
|
|
1348
|
+
raise InternalError("Raw enum value doesn't match any cases")
|
|
1349
|
+
|
|
1350
|
+
@staticmethod
|
|
1351
|
+
def check_lower(value):
|
|
1352
|
+
if value == NotificationType.NOTIFICATION:
|
|
1353
|
+
return
|
|
1354
|
+
if value == NotificationType.RING:
|
|
1355
|
+
return
|
|
1356
|
+
raise ValueError(value)
|
|
1357
|
+
|
|
1358
|
+
@staticmethod
|
|
1359
|
+
def write(value, buf):
|
|
1360
|
+
if value == NotificationType.NOTIFICATION:
|
|
1361
|
+
buf.write_i32(1)
|
|
1362
|
+
if value == NotificationType.RING:
|
|
1363
|
+
buf.write_i32(2)
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
class _UniffiFfiConverterOptionalTypeNotificationType(_UniffiConverterRustBuffer):
|
|
1368
|
+
@classmethod
|
|
1369
|
+
def check_lower(cls, value):
|
|
1370
|
+
if value is not None:
|
|
1371
|
+
_UniffiFfiConverterTypeNotificationType.check_lower(value)
|
|
1372
|
+
|
|
1373
|
+
@classmethod
|
|
1374
|
+
def write(cls, value, buf):
|
|
1375
|
+
if value is None:
|
|
1376
|
+
buf.write_u8(0)
|
|
1377
|
+
return
|
|
1378
|
+
|
|
1379
|
+
buf.write_u8(1)
|
|
1380
|
+
_UniffiFfiConverterTypeNotificationType.write(value, buf)
|
|
1381
|
+
|
|
1382
|
+
@classmethod
|
|
1383
|
+
def read(cls, buf):
|
|
1384
|
+
flag = buf.read_u8()
|
|
1385
|
+
if flag == 0:
|
|
1386
|
+
return None
|
|
1387
|
+
elif flag == 1:
|
|
1388
|
+
return _UniffiFfiConverterTypeNotificationType.read(buf)
|
|
1389
|
+
else:
|
|
1390
|
+
raise InternalError("Unexpected flag byte for optional type")
|
|
1391
|
+
|
|
1392
|
+
@dataclass
|
|
1393
|
+
class VirtualElementCallWidgetConfig:
|
|
1394
|
+
"""
|
|
1395
|
+
Configuration parameters, to create a new virtual Element Call widget.
|
|
1396
|
+
|
|
1397
|
+
If `intent` is provided the appropriate default values for all other
|
|
1398
|
+
parameters will be used by element call.
|
|
1399
|
+
In most cases its enough to only set the intent. Use the other properties
|
|
1400
|
+
only if you want to deviate from the `intent` defaults.
|
|
1401
|
+
|
|
1402
|
+
Set [`docs/url-params.md`](https://github.com/element-hq/element-call/blob/livekit/docs/url-params.md)
|
|
1403
|
+
to find out more about the parameters and their defaults.
|
|
1404
|
+
"""
|
|
1405
|
+
def __init__(self, *, intent:typing.Optional[Intent], skip_lobby:typing.Optional[bool] = _DEFAULT, header:typing.Optional[HeaderStyle] = _DEFAULT, hide_header:typing.Optional[bool] = _DEFAULT, preload:typing.Optional[bool] = _DEFAULT, app_prompt:typing.Optional[bool] = _DEFAULT, confine_to_room:typing.Optional[bool] = _DEFAULT, hide_screensharing:typing.Optional[bool] = _DEFAULT, controlled_audio_devices:typing.Optional[bool] = _DEFAULT, send_notification_type:typing.Optional[NotificationType] = _DEFAULT):
|
|
1406
|
+
self.intent = intent
|
|
1407
|
+
if skip_lobby is _DEFAULT:
|
|
1408
|
+
self.skip_lobby = None
|
|
1409
|
+
else:
|
|
1410
|
+
self.skip_lobby = skip_lobby
|
|
1411
|
+
if header is _DEFAULT:
|
|
1412
|
+
self.header = None
|
|
1413
|
+
else:
|
|
1414
|
+
self.header = header
|
|
1415
|
+
if hide_header is _DEFAULT:
|
|
1416
|
+
self.hide_header = None
|
|
1417
|
+
else:
|
|
1418
|
+
self.hide_header = hide_header
|
|
1419
|
+
if preload is _DEFAULT:
|
|
1420
|
+
self.preload = None
|
|
1421
|
+
else:
|
|
1422
|
+
self.preload = preload
|
|
1423
|
+
if app_prompt is _DEFAULT:
|
|
1424
|
+
self.app_prompt = None
|
|
1425
|
+
else:
|
|
1426
|
+
self.app_prompt = app_prompt
|
|
1427
|
+
if confine_to_room is _DEFAULT:
|
|
1428
|
+
self.confine_to_room = None
|
|
1429
|
+
else:
|
|
1430
|
+
self.confine_to_room = confine_to_room
|
|
1431
|
+
if hide_screensharing is _DEFAULT:
|
|
1432
|
+
self.hide_screensharing = None
|
|
1433
|
+
else:
|
|
1434
|
+
self.hide_screensharing = hide_screensharing
|
|
1435
|
+
if controlled_audio_devices is _DEFAULT:
|
|
1436
|
+
self.controlled_audio_devices = None
|
|
1437
|
+
else:
|
|
1438
|
+
self.controlled_audio_devices = controlled_audio_devices
|
|
1439
|
+
if send_notification_type is _DEFAULT:
|
|
1440
|
+
self.send_notification_type = None
|
|
1441
|
+
else:
|
|
1442
|
+
self.send_notification_type = send_notification_type
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
def __str__(self):
|
|
1448
|
+
return "VirtualElementCallWidgetConfig(intent={}, skip_lobby={}, header={}, hide_header={}, preload={}, app_prompt={}, confine_to_room={}, hide_screensharing={}, controlled_audio_devices={}, send_notification_type={})".format(self.intent, self.skip_lobby, self.header, self.hide_header, self.preload, self.app_prompt, self.confine_to_room, self.hide_screensharing, self.controlled_audio_devices, self.send_notification_type)
|
|
1449
|
+
def __eq__(self, other):
|
|
1450
|
+
if self.intent != other.intent:
|
|
1451
|
+
return False
|
|
1452
|
+
if self.skip_lobby != other.skip_lobby:
|
|
1453
|
+
return False
|
|
1454
|
+
if self.header != other.header:
|
|
1455
|
+
return False
|
|
1456
|
+
if self.hide_header != other.hide_header:
|
|
1457
|
+
return False
|
|
1458
|
+
if self.preload != other.preload:
|
|
1459
|
+
return False
|
|
1460
|
+
if self.app_prompt != other.app_prompt:
|
|
1461
|
+
return False
|
|
1462
|
+
if self.confine_to_room != other.confine_to_room:
|
|
1463
|
+
return False
|
|
1464
|
+
if self.hide_screensharing != other.hide_screensharing:
|
|
1465
|
+
return False
|
|
1466
|
+
if self.controlled_audio_devices != other.controlled_audio_devices:
|
|
1467
|
+
return False
|
|
1468
|
+
if self.send_notification_type != other.send_notification_type:
|
|
1469
|
+
return False
|
|
1470
|
+
return True
|
|
1471
|
+
|
|
1472
|
+
class _UniffiFfiConverterTypeVirtualElementCallWidgetConfig(_UniffiConverterRustBuffer):
|
|
1473
|
+
@staticmethod
|
|
1474
|
+
def read(buf):
|
|
1475
|
+
return VirtualElementCallWidgetConfig(
|
|
1476
|
+
intent=_UniffiFfiConverterOptionalTypeIntent.read(buf),
|
|
1477
|
+
skip_lobby=_UniffiFfiConverterOptionalBoolean.read(buf),
|
|
1478
|
+
header=_UniffiFfiConverterOptionalTypeHeaderStyle.read(buf),
|
|
1479
|
+
hide_header=_UniffiFfiConverterOptionalBoolean.read(buf),
|
|
1480
|
+
preload=_UniffiFfiConverterOptionalBoolean.read(buf),
|
|
1481
|
+
app_prompt=_UniffiFfiConverterOptionalBoolean.read(buf),
|
|
1482
|
+
confine_to_room=_UniffiFfiConverterOptionalBoolean.read(buf),
|
|
1483
|
+
hide_screensharing=_UniffiFfiConverterOptionalBoolean.read(buf),
|
|
1484
|
+
controlled_audio_devices=_UniffiFfiConverterOptionalBoolean.read(buf),
|
|
1485
|
+
send_notification_type=_UniffiFfiConverterOptionalTypeNotificationType.read(buf),
|
|
1486
|
+
)
|
|
1487
|
+
|
|
1488
|
+
@staticmethod
|
|
1489
|
+
def check_lower(value):
|
|
1490
|
+
_UniffiFfiConverterOptionalTypeIntent.check_lower(value.intent)
|
|
1491
|
+
_UniffiFfiConverterOptionalBoolean.check_lower(value.skip_lobby)
|
|
1492
|
+
_UniffiFfiConverterOptionalTypeHeaderStyle.check_lower(value.header)
|
|
1493
|
+
_UniffiFfiConverterOptionalBoolean.check_lower(value.hide_header)
|
|
1494
|
+
_UniffiFfiConverterOptionalBoolean.check_lower(value.preload)
|
|
1495
|
+
_UniffiFfiConverterOptionalBoolean.check_lower(value.app_prompt)
|
|
1496
|
+
_UniffiFfiConverterOptionalBoolean.check_lower(value.confine_to_room)
|
|
1497
|
+
_UniffiFfiConverterOptionalBoolean.check_lower(value.hide_screensharing)
|
|
1498
|
+
_UniffiFfiConverterOptionalBoolean.check_lower(value.controlled_audio_devices)
|
|
1499
|
+
_UniffiFfiConverterOptionalTypeNotificationType.check_lower(value.send_notification_type)
|
|
1500
|
+
|
|
1501
|
+
@staticmethod
|
|
1502
|
+
def write(value, buf):
|
|
1503
|
+
_UniffiFfiConverterOptionalTypeIntent.write(value.intent, buf)
|
|
1504
|
+
_UniffiFfiConverterOptionalBoolean.write(value.skip_lobby, buf)
|
|
1505
|
+
_UniffiFfiConverterOptionalTypeHeaderStyle.write(value.header, buf)
|
|
1506
|
+
_UniffiFfiConverterOptionalBoolean.write(value.hide_header, buf)
|
|
1507
|
+
_UniffiFfiConverterOptionalBoolean.write(value.preload, buf)
|
|
1508
|
+
_UniffiFfiConverterOptionalBoolean.write(value.app_prompt, buf)
|
|
1509
|
+
_UniffiFfiConverterOptionalBoolean.write(value.confine_to_room, buf)
|
|
1510
|
+
_UniffiFfiConverterOptionalBoolean.write(value.hide_screensharing, buf)
|
|
1511
|
+
_UniffiFfiConverterOptionalBoolean.write(value.controlled_audio_devices, buf)
|
|
1512
|
+
_UniffiFfiConverterOptionalTypeNotificationType.write(value.send_notification_type, buf)
|
|
1513
|
+
|
|
1514
|
+
class _UniffiFfiConverterOptionalString(_UniffiConverterRustBuffer):
|
|
1515
|
+
@classmethod
|
|
1516
|
+
def check_lower(cls, value):
|
|
1517
|
+
if value is not None:
|
|
1518
|
+
_UniffiFfiConverterString.check_lower(value)
|
|
1519
|
+
|
|
1520
|
+
@classmethod
|
|
1521
|
+
def write(cls, value, buf):
|
|
1522
|
+
if value is None:
|
|
1523
|
+
buf.write_u8(0)
|
|
1524
|
+
return
|
|
1525
|
+
|
|
1526
|
+
buf.write_u8(1)
|
|
1527
|
+
_UniffiFfiConverterString.write(value, buf)
|
|
1528
|
+
|
|
1529
|
+
@classmethod
|
|
1530
|
+
def read(cls, buf):
|
|
1531
|
+
flag = buf.read_u8()
|
|
1532
|
+
if flag == 0:
|
|
1533
|
+
return None
|
|
1534
|
+
elif flag == 1:
|
|
1535
|
+
return _UniffiFfiConverterString.read(buf)
|
|
1536
|
+
else:
|
|
1537
|
+
raise InternalError("Unexpected flag byte for optional type")
|
|
1538
|
+
|
|
1539
|
+
class _UniffiFfiConverterFloat64(_UniffiConverterPrimitiveFloat):
|
|
1540
|
+
@staticmethod
|
|
1541
|
+
def read(buf):
|
|
1542
|
+
return buf.read_double()
|
|
1543
|
+
|
|
1544
|
+
@staticmethod
|
|
1545
|
+
def write(value, buf):
|
|
1546
|
+
buf.write_double(value)
|
|
1547
|
+
|
|
1548
|
+
class _UniffiFfiConverterOptionalFloat64(_UniffiConverterRustBuffer):
|
|
1549
|
+
@classmethod
|
|
1550
|
+
def check_lower(cls, value):
|
|
1551
|
+
if value is not None:
|
|
1552
|
+
_UniffiFfiConverterFloat64.check_lower(value)
|
|
1553
|
+
|
|
1554
|
+
@classmethod
|
|
1555
|
+
def write(cls, value, buf):
|
|
1556
|
+
if value is None:
|
|
1557
|
+
buf.write_u8(0)
|
|
1558
|
+
return
|
|
1559
|
+
|
|
1560
|
+
buf.write_u8(1)
|
|
1561
|
+
_UniffiFfiConverterFloat64.write(value, buf)
|
|
1562
|
+
|
|
1563
|
+
@classmethod
|
|
1564
|
+
def read(cls, buf):
|
|
1565
|
+
flag = buf.read_u8()
|
|
1566
|
+
if flag == 0:
|
|
1567
|
+
return None
|
|
1568
|
+
elif flag == 1:
|
|
1569
|
+
return _UniffiFfiConverterFloat64.read(buf)
|
|
1570
|
+
else:
|
|
1571
|
+
raise InternalError("Unexpected flag byte for optional type")
|
|
1572
|
+
|
|
1573
|
+
|
|
1574
|
+
|
|
1575
|
+
|
|
1576
|
+
|
|
1577
|
+
|
|
1578
|
+
class EncryptionSystem:
|
|
1579
|
+
"""
|
|
1580
|
+
Defines if a call is encrypted and which encryption system should be used.
|
|
1581
|
+
|
|
1582
|
+
This controls the url parameters: `perParticipantE2EE`, `password`.
|
|
1583
|
+
"""
|
|
1584
|
+
def __init__(self):
|
|
1585
|
+
raise RuntimeError("EncryptionSystem cannot be instantiated directly")
|
|
1586
|
+
|
|
1587
|
+
# Each enum variant is a nested class of the enum itself.
|
|
1588
|
+
@dataclass
|
|
1589
|
+
class UNENCRYPTED:
|
|
1590
|
+
"""
|
|
1591
|
+
Equivalent to the element call url parameter: `perParticipantE2EE=false`
|
|
1592
|
+
and no password.
|
|
1593
|
+
"""
|
|
1594
|
+
|
|
1595
|
+
def __init__(self, ):
|
|
1596
|
+
pass
|
|
1597
|
+
|
|
1598
|
+
|
|
1599
|
+
|
|
1600
|
+
|
|
1601
|
+
|
|
1602
|
+
def __str__(self):
|
|
1603
|
+
return "EncryptionSystem.UNENCRYPTED()".format()
|
|
1604
|
+
def __eq__(self, other):
|
|
1605
|
+
if not isinstance(other, EncryptionSystem):
|
|
1606
|
+
return NotImplemented
|
|
1607
|
+
if not other.is_UNENCRYPTED():
|
|
1608
|
+
return False
|
|
1609
|
+
return True
|
|
1610
|
+
|
|
1611
|
+
@dataclass
|
|
1612
|
+
class PER_PARTICIPANT_KEYS:
|
|
1613
|
+
"""
|
|
1614
|
+
Equivalent to the element call url parameters:
|
|
1615
|
+
`perParticipantE2EE=true`
|
|
1616
|
+
"""
|
|
1617
|
+
|
|
1618
|
+
def __init__(self, ):
|
|
1619
|
+
pass
|
|
1620
|
+
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
def __str__(self):
|
|
1626
|
+
return "EncryptionSystem.PER_PARTICIPANT_KEYS()".format()
|
|
1627
|
+
def __eq__(self, other):
|
|
1628
|
+
if not isinstance(other, EncryptionSystem):
|
|
1629
|
+
return NotImplemented
|
|
1630
|
+
if not other.is_PER_PARTICIPANT_KEYS():
|
|
1631
|
+
return False
|
|
1632
|
+
return True
|
|
1633
|
+
|
|
1634
|
+
@dataclass
|
|
1635
|
+
class SHARED_SECRET:
|
|
1636
|
+
"""
|
|
1637
|
+
Equivalent to the element call url parameters:
|
|
1638
|
+
`password={secret}`
|
|
1639
|
+
"""
|
|
1640
|
+
|
|
1641
|
+
def __init__(self, secret:str):
|
|
1642
|
+
self.secret = secret
|
|
1643
|
+
|
|
1644
|
+
"""
|
|
1645
|
+
The secret/password which is used in the url.
|
|
1646
|
+
"""
|
|
1647
|
+
|
|
1648
|
+
pass
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
|
|
1652
|
+
|
|
1653
|
+
|
|
1654
|
+
def __str__(self):
|
|
1655
|
+
return "EncryptionSystem.SHARED_SECRET(secret={})".format(self.secret)
|
|
1656
|
+
def __eq__(self, other):
|
|
1657
|
+
if not isinstance(other, EncryptionSystem):
|
|
1658
|
+
return NotImplemented
|
|
1659
|
+
if not other.is_SHARED_SECRET():
|
|
1660
|
+
return False
|
|
1661
|
+
if self.secret != other.secret:
|
|
1662
|
+
return False
|
|
1663
|
+
return True
|
|
1664
|
+
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
# For each variant, we have `is_NAME` and `is_name` methods for easily checking
|
|
1668
|
+
# whether an instance is that variant.
|
|
1669
|
+
def is_UNENCRYPTED(self) -> bool:
|
|
1670
|
+
return isinstance(self, EncryptionSystem.UNENCRYPTED)
|
|
1671
|
+
def is_unencrypted(self) -> bool:
|
|
1672
|
+
return isinstance(self, EncryptionSystem.UNENCRYPTED)
|
|
1673
|
+
def is_PER_PARTICIPANT_KEYS(self) -> bool:
|
|
1674
|
+
return isinstance(self, EncryptionSystem.PER_PARTICIPANT_KEYS)
|
|
1675
|
+
def is_per_participant_keys(self) -> bool:
|
|
1676
|
+
return isinstance(self, EncryptionSystem.PER_PARTICIPANT_KEYS)
|
|
1677
|
+
def is_SHARED_SECRET(self) -> bool:
|
|
1678
|
+
return isinstance(self, EncryptionSystem.SHARED_SECRET)
|
|
1679
|
+
def is_shared_secret(self) -> bool:
|
|
1680
|
+
return isinstance(self, EncryptionSystem.SHARED_SECRET)
|
|
1681
|
+
|
|
1682
|
+
|
|
1683
|
+
# Now, a little trick - we make each nested variant class be a subclass of the main
|
|
1684
|
+
# enum class, so that method calls and instance checks etc will work intuitively.
|
|
1685
|
+
# We might be able to do this a little more neatly with a metaclass, but this'll do.
|
|
1686
|
+
EncryptionSystem.UNENCRYPTED = type("EncryptionSystem.UNENCRYPTED", (EncryptionSystem.UNENCRYPTED, EncryptionSystem,), {}) # type: ignore
|
|
1687
|
+
EncryptionSystem.PER_PARTICIPANT_KEYS = type("EncryptionSystem.PER_PARTICIPANT_KEYS", (EncryptionSystem.PER_PARTICIPANT_KEYS, EncryptionSystem,), {}) # type: ignore
|
|
1688
|
+
EncryptionSystem.SHARED_SECRET = type("EncryptionSystem.SHARED_SECRET", (EncryptionSystem.SHARED_SECRET, EncryptionSystem,), {}) # type: ignore
|
|
1689
|
+
|
|
1690
|
+
|
|
1691
|
+
|
|
1692
|
+
|
|
1693
|
+
class _UniffiFfiConverterTypeEncryptionSystem(_UniffiConverterRustBuffer):
|
|
1694
|
+
@staticmethod
|
|
1695
|
+
def read(buf):
|
|
1696
|
+
variant = buf.read_i32()
|
|
1697
|
+
if variant == 1:
|
|
1698
|
+
return EncryptionSystem.UNENCRYPTED(
|
|
1699
|
+
)
|
|
1700
|
+
if variant == 2:
|
|
1701
|
+
return EncryptionSystem.PER_PARTICIPANT_KEYS(
|
|
1702
|
+
)
|
|
1703
|
+
if variant == 3:
|
|
1704
|
+
return EncryptionSystem.SHARED_SECRET(
|
|
1705
|
+
_UniffiFfiConverterString.read(buf),
|
|
1706
|
+
)
|
|
1707
|
+
raise InternalError("Raw enum value doesn't match any cases")
|
|
1708
|
+
|
|
1709
|
+
@staticmethod
|
|
1710
|
+
def check_lower(value):
|
|
1711
|
+
if value.is_UNENCRYPTED():
|
|
1712
|
+
return
|
|
1713
|
+
if value.is_PER_PARTICIPANT_KEYS():
|
|
1714
|
+
return
|
|
1715
|
+
if value.is_SHARED_SECRET():
|
|
1716
|
+
_UniffiFfiConverterString.check_lower(value.secret)
|
|
1717
|
+
return
|
|
1718
|
+
raise ValueError(value)
|
|
1719
|
+
|
|
1720
|
+
@staticmethod
|
|
1721
|
+
def write(value, buf):
|
|
1722
|
+
if value.is_UNENCRYPTED():
|
|
1723
|
+
buf.write_i32(1)
|
|
1724
|
+
if value.is_PER_PARTICIPANT_KEYS():
|
|
1725
|
+
buf.write_i32(2)
|
|
1726
|
+
if value.is_SHARED_SECRET():
|
|
1727
|
+
buf.write_i32(3)
|
|
1728
|
+
_UniffiFfiConverterString.write(value.secret, buf)
|
|
1729
|
+
|
|
1730
|
+
|
|
1731
|
+
|
|
1732
|
+
@dataclass
|
|
1733
|
+
class VirtualElementCallWidgetProperties:
|
|
1734
|
+
"""
|
|
1735
|
+
Properties to create a new virtual Element Call widget.
|
|
1736
|
+
|
|
1737
|
+
All these are required to start the widget in the first place.
|
|
1738
|
+
This is different from the `VirtualElementCallWidgetConfiguration` which
|
|
1739
|
+
configures the widgets behavior.
|
|
1740
|
+
"""
|
|
1741
|
+
def __init__(self, *, element_call_url:str, widget_id:str, parent_url:typing.Optional[str] = _DEFAULT, font_scale:typing.Optional[float] = _DEFAULT, font:typing.Optional[str] = _DEFAULT, encryption:EncryptionSystem, posthog_user_id:typing.Optional[str] = _DEFAULT, posthog_api_host:typing.Optional[str] = _DEFAULT, posthog_api_key:typing.Optional[str] = _DEFAULT, rageshake_submit_url:typing.Optional[str] = _DEFAULT, sentry_dsn:typing.Optional[str] = _DEFAULT, sentry_environment:typing.Optional[str] = _DEFAULT):
|
|
1742
|
+
self.element_call_url = element_call_url
|
|
1743
|
+
self.widget_id = widget_id
|
|
1744
|
+
if parent_url is _DEFAULT:
|
|
1745
|
+
self.parent_url = None
|
|
1746
|
+
else:
|
|
1747
|
+
self.parent_url = parent_url
|
|
1748
|
+
if font_scale is _DEFAULT:
|
|
1749
|
+
self.font_scale = None
|
|
1750
|
+
else:
|
|
1751
|
+
self.font_scale = font_scale
|
|
1752
|
+
if font is _DEFAULT:
|
|
1753
|
+
self.font = None
|
|
1754
|
+
else:
|
|
1755
|
+
self.font = font
|
|
1756
|
+
self.encryption = encryption
|
|
1757
|
+
if posthog_user_id is _DEFAULT:
|
|
1758
|
+
self.posthog_user_id = None
|
|
1759
|
+
else:
|
|
1760
|
+
self.posthog_user_id = posthog_user_id
|
|
1761
|
+
if posthog_api_host is _DEFAULT:
|
|
1762
|
+
self.posthog_api_host = None
|
|
1763
|
+
else:
|
|
1764
|
+
self.posthog_api_host = posthog_api_host
|
|
1765
|
+
if posthog_api_key is _DEFAULT:
|
|
1766
|
+
self.posthog_api_key = None
|
|
1767
|
+
else:
|
|
1768
|
+
self.posthog_api_key = posthog_api_key
|
|
1769
|
+
if rageshake_submit_url is _DEFAULT:
|
|
1770
|
+
self.rageshake_submit_url = None
|
|
1771
|
+
else:
|
|
1772
|
+
self.rageshake_submit_url = rageshake_submit_url
|
|
1773
|
+
if sentry_dsn is _DEFAULT:
|
|
1774
|
+
self.sentry_dsn = None
|
|
1775
|
+
else:
|
|
1776
|
+
self.sentry_dsn = sentry_dsn
|
|
1777
|
+
if sentry_environment is _DEFAULT:
|
|
1778
|
+
self.sentry_environment = None
|
|
1779
|
+
else:
|
|
1780
|
+
self.sentry_environment = sentry_environment
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
def __str__(self):
|
|
1786
|
+
return "VirtualElementCallWidgetProperties(element_call_url={}, widget_id={}, parent_url={}, font_scale={}, font={}, encryption={}, posthog_user_id={}, posthog_api_host={}, posthog_api_key={}, rageshake_submit_url={}, sentry_dsn={}, sentry_environment={})".format(self.element_call_url, self.widget_id, self.parent_url, self.font_scale, self.font, self.encryption, self.posthog_user_id, self.posthog_api_host, self.posthog_api_key, self.rageshake_submit_url, self.sentry_dsn, self.sentry_environment)
|
|
1787
|
+
def __eq__(self, other):
|
|
1788
|
+
if self.element_call_url != other.element_call_url:
|
|
1789
|
+
return False
|
|
1790
|
+
if self.widget_id != other.widget_id:
|
|
1791
|
+
return False
|
|
1792
|
+
if self.parent_url != other.parent_url:
|
|
1793
|
+
return False
|
|
1794
|
+
if self.font_scale != other.font_scale:
|
|
1795
|
+
return False
|
|
1796
|
+
if self.font != other.font:
|
|
1797
|
+
return False
|
|
1798
|
+
if self.encryption != other.encryption:
|
|
1799
|
+
return False
|
|
1800
|
+
if self.posthog_user_id != other.posthog_user_id:
|
|
1801
|
+
return False
|
|
1802
|
+
if self.posthog_api_host != other.posthog_api_host:
|
|
1803
|
+
return False
|
|
1804
|
+
if self.posthog_api_key != other.posthog_api_key:
|
|
1805
|
+
return False
|
|
1806
|
+
if self.rageshake_submit_url != other.rageshake_submit_url:
|
|
1807
|
+
return False
|
|
1808
|
+
if self.sentry_dsn != other.sentry_dsn:
|
|
1809
|
+
return False
|
|
1810
|
+
if self.sentry_environment != other.sentry_environment:
|
|
1811
|
+
return False
|
|
1812
|
+
return True
|
|
1813
|
+
|
|
1814
|
+
class _UniffiFfiConverterTypeVirtualElementCallWidgetProperties(_UniffiConverterRustBuffer):
|
|
1815
|
+
@staticmethod
|
|
1816
|
+
def read(buf):
|
|
1817
|
+
return VirtualElementCallWidgetProperties(
|
|
1818
|
+
element_call_url=_UniffiFfiConverterString.read(buf),
|
|
1819
|
+
widget_id=_UniffiFfiConverterString.read(buf),
|
|
1820
|
+
parent_url=_UniffiFfiConverterOptionalString.read(buf),
|
|
1821
|
+
font_scale=_UniffiFfiConverterOptionalFloat64.read(buf),
|
|
1822
|
+
font=_UniffiFfiConverterOptionalString.read(buf),
|
|
1823
|
+
encryption=_UniffiFfiConverterTypeEncryptionSystem.read(buf),
|
|
1824
|
+
posthog_user_id=_UniffiFfiConverterOptionalString.read(buf),
|
|
1825
|
+
posthog_api_host=_UniffiFfiConverterOptionalString.read(buf),
|
|
1826
|
+
posthog_api_key=_UniffiFfiConverterOptionalString.read(buf),
|
|
1827
|
+
rageshake_submit_url=_UniffiFfiConverterOptionalString.read(buf),
|
|
1828
|
+
sentry_dsn=_UniffiFfiConverterOptionalString.read(buf),
|
|
1829
|
+
sentry_environment=_UniffiFfiConverterOptionalString.read(buf),
|
|
1830
|
+
)
|
|
1831
|
+
|
|
1832
|
+
@staticmethod
|
|
1833
|
+
def check_lower(value):
|
|
1834
|
+
_UniffiFfiConverterString.check_lower(value.element_call_url)
|
|
1835
|
+
_UniffiFfiConverterString.check_lower(value.widget_id)
|
|
1836
|
+
_UniffiFfiConverterOptionalString.check_lower(value.parent_url)
|
|
1837
|
+
_UniffiFfiConverterOptionalFloat64.check_lower(value.font_scale)
|
|
1838
|
+
_UniffiFfiConverterOptionalString.check_lower(value.font)
|
|
1839
|
+
_UniffiFfiConverterTypeEncryptionSystem.check_lower(value.encryption)
|
|
1840
|
+
_UniffiFfiConverterOptionalString.check_lower(value.posthog_user_id)
|
|
1841
|
+
_UniffiFfiConverterOptionalString.check_lower(value.posthog_api_host)
|
|
1842
|
+
_UniffiFfiConverterOptionalString.check_lower(value.posthog_api_key)
|
|
1843
|
+
_UniffiFfiConverterOptionalString.check_lower(value.rageshake_submit_url)
|
|
1844
|
+
_UniffiFfiConverterOptionalString.check_lower(value.sentry_dsn)
|
|
1845
|
+
_UniffiFfiConverterOptionalString.check_lower(value.sentry_environment)
|
|
1846
|
+
|
|
1847
|
+
@staticmethod
|
|
1848
|
+
def write(value, buf):
|
|
1849
|
+
_UniffiFfiConverterString.write(value.element_call_url, buf)
|
|
1850
|
+
_UniffiFfiConverterString.write(value.widget_id, buf)
|
|
1851
|
+
_UniffiFfiConverterOptionalString.write(value.parent_url, buf)
|
|
1852
|
+
_UniffiFfiConverterOptionalFloat64.write(value.font_scale, buf)
|
|
1853
|
+
_UniffiFfiConverterOptionalString.write(value.font, buf)
|
|
1854
|
+
_UniffiFfiConverterTypeEncryptionSystem.write(value.encryption, buf)
|
|
1855
|
+
_UniffiFfiConverterOptionalString.write(value.posthog_user_id, buf)
|
|
1856
|
+
_UniffiFfiConverterOptionalString.write(value.posthog_api_host, buf)
|
|
1857
|
+
_UniffiFfiConverterOptionalString.write(value.posthog_api_key, buf)
|
|
1858
|
+
_UniffiFfiConverterOptionalString.write(value.rageshake_submit_url, buf)
|
|
1859
|
+
_UniffiFfiConverterOptionalString.write(value.sentry_dsn, buf)
|
|
1860
|
+
_UniffiFfiConverterOptionalString.write(value.sentry_environment, buf)
|
|
1861
|
+
|
|
1862
|
+
|
|
1863
|
+
|
|
1864
|
+
|
|
1865
|
+
|
|
1866
|
+
|
|
1867
|
+
class BackupDownloadStrategy(enum.Enum):
|
|
1868
|
+
"""
|
|
1869
|
+
Settings for end-to-end encryption features.
|
|
1870
|
+
"""
|
|
1871
|
+
|
|
1872
|
+
ONE_SHOT = 0
|
|
1873
|
+
"""
|
|
1874
|
+
Automatically download all room keys from the backup when the backup
|
|
1875
|
+
recovery key has been received. The backup recovery key can be received
|
|
1876
|
+
in two ways:
|
|
1877
|
+
|
|
1878
|
+
1. Received as a `m.secret.send` to-device event, after a successful
|
|
1879
|
+
interactive verification.
|
|
1880
|
+
2. Imported from secret storage (4S) using the
|
|
1881
|
+
[`SecretStore::import_secrets()`] method.
|
|
1882
|
+
|
|
1883
|
+
[`SecretStore::import_secrets()`]: crate::encryption::secret_storage::SecretStore::import_secrets
|
|
1884
|
+
"""
|
|
1885
|
+
|
|
1886
|
+
AFTER_DECRYPTION_FAILURE = 1
|
|
1887
|
+
"""
|
|
1888
|
+
Attempt to download a single room key if an event fails to be decrypted.
|
|
1889
|
+
"""
|
|
1890
|
+
|
|
1891
|
+
MANUAL = 2
|
|
1892
|
+
"""
|
|
1893
|
+
Don't download any room keys automatically. The user can manually
|
|
1894
|
+
download room keys using the [`Backups::download_room_key()`] methods.
|
|
1895
|
+
|
|
1896
|
+
This is the default option.
|
|
1897
|
+
"""
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
|
|
1901
|
+
class _UniffiFfiConverterTypeBackupDownloadStrategy(_UniffiConverterRustBuffer):
|
|
1902
|
+
@staticmethod
|
|
1903
|
+
def read(buf):
|
|
1904
|
+
variant = buf.read_i32()
|
|
1905
|
+
if variant == 1:
|
|
1906
|
+
return BackupDownloadStrategy.ONE_SHOT
|
|
1907
|
+
if variant == 2:
|
|
1908
|
+
return BackupDownloadStrategy.AFTER_DECRYPTION_FAILURE
|
|
1909
|
+
if variant == 3:
|
|
1910
|
+
return BackupDownloadStrategy.MANUAL
|
|
1911
|
+
raise InternalError("Raw enum value doesn't match any cases")
|
|
1912
|
+
|
|
1913
|
+
@staticmethod
|
|
1914
|
+
def check_lower(value):
|
|
1915
|
+
if value == BackupDownloadStrategy.ONE_SHOT:
|
|
1916
|
+
return
|
|
1917
|
+
if value == BackupDownloadStrategy.AFTER_DECRYPTION_FAILURE:
|
|
1918
|
+
return
|
|
1919
|
+
if value == BackupDownloadStrategy.MANUAL:
|
|
1920
|
+
return
|
|
1921
|
+
raise ValueError(value)
|
|
1922
|
+
|
|
1923
|
+
@staticmethod
|
|
1924
|
+
def write(value, buf):
|
|
1925
|
+
if value == BackupDownloadStrategy.ONE_SHOT:
|
|
1926
|
+
buf.write_i32(1)
|
|
1927
|
+
if value == BackupDownloadStrategy.AFTER_DECRYPTION_FAILURE:
|
|
1928
|
+
buf.write_i32(2)
|
|
1929
|
+
if value == BackupDownloadStrategy.MANUAL:
|
|
1930
|
+
buf.write_i32(3)
|
|
1931
|
+
|
|
1932
|
+
|
|
1933
|
+
|
|
1934
|
+
|
|
1935
|
+
|
|
1936
|
+
|
|
1937
|
+
|
|
1938
|
+
|
|
1939
|
+
class PaginationStatus:
|
|
1940
|
+
"""
|
|
1941
|
+
Status for the pagination on a cache.
|
|
1942
|
+
"""
|
|
1943
|
+
def __init__(self):
|
|
1944
|
+
raise RuntimeError("PaginationStatus cannot be instantiated directly")
|
|
1945
|
+
|
|
1946
|
+
# Each enum variant is a nested class of the enum itself.
|
|
1947
|
+
@dataclass
|
|
1948
|
+
class IDLE:
|
|
1949
|
+
"""
|
|
1950
|
+
No pagination is happening right now.
|
|
1951
|
+
"""
|
|
1952
|
+
|
|
1953
|
+
def __init__(self, hit_timeline_start:bool):
|
|
1954
|
+
self.hit_timeline_start = hit_timeline_start
|
|
1955
|
+
|
|
1956
|
+
"""
|
|
1957
|
+
Have we hit the start of the timeline, i.e. paginating wouldn't
|
|
1958
|
+
have any effect?
|
|
1959
|
+
"""
|
|
1960
|
+
|
|
1961
|
+
pass
|
|
1962
|
+
|
|
1963
|
+
|
|
1964
|
+
|
|
1965
|
+
|
|
1966
|
+
|
|
1967
|
+
def __str__(self):
|
|
1968
|
+
return "PaginationStatus.IDLE(hit_timeline_start={})".format(self.hit_timeline_start)
|
|
1969
|
+
def __eq__(self, other):
|
|
1970
|
+
if not isinstance(other, PaginationStatus):
|
|
1971
|
+
return NotImplemented
|
|
1972
|
+
if not other.is_IDLE():
|
|
1973
|
+
return False
|
|
1974
|
+
if self.hit_timeline_start != other.hit_timeline_start:
|
|
1975
|
+
return False
|
|
1976
|
+
return True
|
|
1977
|
+
|
|
1978
|
+
@dataclass
|
|
1979
|
+
class PAGINATING:
|
|
1980
|
+
"""
|
|
1981
|
+
Pagination is already running in the background.
|
|
1982
|
+
"""
|
|
1983
|
+
|
|
1984
|
+
def __init__(self, ):
|
|
1985
|
+
pass
|
|
1986
|
+
|
|
1987
|
+
|
|
1988
|
+
|
|
1989
|
+
|
|
1990
|
+
|
|
1991
|
+
def __str__(self):
|
|
1992
|
+
return "PaginationStatus.PAGINATING()".format()
|
|
1993
|
+
def __eq__(self, other):
|
|
1994
|
+
if not isinstance(other, PaginationStatus):
|
|
1995
|
+
return NotImplemented
|
|
1996
|
+
if not other.is_PAGINATING():
|
|
1997
|
+
return False
|
|
1998
|
+
return True
|
|
1999
|
+
|
|
2000
|
+
|
|
2001
|
+
|
|
2002
|
+
# For each variant, we have `is_NAME` and `is_name` methods for easily checking
|
|
2003
|
+
# whether an instance is that variant.
|
|
2004
|
+
def is_IDLE(self) -> bool:
|
|
2005
|
+
return isinstance(self, PaginationStatus.IDLE)
|
|
2006
|
+
def is_idle(self) -> bool:
|
|
2007
|
+
return isinstance(self, PaginationStatus.IDLE)
|
|
2008
|
+
def is_PAGINATING(self) -> bool:
|
|
2009
|
+
return isinstance(self, PaginationStatus.PAGINATING)
|
|
2010
|
+
def is_paginating(self) -> bool:
|
|
2011
|
+
return isinstance(self, PaginationStatus.PAGINATING)
|
|
2012
|
+
|
|
2013
|
+
|
|
2014
|
+
# Now, a little trick - we make each nested variant class be a subclass of the main
|
|
2015
|
+
# enum class, so that method calls and instance checks etc will work intuitively.
|
|
2016
|
+
# We might be able to do this a little more neatly with a metaclass, but this'll do.
|
|
2017
|
+
PaginationStatus.IDLE = type("PaginationStatus.IDLE", (PaginationStatus.IDLE, PaginationStatus,), {}) # type: ignore
|
|
2018
|
+
PaginationStatus.PAGINATING = type("PaginationStatus.PAGINATING", (PaginationStatus.PAGINATING, PaginationStatus,), {}) # type: ignore
|
|
2019
|
+
|
|
2020
|
+
|
|
2021
|
+
|
|
2022
|
+
|
|
2023
|
+
class _UniffiFfiConverterTypePaginationStatus(_UniffiConverterRustBuffer):
|
|
2024
|
+
@staticmethod
|
|
2025
|
+
def read(buf):
|
|
2026
|
+
variant = buf.read_i32()
|
|
2027
|
+
if variant == 1:
|
|
2028
|
+
return PaginationStatus.IDLE(
|
|
2029
|
+
_UniffiFfiConverterBoolean.read(buf),
|
|
2030
|
+
)
|
|
2031
|
+
if variant == 2:
|
|
2032
|
+
return PaginationStatus.PAGINATING(
|
|
2033
|
+
)
|
|
2034
|
+
raise InternalError("Raw enum value doesn't match any cases")
|
|
2035
|
+
|
|
2036
|
+
@staticmethod
|
|
2037
|
+
def check_lower(value):
|
|
2038
|
+
if value.is_IDLE():
|
|
2039
|
+
_UniffiFfiConverterBoolean.check_lower(value.hit_timeline_start)
|
|
2040
|
+
return
|
|
2041
|
+
if value.is_PAGINATING():
|
|
2042
|
+
return
|
|
2043
|
+
raise ValueError(value)
|
|
2044
|
+
|
|
2045
|
+
@staticmethod
|
|
2046
|
+
def write(value, buf):
|
|
2047
|
+
if value.is_IDLE():
|
|
2048
|
+
buf.write_i32(1)
|
|
2049
|
+
_UniffiFfiConverterBoolean.write(value.hit_timeline_start, buf)
|
|
2050
|
+
if value.is_PAGINATING():
|
|
2051
|
+
buf.write_i32(2)
|
|
2052
|
+
|
|
2053
|
+
|
|
2054
|
+
|
|
2055
|
+
|
|
2056
|
+
|
|
2057
|
+
|
|
2058
|
+
|
|
2059
|
+
|
|
2060
|
+
class PaginatorState(enum.Enum):
|
|
2061
|
+
"""
|
|
2062
|
+
Current state of a [`Paginator`].
|
|
2063
|
+
"""
|
|
2064
|
+
|
|
2065
|
+
INITIAL = 0
|
|
2066
|
+
"""
|
|
2067
|
+
The initial state of the paginator.
|
|
2068
|
+
"""
|
|
2069
|
+
|
|
2070
|
+
FETCHING_TARGET_EVENT = 1
|
|
2071
|
+
"""
|
|
2072
|
+
The paginator is fetching the target initial event.
|
|
2073
|
+
"""
|
|
2074
|
+
|
|
2075
|
+
IDLE = 2
|
|
2076
|
+
"""
|
|
2077
|
+
The target initial event could be found, zero or more paginations have
|
|
2078
|
+
happened since then, and the paginator is at rest now.
|
|
2079
|
+
"""
|
|
2080
|
+
|
|
2081
|
+
PAGINATING = 3
|
|
2082
|
+
"""
|
|
2083
|
+
The paginator is… paginating one direction or another.
|
|
2084
|
+
"""
|
|
2085
|
+
|
|
2086
|
+
|
|
2087
|
+
|
|
2088
|
+
class _UniffiFfiConverterTypePaginatorState(_UniffiConverterRustBuffer):
|
|
2089
|
+
@staticmethod
|
|
2090
|
+
def read(buf):
|
|
2091
|
+
variant = buf.read_i32()
|
|
2092
|
+
if variant == 1:
|
|
2093
|
+
return PaginatorState.INITIAL
|
|
2094
|
+
if variant == 2:
|
|
2095
|
+
return PaginatorState.FETCHING_TARGET_EVENT
|
|
2096
|
+
if variant == 3:
|
|
2097
|
+
return PaginatorState.IDLE
|
|
2098
|
+
if variant == 4:
|
|
2099
|
+
return PaginatorState.PAGINATING
|
|
2100
|
+
raise InternalError("Raw enum value doesn't match any cases")
|
|
2101
|
+
|
|
2102
|
+
@staticmethod
|
|
2103
|
+
def check_lower(value):
|
|
2104
|
+
if value == PaginatorState.INITIAL:
|
|
2105
|
+
return
|
|
2106
|
+
if value == PaginatorState.FETCHING_TARGET_EVENT:
|
|
2107
|
+
return
|
|
2108
|
+
if value == PaginatorState.IDLE:
|
|
2109
|
+
return
|
|
2110
|
+
if value == PaginatorState.PAGINATING:
|
|
2111
|
+
return
|
|
2112
|
+
raise ValueError(value)
|
|
2113
|
+
|
|
2114
|
+
@staticmethod
|
|
2115
|
+
def write(value, buf):
|
|
2116
|
+
if value == PaginatorState.INITIAL:
|
|
2117
|
+
buf.write_i32(1)
|
|
2118
|
+
if value == PaginatorState.FETCHING_TARGET_EVENT:
|
|
2119
|
+
buf.write_i32(2)
|
|
2120
|
+
if value == PaginatorState.IDLE:
|
|
2121
|
+
buf.write_i32(3)
|
|
2122
|
+
if value == PaginatorState.PAGINATING:
|
|
2123
|
+
buf.write_i32(4)
|
|
2124
|
+
|
|
2125
|
+
|
|
2126
|
+
|
|
2127
|
+
|
|
2128
|
+
|
|
2129
|
+
# QrCodeLoginError
|
|
2130
|
+
# We want to define each variant as a nested class that's also a subclass,
|
|
2131
|
+
# which is tricky in Python. To accomplish this we're going to create each
|
|
2132
|
+
# class separately, then manually add the child classes to the base class's
|
|
2133
|
+
# __dict__. All of this happens in dummy class to avoid polluting the module
|
|
2134
|
+
# namespace.
|
|
2135
|
+
class QrCodeLoginError(Exception):
|
|
2136
|
+
"""
|
|
2137
|
+
The error type for failures while trying to log in a new device using a QR
|
|
2138
|
+
code.
|
|
2139
|
+
"""
|
|
2140
|
+
pass
|
|
2141
|
+
|
|
2142
|
+
_UniffiTempQrCodeLoginError = QrCodeLoginError
|
|
2143
|
+
|
|
2144
|
+
class QrCodeLoginError: # type: ignore
|
|
2145
|
+
"""
|
|
2146
|
+
The error type for failures while trying to log in a new device using a QR
|
|
2147
|
+
code.
|
|
2148
|
+
"""
|
|
2149
|
+
|
|
2150
|
+
class OAuth(_UniffiTempQrCodeLoginError):
|
|
2151
|
+
"""
|
|
2152
|
+
An error happened while we were communicating with the OAuth 2.0
|
|
2153
|
+
authorization server.
|
|
2154
|
+
"""
|
|
2155
|
+
def __repr__(self):
|
|
2156
|
+
return "QrCodeLoginError.OAuth({})".format(repr(str(self)))
|
|
2157
|
+
_UniffiTempQrCodeLoginError.OAuth = OAuth # type: ignore
|
|
2158
|
+
class LoginFailure(_UniffiTempQrCodeLoginError):
|
|
2159
|
+
"""
|
|
2160
|
+
The other device has signaled to us that the login has failed.
|
|
2161
|
+
"""
|
|
2162
|
+
def __repr__(self):
|
|
2163
|
+
return "QrCodeLoginError.LoginFailure({})".format(repr(str(self)))
|
|
2164
|
+
_UniffiTempQrCodeLoginError.LoginFailure = LoginFailure # type: ignore
|
|
2165
|
+
class UnexpectedMessage(_UniffiTempQrCodeLoginError):
|
|
2166
|
+
"""
|
|
2167
|
+
An unexpected message was received from the other device.
|
|
2168
|
+
"""
|
|
2169
|
+
def __repr__(self):
|
|
2170
|
+
return "QrCodeLoginError.UnexpectedMessage({})".format(repr(str(self)))
|
|
2171
|
+
_UniffiTempQrCodeLoginError.UnexpectedMessage = UnexpectedMessage # type: ignore
|
|
2172
|
+
class SecureChannel(_UniffiTempQrCodeLoginError):
|
|
2173
|
+
"""
|
|
2174
|
+
An error happened while exchanging messages with the other device.
|
|
2175
|
+
"""
|
|
2176
|
+
def __repr__(self):
|
|
2177
|
+
return "QrCodeLoginError.SecureChannel({})".format(repr(str(self)))
|
|
2178
|
+
_UniffiTempQrCodeLoginError.SecureChannel = SecureChannel # type: ignore
|
|
2179
|
+
class NotFound(_UniffiTempQrCodeLoginError):
|
|
2180
|
+
"""
|
|
2181
|
+
The rendezvous session was not found and might have expired.
|
|
2182
|
+
"""
|
|
2183
|
+
def __repr__(self):
|
|
2184
|
+
return "QrCodeLoginError.NotFound({})".format(repr(str(self)))
|
|
2185
|
+
_UniffiTempQrCodeLoginError.NotFound = NotFound # type: ignore
|
|
2186
|
+
class CrossProcessRefreshLock(_UniffiTempQrCodeLoginError):
|
|
2187
|
+
"""
|
|
2188
|
+
The cross-process refresh lock failed to be initialized.
|
|
2189
|
+
"""
|
|
2190
|
+
def __repr__(self):
|
|
2191
|
+
return "QrCodeLoginError.CrossProcessRefreshLock({})".format(repr(str(self)))
|
|
2192
|
+
_UniffiTempQrCodeLoginError.CrossProcessRefreshLock = CrossProcessRefreshLock # type: ignore
|
|
2193
|
+
class UserIdDiscovery(_UniffiTempQrCodeLoginError):
|
|
2194
|
+
"""
|
|
2195
|
+
An error happened while we were trying to discover our user and device
|
|
2196
|
+
ID, after we have acquired an access token from the OAuth 2.0
|
|
2197
|
+
authorization server.
|
|
2198
|
+
"""
|
|
2199
|
+
def __repr__(self):
|
|
2200
|
+
return "QrCodeLoginError.UserIdDiscovery({})".format(repr(str(self)))
|
|
2201
|
+
_UniffiTempQrCodeLoginError.UserIdDiscovery = UserIdDiscovery # type: ignore
|
|
2202
|
+
class SessionTokens(_UniffiTempQrCodeLoginError):
|
|
2203
|
+
"""
|
|
2204
|
+
We failed to set the session tokens after we figured out our device and
|
|
2205
|
+
user IDs.
|
|
2206
|
+
"""
|
|
2207
|
+
def __repr__(self):
|
|
2208
|
+
return "QrCodeLoginError.SessionTokens({})".format(repr(str(self)))
|
|
2209
|
+
_UniffiTempQrCodeLoginError.SessionTokens = SessionTokens # type: ignore
|
|
2210
|
+
class DeviceKeyUpload(_UniffiTempQrCodeLoginError):
|
|
2211
|
+
"""
|
|
2212
|
+
The device keys failed to be uploaded after we successfully logged in.
|
|
2213
|
+
"""
|
|
2214
|
+
def __repr__(self):
|
|
2215
|
+
return "QrCodeLoginError.DeviceKeyUpload({})".format(repr(str(self)))
|
|
2216
|
+
_UniffiTempQrCodeLoginError.DeviceKeyUpload = DeviceKeyUpload # type: ignore
|
|
2217
|
+
class SecretImport(_UniffiTempQrCodeLoginError):
|
|
2218
|
+
"""
|
|
2219
|
+
The secrets bundle we received from the existing device failed to be
|
|
2220
|
+
imported.
|
|
2221
|
+
"""
|
|
2222
|
+
def __repr__(self):
|
|
2223
|
+
return "QrCodeLoginError.SecretImport({})".format(repr(str(self)))
|
|
2224
|
+
_UniffiTempQrCodeLoginError.SecretImport = SecretImport # type: ignore
|
|
2225
|
+
class ServerReset(_UniffiTempQrCodeLoginError):
|
|
2226
|
+
"""
|
|
2227
|
+
The other party told us to use a different homeserver but we failed to
|
|
2228
|
+
reset the server URL.
|
|
2229
|
+
"""
|
|
2230
|
+
def __repr__(self):
|
|
2231
|
+
return "QrCodeLoginError.ServerReset({})".format(repr(str(self)))
|
|
2232
|
+
_UniffiTempQrCodeLoginError.ServerReset = ServerReset # type: ignore
|
|
2233
|
+
|
|
2234
|
+
QrCodeLoginError = _UniffiTempQrCodeLoginError # type: ignore
|
|
2235
|
+
del _UniffiTempQrCodeLoginError
|
|
2236
|
+
|
|
2237
|
+
|
|
2238
|
+
class _UniffiFfiConverterTypeQRCodeLoginError(_UniffiConverterRustBuffer):
|
|
2239
|
+
@staticmethod
|
|
2240
|
+
def read(buf):
|
|
2241
|
+
variant = buf.read_i32()
|
|
2242
|
+
if variant == 1:
|
|
2243
|
+
return QrCodeLoginError.OAuth(
|
|
2244
|
+
_UniffiFfiConverterString.read(buf),
|
|
2245
|
+
)
|
|
2246
|
+
if variant == 2:
|
|
2247
|
+
return QrCodeLoginError.LoginFailure(
|
|
2248
|
+
_UniffiFfiConverterString.read(buf),
|
|
2249
|
+
)
|
|
2250
|
+
if variant == 3:
|
|
2251
|
+
return QrCodeLoginError.UnexpectedMessage(
|
|
2252
|
+
_UniffiFfiConverterString.read(buf),
|
|
2253
|
+
)
|
|
2254
|
+
if variant == 4:
|
|
2255
|
+
return QrCodeLoginError.SecureChannel(
|
|
2256
|
+
_UniffiFfiConverterString.read(buf),
|
|
2257
|
+
)
|
|
2258
|
+
if variant == 5:
|
|
2259
|
+
return QrCodeLoginError.NotFound(
|
|
2260
|
+
_UniffiFfiConverterString.read(buf),
|
|
2261
|
+
)
|
|
2262
|
+
if variant == 6:
|
|
2263
|
+
return QrCodeLoginError.CrossProcessRefreshLock(
|
|
2264
|
+
_UniffiFfiConverterString.read(buf),
|
|
2265
|
+
)
|
|
2266
|
+
if variant == 7:
|
|
2267
|
+
return QrCodeLoginError.UserIdDiscovery(
|
|
2268
|
+
_UniffiFfiConverterString.read(buf),
|
|
2269
|
+
)
|
|
2270
|
+
if variant == 8:
|
|
2271
|
+
return QrCodeLoginError.SessionTokens(
|
|
2272
|
+
_UniffiFfiConverterString.read(buf),
|
|
2273
|
+
)
|
|
2274
|
+
if variant == 9:
|
|
2275
|
+
return QrCodeLoginError.DeviceKeyUpload(
|
|
2276
|
+
_UniffiFfiConverterString.read(buf),
|
|
2277
|
+
)
|
|
2278
|
+
if variant == 10:
|
|
2279
|
+
return QrCodeLoginError.SecretImport(
|
|
2280
|
+
_UniffiFfiConverterString.read(buf),
|
|
2281
|
+
)
|
|
2282
|
+
if variant == 11:
|
|
2283
|
+
return QrCodeLoginError.ServerReset(
|
|
2284
|
+
_UniffiFfiConverterString.read(buf),
|
|
2285
|
+
)
|
|
2286
|
+
raise InternalError("Raw enum value doesn't match any cases")
|
|
2287
|
+
|
|
2288
|
+
@staticmethod
|
|
2289
|
+
def check_lower(value):
|
|
2290
|
+
if isinstance(value, QrCodeLoginError.OAuth):
|
|
2291
|
+
return
|
|
2292
|
+
if isinstance(value, QrCodeLoginError.LoginFailure):
|
|
2293
|
+
return
|
|
2294
|
+
if isinstance(value, QrCodeLoginError.UnexpectedMessage):
|
|
2295
|
+
return
|
|
2296
|
+
if isinstance(value, QrCodeLoginError.SecureChannel):
|
|
2297
|
+
return
|
|
2298
|
+
if isinstance(value, QrCodeLoginError.NotFound):
|
|
2299
|
+
return
|
|
2300
|
+
if isinstance(value, QrCodeLoginError.CrossProcessRefreshLock):
|
|
2301
|
+
return
|
|
2302
|
+
if isinstance(value, QrCodeLoginError.UserIdDiscovery):
|
|
2303
|
+
return
|
|
2304
|
+
if isinstance(value, QrCodeLoginError.SessionTokens):
|
|
2305
|
+
return
|
|
2306
|
+
if isinstance(value, QrCodeLoginError.DeviceKeyUpload):
|
|
2307
|
+
return
|
|
2308
|
+
if isinstance(value, QrCodeLoginError.SecretImport):
|
|
2309
|
+
return
|
|
2310
|
+
if isinstance(value, QrCodeLoginError.ServerReset):
|
|
2311
|
+
return
|
|
2312
|
+
|
|
2313
|
+
@staticmethod
|
|
2314
|
+
def write(value, buf):
|
|
2315
|
+
if isinstance(value, QrCodeLoginError.OAuth):
|
|
2316
|
+
buf.write_i32(1)
|
|
2317
|
+
if isinstance(value, QrCodeLoginError.LoginFailure):
|
|
2318
|
+
buf.write_i32(2)
|
|
2319
|
+
if isinstance(value, QrCodeLoginError.UnexpectedMessage):
|
|
2320
|
+
buf.write_i32(3)
|
|
2321
|
+
if isinstance(value, QrCodeLoginError.SecureChannel):
|
|
2322
|
+
buf.write_i32(4)
|
|
2323
|
+
if isinstance(value, QrCodeLoginError.NotFound):
|
|
2324
|
+
buf.write_i32(5)
|
|
2325
|
+
if isinstance(value, QrCodeLoginError.CrossProcessRefreshLock):
|
|
2326
|
+
buf.write_i32(6)
|
|
2327
|
+
if isinstance(value, QrCodeLoginError.UserIdDiscovery):
|
|
2328
|
+
buf.write_i32(7)
|
|
2329
|
+
if isinstance(value, QrCodeLoginError.SessionTokens):
|
|
2330
|
+
buf.write_i32(8)
|
|
2331
|
+
if isinstance(value, QrCodeLoginError.DeviceKeyUpload):
|
|
2332
|
+
buf.write_i32(9)
|
|
2333
|
+
if isinstance(value, QrCodeLoginError.SecretImport):
|
|
2334
|
+
buf.write_i32(10)
|
|
2335
|
+
if isinstance(value, QrCodeLoginError.ServerReset):
|
|
2336
|
+
buf.write_i32(11)
|
|
2337
|
+
|
|
2338
|
+
|
|
2339
|
+
|
|
2340
|
+
|
|
2341
|
+
|
|
2342
|
+
|
|
2343
|
+
class RoomMemberRole(enum.Enum):
|
|
2344
|
+
"""
|
|
2345
|
+
The role of a member in a room.
|
|
2346
|
+
"""
|
|
2347
|
+
|
|
2348
|
+
CREATOR = 0
|
|
2349
|
+
"""
|
|
2350
|
+
The member is a creator.
|
|
2351
|
+
|
|
2352
|
+
A creator has an infinite power level and cannot be demoted, so this
|
|
2353
|
+
role is immutable. A room can have several creators.
|
|
2354
|
+
|
|
2355
|
+
It is available in room versions where
|
|
2356
|
+
`explicitly_privilege_room_creators` in [`AuthorizationRules`] is set to
|
|
2357
|
+
`true`.
|
|
2358
|
+
|
|
2359
|
+
[`AuthorizationRules`]: ruma::room_version_rules::AuthorizationRules
|
|
2360
|
+
"""
|
|
2361
|
+
|
|
2362
|
+
ADMINISTRATOR = 1
|
|
2363
|
+
"""
|
|
2364
|
+
The member is an administrator.
|
|
2365
|
+
"""
|
|
2366
|
+
|
|
2367
|
+
MODERATOR = 2
|
|
2368
|
+
"""
|
|
2369
|
+
The member is a moderator.
|
|
2370
|
+
"""
|
|
2371
|
+
|
|
2372
|
+
USER = 3
|
|
2373
|
+
"""
|
|
2374
|
+
The member is a regular user.
|
|
2375
|
+
"""
|
|
2376
|
+
|
|
2377
|
+
|
|
2378
|
+
|
|
2379
|
+
class _UniffiFfiConverterTypeRoomMemberRole(_UniffiConverterRustBuffer):
|
|
2380
|
+
@staticmethod
|
|
2381
|
+
def read(buf):
|
|
2382
|
+
variant = buf.read_i32()
|
|
2383
|
+
if variant == 1:
|
|
2384
|
+
return RoomMemberRole.CREATOR
|
|
2385
|
+
if variant == 2:
|
|
2386
|
+
return RoomMemberRole.ADMINISTRATOR
|
|
2387
|
+
if variant == 3:
|
|
2388
|
+
return RoomMemberRole.MODERATOR
|
|
2389
|
+
if variant == 4:
|
|
2390
|
+
return RoomMemberRole.USER
|
|
2391
|
+
raise InternalError("Raw enum value doesn't match any cases")
|
|
2392
|
+
|
|
2393
|
+
@staticmethod
|
|
2394
|
+
def check_lower(value):
|
|
2395
|
+
if value == RoomMemberRole.CREATOR:
|
|
2396
|
+
return
|
|
2397
|
+
if value == RoomMemberRole.ADMINISTRATOR:
|
|
2398
|
+
return
|
|
2399
|
+
if value == RoomMemberRole.MODERATOR:
|
|
2400
|
+
return
|
|
2401
|
+
if value == RoomMemberRole.USER:
|
|
2402
|
+
return
|
|
2403
|
+
raise ValueError(value)
|
|
2404
|
+
|
|
2405
|
+
@staticmethod
|
|
2406
|
+
def write(value, buf):
|
|
2407
|
+
if value == RoomMemberRole.CREATOR:
|
|
2408
|
+
buf.write_i32(1)
|
|
2409
|
+
if value == RoomMemberRole.ADMINISTRATOR:
|
|
2410
|
+
buf.write_i32(2)
|
|
2411
|
+
if value == RoomMemberRole.MODERATOR:
|
|
2412
|
+
buf.write_i32(3)
|
|
2413
|
+
if value == RoomMemberRole.USER:
|
|
2414
|
+
buf.write_i32(4)
|
|
2415
|
+
|
|
2416
|
+
|
|
2417
|
+
|
|
2418
|
+
|
|
2419
|
+
class OAuthAuthorizationDataProtocol(typing.Protocol):
|
|
2420
|
+
"""
|
|
2421
|
+
The data needed to perform authorization using OAuth 2.0.
|
|
2422
|
+
"""
|
|
2423
|
+
|
|
2424
|
+
def login_url(self, ) -> str:
|
|
2425
|
+
"""
|
|
2426
|
+
The login URL to use for authorization.
|
|
2427
|
+
"""
|
|
2428
|
+
raise NotImplementedError
|
|
2429
|
+
|
|
2430
|
+
class OAuthAuthorizationData(OAuthAuthorizationDataProtocol):
|
|
2431
|
+
"""
|
|
2432
|
+
The data needed to perform authorization using OAuth 2.0.
|
|
2433
|
+
"""
|
|
2434
|
+
|
|
2435
|
+
_handle: ctypes.c_uint64
|
|
2436
|
+
|
|
2437
|
+
def __init__(self, *args, **kwargs):
|
|
2438
|
+
raise ValueError("This class has no default constructor")
|
|
2439
|
+
|
|
2440
|
+
def __del__(self):
|
|
2441
|
+
# In case of partial initialization of instances.
|
|
2442
|
+
handle = getattr(self, "_handle", None)
|
|
2443
|
+
if handle is not None:
|
|
2444
|
+
_uniffi_rust_call(_UniffiLib.uniffi_matrix_sdk_fn_free_oauthauthorizationdata, handle)
|
|
2445
|
+
|
|
2446
|
+
def _uniffi_clone_handle(self):
|
|
2447
|
+
return _uniffi_rust_call(_UniffiLib.uniffi_matrix_sdk_fn_clone_oauthauthorizationdata, self._handle)
|
|
2448
|
+
|
|
2449
|
+
# Used by alternative constructors or any methods which return this type.
|
|
2450
|
+
@classmethod
|
|
2451
|
+
def _uniffi_make_instance(cls, handle):
|
|
2452
|
+
# Lightly yucky way to bypass the usual __init__ logic
|
|
2453
|
+
# and just create a new instance with the required handle.
|
|
2454
|
+
inst = cls.__new__(cls)
|
|
2455
|
+
inst._handle = handle
|
|
2456
|
+
return inst
|
|
2457
|
+
def login_url(self, ) -> str:
|
|
2458
|
+
"""
|
|
2459
|
+
The login URL to use for authorization.
|
|
2460
|
+
"""
|
|
2461
|
+
_uniffi_lowered_args = (
|
|
2462
|
+
self._uniffi_clone_handle(),
|
|
2463
|
+
)
|
|
2464
|
+
_uniffi_lift_return = _UniffiFfiConverterString.lift
|
|
2465
|
+
_uniffi_error_converter = None
|
|
2466
|
+
_uniffi_ffi_result = _uniffi_rust_call_with_error(
|
|
2467
|
+
_uniffi_error_converter,
|
|
2468
|
+
_UniffiLib.uniffi_matrix_sdk_fn_method_oauthauthorizationdata_login_url,
|
|
2469
|
+
*_uniffi_lowered_args,
|
|
2470
|
+
)
|
|
2471
|
+
return _uniffi_lift_return(_uniffi_ffi_result)
|
|
2472
|
+
|
|
2473
|
+
|
|
2474
|
+
|
|
2475
|
+
|
|
2476
|
+
|
|
2477
|
+
class _UniffiFfiConverterTypeOAuthAuthorizationData:
|
|
2478
|
+
@staticmethod
|
|
2479
|
+
def lift(value: int) -> OAuthAuthorizationData:
|
|
2480
|
+
return OAuthAuthorizationData._uniffi_make_instance(value)
|
|
2481
|
+
|
|
2482
|
+
@staticmethod
|
|
2483
|
+
def check_lower(value: OAuthAuthorizationData):
|
|
2484
|
+
if not isinstance(value, OAuthAuthorizationData):
|
|
2485
|
+
raise TypeError("Expected OAuthAuthorizationData instance, {} found".format(type(value).__name__))
|
|
2486
|
+
|
|
2487
|
+
@staticmethod
|
|
2488
|
+
def lower(value: OAuthAuthorizationData) -> ctypes.c_uint64:
|
|
2489
|
+
return value._uniffi_clone_handle()
|
|
2490
|
+
|
|
2491
|
+
@classmethod
|
|
2492
|
+
def read(cls, buf: _UniffiRustBuffer) -> OAuthAuthorizationData:
|
|
2493
|
+
ptr = buf.read_u64()
|
|
2494
|
+
if ptr == 0:
|
|
2495
|
+
raise InternalError("Raw handle value was null")
|
|
2496
|
+
return cls.lift(ptr)
|
|
2497
|
+
|
|
2498
|
+
@classmethod
|
|
2499
|
+
def write(cls, value: OAuthAuthorizationData, buf: _UniffiRustBuffer):
|
|
2500
|
+
buf.write_u64(cls.lower(value))
|
|
2501
|
+
|
|
2502
|
+
class _UniffiFfiConverterUInt8(_UniffiConverterPrimitiveInt):
|
|
2503
|
+
CLASS_NAME = "u8"
|
|
2504
|
+
VALUE_MIN = 0
|
|
2505
|
+
VALUE_MAX = 2**8
|
|
2506
|
+
|
|
2507
|
+
@staticmethod
|
|
2508
|
+
def read(buf):
|
|
2509
|
+
return buf.read_u8()
|
|
2510
|
+
|
|
2511
|
+
@staticmethod
|
|
2512
|
+
def write(value, buf):
|
|
2513
|
+
buf.write_u8(value)
|
|
2514
|
+
|
|
2515
|
+
__all__ = [
|
|
2516
|
+
"InternalError",
|
|
2517
|
+
"Intent",
|
|
2518
|
+
"HeaderStyle",
|
|
2519
|
+
"NotificationType",
|
|
2520
|
+
"EncryptionSystem",
|
|
2521
|
+
"BackupDownloadStrategy",
|
|
2522
|
+
"PaginationStatus",
|
|
2523
|
+
"PaginatorState",
|
|
2524
|
+
"QrCodeLoginError",
|
|
2525
|
+
"RoomMemberRole",
|
|
2526
|
+
"RoomPowerLevelChanges",
|
|
2527
|
+
"ServerVendorInfo",
|
|
2528
|
+
"TileServerInfo",
|
|
2529
|
+
"VirtualElementCallWidgetConfig",
|
|
2530
|
+
"VirtualElementCallWidgetProperties",
|
|
2531
|
+
"OAuthAuthorizationData",
|
|
2532
|
+
"OAuthAuthorizationDataProtocol",
|
|
2533
|
+
]
|