24691 lines
812 KiB
Swift
24691 lines
812 KiB
Swift
// This file was autogenerated by some hot garbage in the `uniffi` crate.
|
|
// Trust me, you don't want to mess with it!
|
|
|
|
// swiftlint:disable all
|
|
import Foundation
|
|
|
|
// Depending on the consumer's build setup, the low-level FFI code
|
|
// might be in a separate module, or it might be compiled inline into
|
|
// this module. This is a bit of light hackery to work with both.
|
|
#if canImport(matrix_sdk_ffiFFI)
|
|
import matrix_sdk_ffiFFI
|
|
#endif
|
|
|
|
fileprivate extension RustBuffer {
|
|
// Allocate a new buffer, copying the contents of a `UInt8` array.
|
|
init(bytes: [UInt8]) {
|
|
let rbuf = bytes.withUnsafeBufferPointer { ptr in
|
|
RustBuffer.from(ptr)
|
|
}
|
|
self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data)
|
|
}
|
|
|
|
static func from(_ ptr: UnsafeBufferPointer<UInt8>) -> RustBuffer {
|
|
try! rustCall { ffi_matrix_sdk_ffi_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) }
|
|
}
|
|
|
|
// Frees the buffer in place.
|
|
// The buffer must not be used after this is called.
|
|
func deallocate() {
|
|
try! rustCall { ffi_matrix_sdk_ffi_rustbuffer_free(self, $0) }
|
|
}
|
|
}
|
|
|
|
fileprivate extension ForeignBytes {
|
|
init(bufferPointer: UnsafeBufferPointer<UInt8>) {
|
|
self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress)
|
|
}
|
|
}
|
|
|
|
// For every type used in the interface, we provide helper methods for conveniently
|
|
// lifting and lowering that type from C-compatible data, and for reading and writing
|
|
// values of that type in a buffer.
|
|
|
|
// Helper classes/extensions that don't change.
|
|
// Someday, this will be in a library of its own.
|
|
|
|
fileprivate extension Data {
|
|
init(rustBuffer: RustBuffer) {
|
|
// TODO: This copies the buffer. Can we read directly from a
|
|
// Rust buffer?
|
|
self.init(bytes: rustBuffer.data!, count: Int(rustBuffer.len))
|
|
}
|
|
}
|
|
|
|
// Define reader functionality. Normally this would be defined in a class or
|
|
// struct, but we use standalone functions instead in order to make external
|
|
// types work.
|
|
//
|
|
// With external types, one swift source file needs to be able to call the read
|
|
// method on another source file's FfiConverter, but then what visibility
|
|
// should Reader have?
|
|
// - If Reader is fileprivate, then this means the read() must also
|
|
// be fileprivate, which doesn't work with external types.
|
|
// - If Reader is internal/public, we'll get compile errors since both source
|
|
// files will try define the same type.
|
|
//
|
|
// Instead, the read() method and these helper functions input a tuple of data
|
|
|
|
fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) {
|
|
(data: data, offset: 0)
|
|
}
|
|
|
|
// Reads an integer at the current offset, in big-endian order, and advances
|
|
// the offset on success. Throws if reading the integer would move the
|
|
// offset past the end of the buffer.
|
|
fileprivate func readInt<T: FixedWidthInteger>(_ reader: inout (data: Data, offset: Data.Index)) throws -> T {
|
|
let range = reader.offset..<reader.offset + MemoryLayout<T>.size
|
|
guard reader.data.count >= range.upperBound else {
|
|
throw UniffiInternalError.bufferOverflow
|
|
}
|
|
if T.self == UInt8.self {
|
|
let value = reader.data[reader.offset]
|
|
reader.offset += 1
|
|
return value as! T
|
|
}
|
|
var value: T = 0
|
|
let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)})
|
|
reader.offset = range.upperBound
|
|
return value.bigEndian
|
|
}
|
|
|
|
// Reads an arbitrary number of bytes, to be used to read
|
|
// raw bytes, this is useful when lifting strings
|
|
fileprivate func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> Array<UInt8> {
|
|
let range = reader.offset..<(reader.offset+count)
|
|
guard reader.data.count >= range.upperBound else {
|
|
throw UniffiInternalError.bufferOverflow
|
|
}
|
|
var value = [UInt8](repeating: 0, count: count)
|
|
value.withUnsafeMutableBufferPointer({ buffer in
|
|
reader.data.copyBytes(to: buffer, from: range)
|
|
})
|
|
reader.offset = range.upperBound
|
|
return value
|
|
}
|
|
|
|
// Reads a float at the current offset.
|
|
fileprivate func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float {
|
|
return Float(bitPattern: try readInt(&reader))
|
|
}
|
|
|
|
// Reads a float at the current offset.
|
|
fileprivate func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double {
|
|
return Double(bitPattern: try readInt(&reader))
|
|
}
|
|
|
|
// Indicates if the offset has reached the end of the buffer.
|
|
fileprivate func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool {
|
|
return reader.offset < reader.data.count
|
|
}
|
|
|
|
// Define writer functionality. Normally this would be defined in a class or
|
|
// struct, but we use standalone functions instead in order to make external
|
|
// types work. See the above discussion on Readers for details.
|
|
|
|
fileprivate func createWriter() -> [UInt8] {
|
|
return []
|
|
}
|
|
|
|
fileprivate func writeBytes<S>(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 {
|
|
writer.append(contentsOf: byteArr)
|
|
}
|
|
|
|
// Writes an integer in big-endian order.
|
|
//
|
|
// Warning: make sure what you are trying to write
|
|
// is in the correct type!
|
|
fileprivate func writeInt<T: FixedWidthInteger>(_ writer: inout [UInt8], _ value: T) {
|
|
var value = value.bigEndian
|
|
withUnsafeBytes(of: &value) { writer.append(contentsOf: $0) }
|
|
}
|
|
|
|
fileprivate func writeFloat(_ writer: inout [UInt8], _ value: Float) {
|
|
writeInt(&writer, value.bitPattern)
|
|
}
|
|
|
|
fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) {
|
|
writeInt(&writer, value.bitPattern)
|
|
}
|
|
|
|
// Protocol for types that transfer other types across the FFI. This is
|
|
// analogous go the Rust trait of the same name.
|
|
fileprivate protocol FfiConverter {
|
|
associatedtype FfiType
|
|
associatedtype SwiftType
|
|
|
|
static func lift(_ value: FfiType) throws -> SwiftType
|
|
static func lower(_ value: SwiftType) -> FfiType
|
|
static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType
|
|
static func write(_ value: SwiftType, into buf: inout [UInt8])
|
|
}
|
|
|
|
// Types conforming to `Primitive` pass themselves directly over the FFI.
|
|
fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { }
|
|
|
|
extension FfiConverterPrimitive {
|
|
public static func lift(_ value: FfiType) throws -> SwiftType {
|
|
return value
|
|
}
|
|
|
|
public static func lower(_ value: SwiftType) -> FfiType {
|
|
return value
|
|
}
|
|
}
|
|
|
|
// Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`.
|
|
// Used for complex types where it's hard to write a custom lift/lower.
|
|
fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {}
|
|
|
|
extension FfiConverterRustBuffer {
|
|
public static func lift(_ buf: RustBuffer) throws -> SwiftType {
|
|
var reader = createReader(data: Data(rustBuffer: buf))
|
|
let value = try read(from: &reader)
|
|
if hasRemaining(reader) {
|
|
throw UniffiInternalError.incompleteData
|
|
}
|
|
buf.deallocate()
|
|
return value
|
|
}
|
|
|
|
public static func lower(_ value: SwiftType) -> RustBuffer {
|
|
var writer = createWriter()
|
|
write(value, into: &writer)
|
|
return RustBuffer(bytes: writer)
|
|
}
|
|
}
|
|
// An error type for FFI errors. These errors occur at the UniFFI level, not
|
|
// the library level.
|
|
fileprivate enum UniffiInternalError: LocalizedError {
|
|
case bufferOverflow
|
|
case incompleteData
|
|
case unexpectedOptionalTag
|
|
case unexpectedEnumCase
|
|
case unexpectedNullPointer
|
|
case unexpectedRustCallStatusCode
|
|
case unexpectedRustCallError
|
|
case unexpectedStaleHandle
|
|
case rustPanic(_ message: String)
|
|
|
|
public var errorDescription: String? {
|
|
switch self {
|
|
case .bufferOverflow: return "Reading the requested value would read past the end of the buffer"
|
|
case .incompleteData: return "The buffer still has data after lifting its containing value"
|
|
case .unexpectedOptionalTag: return "Unexpected optional tag; should be 0 or 1"
|
|
case .unexpectedEnumCase: return "Raw enum value doesn't match any cases"
|
|
case .unexpectedNullPointer: return "Raw pointer value was null"
|
|
case .unexpectedRustCallStatusCode: return "Unexpected RustCallStatus code"
|
|
case .unexpectedRustCallError: return "CALL_ERROR but no errorClass specified"
|
|
case .unexpectedStaleHandle: return "The object in the handle map has been dropped already"
|
|
case let .rustPanic(message): return message
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate extension NSLock {
|
|
func withLock<T>(f: () throws -> T) rethrows -> T {
|
|
self.lock()
|
|
defer { self.unlock() }
|
|
return try f()
|
|
}
|
|
}
|
|
|
|
fileprivate let CALL_SUCCESS: Int8 = 0
|
|
fileprivate let CALL_ERROR: Int8 = 1
|
|
fileprivate let CALL_UNEXPECTED_ERROR: Int8 = 2
|
|
fileprivate let CALL_CANCELLED: Int8 = 3
|
|
|
|
fileprivate extension RustCallStatus {
|
|
init() {
|
|
self.init(
|
|
code: CALL_SUCCESS,
|
|
errorBuf: RustBuffer.init(
|
|
capacity: 0,
|
|
len: 0,
|
|
data: nil
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
private func rustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
|
|
try makeRustCall(callback, errorHandler: nil)
|
|
}
|
|
|
|
private func rustCallWithError<T>(
|
|
_ errorHandler: @escaping (RustBuffer) throws -> Error,
|
|
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
|
|
try makeRustCall(callback, errorHandler: errorHandler)
|
|
}
|
|
|
|
private func makeRustCall<T>(
|
|
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
|
|
errorHandler: ((RustBuffer) throws -> Error)?
|
|
) throws -> T {
|
|
uniffiEnsureInitialized()
|
|
var callStatus = RustCallStatus.init()
|
|
let returnedVal = callback(&callStatus)
|
|
try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler)
|
|
return returnedVal
|
|
}
|
|
|
|
private func uniffiCheckCallStatus(
|
|
callStatus: RustCallStatus,
|
|
errorHandler: ((RustBuffer) throws -> Error)?
|
|
) throws {
|
|
switch callStatus.code {
|
|
case CALL_SUCCESS:
|
|
return
|
|
|
|
case CALL_ERROR:
|
|
if let errorHandler = errorHandler {
|
|
throw try errorHandler(callStatus.errorBuf)
|
|
} else {
|
|
callStatus.errorBuf.deallocate()
|
|
throw UniffiInternalError.unexpectedRustCallError
|
|
}
|
|
|
|
case CALL_UNEXPECTED_ERROR:
|
|
// When the rust code sees a panic, it tries to construct a RustBuffer
|
|
// with the message. But if that code panics, then it just sends back
|
|
// an empty buffer.
|
|
if callStatus.errorBuf.len > 0 {
|
|
throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf))
|
|
} else {
|
|
callStatus.errorBuf.deallocate()
|
|
throw UniffiInternalError.rustPanic("Rust panic")
|
|
}
|
|
|
|
case CALL_CANCELLED:
|
|
fatalError("Cancellation not supported yet")
|
|
|
|
default:
|
|
throw UniffiInternalError.unexpectedRustCallStatusCode
|
|
}
|
|
}
|
|
|
|
private func uniffiTraitInterfaceCall<T>(
|
|
callStatus: UnsafeMutablePointer<RustCallStatus>,
|
|
makeCall: () throws -> T,
|
|
writeReturn: (T) -> ()
|
|
) {
|
|
do {
|
|
try writeReturn(makeCall())
|
|
} catch let error {
|
|
callStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error))
|
|
}
|
|
}
|
|
|
|
private func uniffiTraitInterfaceCallWithError<T, E>(
|
|
callStatus: UnsafeMutablePointer<RustCallStatus>,
|
|
makeCall: () throws -> T,
|
|
writeReturn: (T) -> (),
|
|
lowerError: (E) -> RustBuffer
|
|
) {
|
|
do {
|
|
try writeReturn(makeCall())
|
|
} catch let error as E {
|
|
callStatus.pointee.code = CALL_ERROR
|
|
callStatus.pointee.errorBuf = lowerError(error)
|
|
} catch {
|
|
callStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error))
|
|
}
|
|
}
|
|
fileprivate class UniffiHandleMap<T> {
|
|
private var map: [UInt64: T] = [:]
|
|
private let lock = NSLock()
|
|
private var currentHandle: UInt64 = 1
|
|
|
|
func insert(obj: T) -> UInt64 {
|
|
lock.withLock {
|
|
let handle = currentHandle
|
|
currentHandle += 1
|
|
map[handle] = obj
|
|
return handle
|
|
}
|
|
}
|
|
|
|
func get(handle: UInt64) throws -> T {
|
|
try lock.withLock {
|
|
guard let obj = map[handle] else {
|
|
throw UniffiInternalError.unexpectedStaleHandle
|
|
}
|
|
return obj
|
|
}
|
|
}
|
|
|
|
@discardableResult
|
|
func remove(handle: UInt64) throws -> T {
|
|
try lock.withLock {
|
|
guard let obj = map.removeValue(forKey: handle) else {
|
|
throw UniffiInternalError.unexpectedStaleHandle
|
|
}
|
|
return obj
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Public interface members begin here.
|
|
|
|
|
|
fileprivate struct FfiConverterUInt8: FfiConverterPrimitive {
|
|
typealias FfiType = UInt8
|
|
typealias SwiftType = UInt8
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt8 {
|
|
return try lift(readInt(&buf))
|
|
}
|
|
|
|
public static func write(_ value: UInt8, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(value))
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterUInt16: FfiConverterPrimitive {
|
|
typealias FfiType = UInt16
|
|
typealias SwiftType = UInt16
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt16 {
|
|
return try lift(readInt(&buf))
|
|
}
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(value))
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterUInt32: FfiConverterPrimitive {
|
|
typealias FfiType = UInt32
|
|
typealias SwiftType = UInt32
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt32 {
|
|
return try lift(readInt(&buf))
|
|
}
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(value))
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterInt32: FfiConverterPrimitive {
|
|
typealias FfiType = Int32
|
|
typealias SwiftType = Int32
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Int32 {
|
|
return try lift(readInt(&buf))
|
|
}
|
|
|
|
public static func write(_ value: Int32, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(value))
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterUInt64: FfiConverterPrimitive {
|
|
typealias FfiType = UInt64
|
|
typealias SwiftType = UInt64
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt64 {
|
|
return try lift(readInt(&buf))
|
|
}
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(value))
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterInt64: FfiConverterPrimitive {
|
|
typealias FfiType = Int64
|
|
typealias SwiftType = Int64
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Int64 {
|
|
return try lift(readInt(&buf))
|
|
}
|
|
|
|
public static func write(_ value: Int64, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(value))
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterDouble: FfiConverterPrimitive {
|
|
typealias FfiType = Double
|
|
typealias SwiftType = Double
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Double {
|
|
return try lift(readDouble(&buf))
|
|
}
|
|
|
|
public static func write(_ value: Double, into buf: inout [UInt8]) {
|
|
writeDouble(&buf, lower(value))
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterBool : FfiConverter {
|
|
typealias FfiType = Int8
|
|
typealias SwiftType = Bool
|
|
|
|
public static func lift(_ value: Int8) throws -> Bool {
|
|
return value != 0
|
|
}
|
|
|
|
public static func lower(_ value: Bool) -> Int8 {
|
|
return value ? 1 : 0
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bool {
|
|
return try lift(readInt(&buf))
|
|
}
|
|
|
|
public static func write(_ value: Bool, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(value))
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterString: FfiConverter {
|
|
typealias SwiftType = String
|
|
typealias FfiType = RustBuffer
|
|
|
|
public static func lift(_ value: RustBuffer) throws -> String {
|
|
defer {
|
|
value.deallocate()
|
|
}
|
|
if value.data == nil {
|
|
return String()
|
|
}
|
|
let bytes = UnsafeBufferPointer<UInt8>(start: value.data!, count: Int(value.len))
|
|
return String(bytes: bytes, encoding: String.Encoding.utf8)!
|
|
}
|
|
|
|
public static func lower(_ value: String) -> RustBuffer {
|
|
return value.utf8CString.withUnsafeBufferPointer { ptr in
|
|
// The swift string gives us int8_t, we want uint8_t.
|
|
ptr.withMemoryRebound(to: UInt8.self) { ptr in
|
|
// The swift string gives us a trailing null byte, we don't want it.
|
|
let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1))
|
|
return RustBuffer.from(buf)
|
|
}
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String {
|
|
let len: Int32 = try readInt(&buf)
|
|
return String(bytes: try readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)!
|
|
}
|
|
|
|
public static func write(_ value: String, into buf: inout [UInt8]) {
|
|
let len = Int32(value.utf8.count)
|
|
writeInt(&buf, len)
|
|
writeBytes(&buf, value.utf8)
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterData: FfiConverterRustBuffer {
|
|
typealias SwiftType = Data
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Data {
|
|
let len: Int32 = try readInt(&buf)
|
|
return Data(try readBytes(&buf, count: Int(len)))
|
|
}
|
|
|
|
public static func write(_ value: Data, into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
writeBytes(&buf, value)
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterDuration: FfiConverterRustBuffer {
|
|
typealias SwiftType = TimeInterval
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TimeInterval {
|
|
let seconds: UInt64 = try readInt(&buf)
|
|
let nanoseconds: UInt32 = try readInt(&buf)
|
|
return Double(seconds) + (Double(nanoseconds) / 1.0e9)
|
|
}
|
|
|
|
public static func write(_ value: TimeInterval, into buf: inout [UInt8]) {
|
|
if value.rounded(.down) > Double(Int64.max) {
|
|
fatalError("Duration overflow, exceeds max bounds supported by Uniffi")
|
|
}
|
|
|
|
if value < 0 {
|
|
fatalError("Invalid duration, must be non-negative")
|
|
}
|
|
|
|
let seconds = UInt64(value)
|
|
let nanoseconds = UInt32((value - Double(seconds)) * 1.0e9)
|
|
writeInt(&buf, seconds)
|
|
writeInt(&buf, nanoseconds)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol AuthenticationServiceProtocol : AnyObject {
|
|
|
|
/**
|
|
* Updates the service to authenticate with the homeserver for the
|
|
* specified address.
|
|
*/
|
|
func configureHomeserver(serverNameOrHomeserverUrl: String) async throws
|
|
|
|
func homeserverDetails() -> HomeserverLoginDetails?
|
|
|
|
/**
|
|
* Performs a password login using the current homeserver.
|
|
*/
|
|
func login(username: String, password: String, initialDeviceName: String?, deviceId: String?) async throws -> Client
|
|
|
|
/**
|
|
* Completes the OIDC login process.
|
|
*/
|
|
func loginWithOidcCallback(authenticationData: OidcAuthenticationData, callbackUrl: String) async throws -> Client
|
|
|
|
/**
|
|
* Requests the URL needed for login in a web view using OIDC. Once the web
|
|
* view has succeeded, call `login_with_oidc_callback` with the callback it
|
|
* returns.
|
|
*/
|
|
func urlForOidcLogin() async throws -> OidcAuthenticationData
|
|
|
|
}
|
|
|
|
open class AuthenticationService:
|
|
AuthenticationServiceProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_authenticationservice(self.pointer, $0) }
|
|
}
|
|
/**
|
|
* Creates a new service to authenticate a user with.
|
|
*/
|
|
public convenience init(basePath: String, passphrase: String?, userAgent: String?, additionalRootCertificates: [Data], proxy: String?, oidcConfiguration: OidcConfiguration?, customSlidingSyncProxy: String?, sessionDelegate: ClientSessionDelegate?, crossProcessRefreshLockId: String?) {
|
|
self.init(unsafeFromRawPointer: try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_constructor_authenticationservice_new(
|
|
FfiConverterString.lower(basePath),
|
|
FfiConverterOptionString.lower(passphrase),
|
|
FfiConverterOptionString.lower(userAgent),
|
|
FfiConverterSequenceData.lower(additionalRootCertificates),
|
|
FfiConverterOptionString.lower(proxy),
|
|
FfiConverterOptionTypeOidcConfiguration.lower(oidcConfiguration),
|
|
FfiConverterOptionString.lower(customSlidingSyncProxy),
|
|
FfiConverterOptionCallbackInterfaceClientSessionDelegate.lower(sessionDelegate),
|
|
FfiConverterOptionString.lower(crossProcessRefreshLockId),$0)
|
|
})
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_authenticationservice(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Updates the service to authenticate with the homeserver for the
|
|
* specified address.
|
|
*/
|
|
open func configureHomeserver(serverNameOrHomeserverUrl: String) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_authenticationservice_configure_homeserver(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(serverNameOrHomeserverUrl)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeAuthenticationError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func homeserverDetails() -> HomeserverLoginDetails? {
|
|
return try! FfiConverterOptionTypeHomeserverLoginDetails.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_authenticationservice_homeserver_details(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Performs a password login using the current homeserver.
|
|
*/
|
|
open func login(username: String, password: String, initialDeviceName: String?, deviceId: String?) async throws -> Client {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_authenticationservice_login(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(username),
|
|
FfiConverterString.lower(password),
|
|
FfiConverterOptionString.lower(initialDeviceName),
|
|
FfiConverterOptionString.lower(deviceId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeClient.lift,
|
|
errorHandler: FfiConverterTypeAuthenticationError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Completes the OIDC login process.
|
|
*/
|
|
open func loginWithOidcCallback(authenticationData: OidcAuthenticationData, callbackUrl: String) async throws -> Client {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_authenticationservice_login_with_oidc_callback(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterTypeOidcAuthenticationData.lower(authenticationData),
|
|
FfiConverterString.lower(callbackUrl)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeClient.lift,
|
|
errorHandler: FfiConverterTypeAuthenticationError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Requests the URL needed for login in a web view using OIDC. Once the web
|
|
* view has succeeded, call `login_with_oidc_callback` with the callback it
|
|
* returns.
|
|
*/
|
|
open func urlForOidcLogin() async throws -> OidcAuthenticationData {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_authenticationservice_url_for_oidc_login(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeOidcAuthenticationData.lift,
|
|
errorHandler: FfiConverterTypeAuthenticationError.lift
|
|
)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeAuthenticationService: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = AuthenticationService
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> AuthenticationService {
|
|
return AuthenticationService(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: AuthenticationService) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AuthenticationService {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: AuthenticationService, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeAuthenticationService_lift(_ pointer: UnsafeMutableRawPointer) throws -> AuthenticationService {
|
|
return try FfiConverterTypeAuthenticationService.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeAuthenticationService_lower(_ value: AuthenticationService) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeAuthenticationService.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol ClientProtocol : AnyObject {
|
|
|
|
/**
|
|
* Get the content of the event of the given type out of the account data
|
|
* store.
|
|
*
|
|
* It will be returned as a JSON string.
|
|
*/
|
|
func accountData(eventType: String) throws -> String?
|
|
|
|
func accountUrl(action: AccountManagementAction?) throws -> String?
|
|
|
|
func avatarUrl() throws -> String?
|
|
|
|
func cachedAvatarUrl() throws -> String?
|
|
|
|
func createRoom(request: CreateRoomParameters) throws -> String
|
|
|
|
/**
|
|
* Deletes a pusher of given pusher ids
|
|
*/
|
|
func deletePusher(identifiers: PusherIdentifiers) async throws
|
|
|
|
func deviceId() throws -> String
|
|
|
|
func displayName() throws -> String
|
|
|
|
func encryption() -> Encryption
|
|
|
|
func getDmRoom(userId: String) throws -> Room?
|
|
|
|
func getMediaContent(mediaSource: MediaSource) async throws -> Data
|
|
|
|
func getMediaFile(mediaSource: MediaSource, body: String?, mimeType: String, useCache: Bool, tempDir: String?) async throws -> MediaFileHandle
|
|
|
|
func getMediaThumbnail(mediaSource: MediaSource, width: UInt64, height: UInt64) async throws -> Data
|
|
|
|
func getNotificationSettings() -> NotificationSettings
|
|
|
|
func getProfile(userId: String) throws -> UserProfile
|
|
|
|
func getRecentlyVisitedRooms() async throws -> [String]
|
|
|
|
/**
|
|
* Get the preview of a room, to interact with it.
|
|
*/
|
|
func getRoomPreview(roomIdOrAlias: String) async throws -> RoomPreview
|
|
|
|
func getSessionVerificationController() throws -> SessionVerificationController
|
|
|
|
/**
|
|
* The homeserver this client is configured to use.
|
|
*/
|
|
func homeserver() -> String
|
|
|
|
func ignoreUser(userId: String) async throws
|
|
|
|
func ignoredUsers() async throws -> [String]
|
|
|
|
func joinRoomById(roomId: String) async throws -> Room
|
|
|
|
/**
|
|
* Login using a username and password.
|
|
*/
|
|
func login(username: String, password: String, initialDeviceName: String?, deviceId: String?) async throws
|
|
|
|
/**
|
|
* Log out the current user. This method returns an optional URL that
|
|
* should be presented to the user to complete logout (in the case of
|
|
* Session having been authenticated using OIDC).
|
|
*/
|
|
func logout() throws -> String?
|
|
|
|
func notificationClient(processSetup: NotificationProcessSetup) throws -> NotificationClientBuilder
|
|
|
|
func removeAvatar() throws
|
|
|
|
/**
|
|
* Resolves the given room alias to a room id, if possible.
|
|
*/
|
|
func resolveRoomAlias(roomAlias: String) async throws -> String
|
|
|
|
/**
|
|
* Restores the client from a `Session`.
|
|
*/
|
|
func restoreSession(session: Session) throws
|
|
|
|
func roomDirectorySearch() -> RoomDirectorySearch
|
|
|
|
func rooms() -> [Room]
|
|
|
|
func searchUsers(searchTerm: String, limit: UInt64) throws -> SearchUsersResults
|
|
|
|
func session() throws -> Session
|
|
|
|
/**
|
|
* Set the given account data content for the given event type.
|
|
*
|
|
* It should be supplied as a JSON string.
|
|
*/
|
|
func setAccountData(eventType: String, content: String) throws
|
|
|
|
func setDelegate(delegate: ClientDelegate?) -> TaskHandle?
|
|
|
|
func setDisplayName(name: String) throws
|
|
|
|
/**
|
|
* Registers a pusher with given parameters
|
|
*/
|
|
func setPusher(identifiers: PusherIdentifiers, kind: PusherKind, appDisplayName: String, deviceDisplayName: String, profileTag: String?, lang: String) async throws
|
|
|
|
func subscribeToIgnoredUsers(listener: IgnoredUsersListener) -> TaskHandle
|
|
|
|
func syncService() -> SyncServiceBuilder
|
|
|
|
func trackRecentlyVisitedRoom(room: String) async throws
|
|
|
|
func unignoreUser(userId: String) async throws
|
|
|
|
func uploadAvatar(mimeType: String, data: Data) throws
|
|
|
|
func uploadMedia(mimeType: String, data: Data, progressWatcher: ProgressWatcher?) async throws -> String
|
|
|
|
func userId() throws -> String
|
|
|
|
}
|
|
|
|
open class Client:
|
|
ClientProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_client(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_client(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Get the content of the event of the given type out of the account data
|
|
* store.
|
|
*
|
|
* It will be returned as a JSON string.
|
|
*/
|
|
open func accountData(eventType: String) throws -> String? {
|
|
return try FfiConverterOptionString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_account_data(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(eventType),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func accountUrl(action: AccountManagementAction?) throws -> String? {
|
|
return try FfiConverterOptionString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_account_url(self.uniffiClonePointer(),
|
|
FfiConverterOptionTypeAccountManagementAction.lower(action),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func avatarUrl() throws -> String? {
|
|
return try FfiConverterOptionString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_avatar_url(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func cachedAvatarUrl() throws -> String? {
|
|
return try FfiConverterOptionString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_cached_avatar_url(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func createRoom(request: CreateRoomParameters) throws -> String {
|
|
return try FfiConverterString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_create_room(self.uniffiClonePointer(),
|
|
FfiConverterTypeCreateRoomParameters.lower(request),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Deletes a pusher of given pusher ids
|
|
*/
|
|
open func deletePusher(identifiers: PusherIdentifiers) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_delete_pusher(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterTypePusherIdentifiers.lower(identifiers)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func deviceId() throws -> String {
|
|
return try FfiConverterString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_device_id(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func displayName() throws -> String {
|
|
return try FfiConverterString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_display_name(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func encryption() -> Encryption {
|
|
return try! FfiConverterTypeEncryption.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_client_encryption(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func getDmRoom(userId: String) throws -> Room? {
|
|
return try FfiConverterOptionTypeRoom.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_get_dm_room(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func getMediaContent(mediaSource: MediaSource) async throws -> Data {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_get_media_content(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterTypeMediaSource.lower(mediaSource)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterData.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func getMediaFile(mediaSource: MediaSource, body: String?, mimeType: String, useCache: Bool, tempDir: String?) async throws -> MediaFileHandle {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_get_media_file(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterTypeMediaSource.lower(mediaSource),
|
|
FfiConverterOptionString.lower(body),
|
|
FfiConverterString.lower(mimeType),
|
|
FfiConverterBool.lower(useCache),
|
|
FfiConverterOptionString.lower(tempDir)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeMediaFileHandle.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func getMediaThumbnail(mediaSource: MediaSource, width: UInt64, height: UInt64) async throws -> Data {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_get_media_thumbnail(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterTypeMediaSource.lower(mediaSource),
|
|
FfiConverterUInt64.lower(width),
|
|
FfiConverterUInt64.lower(height)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterData.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func getNotificationSettings() -> NotificationSettings {
|
|
return try! FfiConverterTypeNotificationSettings.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_client_get_notification_settings(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func getProfile(userId: String) throws -> UserProfile {
|
|
return try FfiConverterTypeUserProfile.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_get_profile(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func getRecentlyVisitedRooms() async throws -> [String] {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_get_recently_visited_rooms(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterSequenceString.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Get the preview of a room, to interact with it.
|
|
*/
|
|
open func getRoomPreview(roomIdOrAlias: String) async throws -> RoomPreview {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_get_room_preview(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(roomIdOrAlias)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterTypeRoomPreview.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func getSessionVerificationController() throws -> SessionVerificationController {
|
|
return try FfiConverterTypeSessionVerificationController.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_get_session_verification_controller(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* The homeserver this client is configured to use.
|
|
*/
|
|
open func homeserver() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_client_homeserver(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func ignoreUser(userId: String) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_ignore_user(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func ignoredUsers() async throws -> [String] {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_ignored_users(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterSequenceString.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func joinRoomById(roomId: String) async throws -> Room {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_join_room_by_id(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(roomId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeRoom.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Login using a username and password.
|
|
*/
|
|
open func login(username: String, password: String, initialDeviceName: String?, deviceId: String?) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_login(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(username),
|
|
FfiConverterString.lower(password),
|
|
FfiConverterOptionString.lower(initialDeviceName),
|
|
FfiConverterOptionString.lower(deviceId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Log out the current user. This method returns an optional URL that
|
|
* should be presented to the user to complete logout (in the case of
|
|
* Session having been authenticated using OIDC).
|
|
*/
|
|
open func logout() throws -> String? {
|
|
return try FfiConverterOptionString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_logout(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func notificationClient(processSetup: NotificationProcessSetup) throws -> NotificationClientBuilder {
|
|
return try FfiConverterTypeNotificationClientBuilder.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_notification_client(self.uniffiClonePointer(),
|
|
FfiConverterTypeNotificationProcessSetup.lower(processSetup),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func removeAvatar() throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_remove_avatar(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
}
|
|
/**
|
|
* Resolves the given room alias to a room id, if possible.
|
|
*/
|
|
open func resolveRoomAlias(roomAlias: String) async throws -> String {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_resolve_room_alias(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(roomAlias)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterString.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Restores the client from a `Session`.
|
|
*/
|
|
open func restoreSession(session: Session) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_restore_session(self.uniffiClonePointer(),
|
|
FfiConverterTypeSession.lower(session),$0
|
|
)
|
|
}
|
|
}
|
|
open func roomDirectorySearch() -> RoomDirectorySearch {
|
|
return try! FfiConverterTypeRoomDirectorySearch.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_client_room_directory_search(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func rooms() -> [Room] {
|
|
return try! FfiConverterSequenceTypeRoom.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_client_rooms(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func searchUsers(searchTerm: String, limit: UInt64) throws -> SearchUsersResults {
|
|
return try FfiConverterTypeSearchUsersResults.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_search_users(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(searchTerm),
|
|
FfiConverterUInt64.lower(limit),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func session() throws -> Session {
|
|
return try FfiConverterTypeSession.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_session(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Set the given account data content for the given event type.
|
|
*
|
|
* It should be supplied as a JSON string.
|
|
*/
|
|
open func setAccountData(eventType: String, content: String) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_set_account_data(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(eventType),
|
|
FfiConverterString.lower(content),$0
|
|
)
|
|
}
|
|
}
|
|
open func setDelegate(delegate: ClientDelegate?) -> TaskHandle? {
|
|
return try! FfiConverterOptionTypeTaskHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_client_set_delegate(self.uniffiClonePointer(),
|
|
FfiConverterOptionCallbackInterfaceClientDelegate.lower(delegate),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func setDisplayName(name: String) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_set_display_name(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(name),$0
|
|
)
|
|
}
|
|
}
|
|
/**
|
|
* Registers a pusher with given parameters
|
|
*/
|
|
open func setPusher(identifiers: PusherIdentifiers, kind: PusherKind, appDisplayName: String, deviceDisplayName: String, profileTag: String?, lang: String) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_set_pusher(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterTypePusherIdentifiers.lower(identifiers),
|
|
FfiConverterTypePusherKind.lower(kind),
|
|
FfiConverterString.lower(appDisplayName),
|
|
FfiConverterString.lower(deviceDisplayName),
|
|
FfiConverterOptionString.lower(profileTag),
|
|
FfiConverterString.lower(lang)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func subscribeToIgnoredUsers(listener: IgnoredUsersListener) -> TaskHandle {
|
|
return try! FfiConverterTypeTaskHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_client_subscribe_to_ignored_users(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceIgnoredUsersListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func syncService() -> SyncServiceBuilder {
|
|
return try! FfiConverterTypeSyncServiceBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_client_sync_service(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func trackRecentlyVisitedRoom(room: String) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_track_recently_visited_room(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(room)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func unignoreUser(userId: String) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_unignore_user(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func uploadAvatar(mimeType: String, data: Data) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_upload_avatar(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(mimeType),
|
|
FfiConverterData.lower(data),$0
|
|
)
|
|
}
|
|
}
|
|
open func uploadMedia(mimeType: String, data: Data, progressWatcher: ProgressWatcher?) async throws -> String {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_upload_media(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(mimeType),
|
|
FfiConverterData.lower(data),
|
|
FfiConverterOptionCallbackInterfaceProgressWatcher.lower(progressWatcher)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterString.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func userId() throws -> String {
|
|
return try FfiConverterString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_client_user_id(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeClient: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = Client
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> Client {
|
|
return Client(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: Client) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Client {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: Client, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeClient_lift(_ pointer: UnsafeMutableRawPointer) throws -> Client {
|
|
return try FfiConverterTypeClient.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeClient_lower(_ value: Client) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeClient.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol ClientBuilderProtocol : AnyObject {
|
|
|
|
func addRootCertificates(certificates: [Data]) -> ClientBuilder
|
|
|
|
func basePath(path: String) -> ClientBuilder
|
|
|
|
func build() async throws -> Client
|
|
|
|
func disableAutomaticTokenRefresh() -> ClientBuilder
|
|
|
|
func disableSslVerification() -> ClientBuilder
|
|
|
|
func enableCrossProcessRefreshLock(processId: String, sessionDelegate: ClientSessionDelegate) -> ClientBuilder
|
|
|
|
func homeserverUrl(url: String) -> ClientBuilder
|
|
|
|
func passphrase(passphrase: String?) -> ClientBuilder
|
|
|
|
func proxy(url: String) -> ClientBuilder
|
|
|
|
func serverName(serverName: String) -> ClientBuilder
|
|
|
|
func serverNameOrHomeserverUrl(serverNameOrUrl: String) -> ClientBuilder
|
|
|
|
func serverVersions(versions: [String]) -> ClientBuilder
|
|
|
|
func setSessionDelegate(sessionDelegate: ClientSessionDelegate) -> ClientBuilder
|
|
|
|
func slidingSyncProxy(slidingSyncProxy: String?) -> ClientBuilder
|
|
|
|
func userAgent(userAgent: String) -> ClientBuilder
|
|
|
|
func username(username: String) -> ClientBuilder
|
|
|
|
}
|
|
|
|
open class ClientBuilder:
|
|
ClientBuilderProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_clientbuilder(self.pointer, $0) }
|
|
}
|
|
public convenience init() {
|
|
self.init(unsafeFromRawPointer: try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_constructor_clientbuilder_new($0)
|
|
})
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_clientbuilder(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func addRootCertificates(certificates: [Data]) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_add_root_certificates(self.uniffiClonePointer(),
|
|
FfiConverterSequenceData.lower(certificates),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func basePath(path: String) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_base_path(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(path),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func build() async throws -> Client {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_build(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeClient.lift,
|
|
errorHandler: FfiConverterTypeClientBuildError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func disableAutomaticTokenRefresh() -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_disable_automatic_token_refresh(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func disableSslVerification() -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_disable_ssl_verification(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func enableCrossProcessRefreshLock(processId: String, sessionDelegate: ClientSessionDelegate) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_enable_cross_process_refresh_lock(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(processId),
|
|
FfiConverterCallbackInterfaceClientSessionDelegate.lower(sessionDelegate),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func homeserverUrl(url: String) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_homeserver_url(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(url),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func passphrase(passphrase: String?) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_passphrase(self.uniffiClonePointer(),
|
|
FfiConverterOptionString.lower(passphrase),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func proxy(url: String) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_proxy(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(url),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func serverName(serverName: String) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_server_name(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(serverName),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func serverNameOrHomeserverUrl(serverNameOrUrl: String) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_server_name_or_homeserver_url(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(serverNameOrUrl),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func serverVersions(versions: [String]) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_server_versions(self.uniffiClonePointer(),
|
|
FfiConverterSequenceString.lower(versions),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func setSessionDelegate(sessionDelegate: ClientSessionDelegate) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_set_session_delegate(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceClientSessionDelegate.lower(sessionDelegate),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func slidingSyncProxy(slidingSyncProxy: String?) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_sliding_sync_proxy(self.uniffiClonePointer(),
|
|
FfiConverterOptionString.lower(slidingSyncProxy),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func userAgent(userAgent: String) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_user_agent(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userAgent),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func username(username: String) -> ClientBuilder {
|
|
return try! FfiConverterTypeClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_clientbuilder_username(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(username),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeClientBuilder: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = ClientBuilder
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> ClientBuilder {
|
|
return ClientBuilder(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: ClientBuilder) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ClientBuilder {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: ClientBuilder, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeClientBuilder_lift(_ pointer: UnsafeMutableRawPointer) throws -> ClientBuilder {
|
|
return try FfiConverterTypeClientBuilder.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeClientBuilder_lower(_ value: ClientBuilder) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeClientBuilder.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol EncryptionProtocol : AnyObject {
|
|
|
|
/**
|
|
* Does a backup exist on the server?
|
|
*
|
|
* Because the homeserver doesn't notify us about changes to the backup
|
|
* version, the [`BackupState`] and its listener are a bit crippled.
|
|
* The `BackupState::Unknown` state might mean there is no backup at all or
|
|
* a backup exists but we don't have access to it.
|
|
*
|
|
* Therefore it is necessary to poll the server for an answer every time
|
|
* you want to differentiate between those two states.
|
|
*/
|
|
func backupExistsOnServer() async throws -> Bool
|
|
|
|
func backupState() -> BackupState
|
|
|
|
func backupStateListener(listener: BackupStateListener) -> TaskHandle
|
|
|
|
func disableRecovery() async throws
|
|
|
|
func enableBackups() async throws
|
|
|
|
func enableRecovery(waitForBackupsToUpload: Bool, progressListener: EnableRecoveryProgressListener) async throws -> String
|
|
|
|
func isLastDevice() async throws -> Bool
|
|
|
|
func recover(recoveryKey: String) async throws
|
|
|
|
func recoverAndReset(oldRecoveryKey: String) async throws -> String
|
|
|
|
func recoveryState() -> RecoveryState
|
|
|
|
func recoveryStateListener(listener: RecoveryStateListener) -> TaskHandle
|
|
|
|
func resetRecoveryKey() async throws -> String
|
|
|
|
func verificationState() -> VerificationState
|
|
|
|
func verificationStateListener(listener: VerificationStateListener) -> TaskHandle
|
|
|
|
func waitForBackupUploadSteadyState(progressListener: BackupSteadyStateListener?) async throws
|
|
|
|
}
|
|
|
|
open class Encryption:
|
|
EncryptionProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_encryption(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_encryption(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Does a backup exist on the server?
|
|
*
|
|
* Because the homeserver doesn't notify us about changes to the backup
|
|
* version, the [`BackupState`] and its listener are a bit crippled.
|
|
* The `BackupState::Unknown` state might mean there is no backup at all or
|
|
* a backup exists but we don't have access to it.
|
|
*
|
|
* Therefore it is necessary to poll the server for an answer every time
|
|
* you want to differentiate between those two states.
|
|
*/
|
|
open func backupExistsOnServer() async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_backup_exists_on_server(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func backupState() -> BackupState {
|
|
return try! FfiConverterTypeBackupState.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_backup_state(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func backupStateListener(listener: BackupStateListener) -> TaskHandle {
|
|
return try! FfiConverterTypeTaskHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_backup_state_listener(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceBackupStateListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func disableRecovery() async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_disable_recovery(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeRecoveryError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func enableBackups() async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_enable_backups(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeRecoveryError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func enableRecovery(waitForBackupsToUpload: Bool, progressListener: EnableRecoveryProgressListener) async throws -> String {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_enable_recovery(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(waitForBackupsToUpload),
|
|
FfiConverterCallbackInterfaceEnableRecoveryProgressListener.lower(progressListener)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterString.lift,
|
|
errorHandler: FfiConverterTypeRecoveryError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func isLastDevice() async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_is_last_device(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeRecoveryError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func recover(recoveryKey: String) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_recover(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(recoveryKey)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeRecoveryError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func recoverAndReset(oldRecoveryKey: String) async throws -> String {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_recover_and_reset(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(oldRecoveryKey)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterString.lift,
|
|
errorHandler: FfiConverterTypeRecoveryError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func recoveryState() -> RecoveryState {
|
|
return try! FfiConverterTypeRecoveryState.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_recovery_state(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func recoveryStateListener(listener: RecoveryStateListener) -> TaskHandle {
|
|
return try! FfiConverterTypeTaskHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_recovery_state_listener(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceRecoveryStateListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func resetRecoveryKey() async throws -> String {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_reset_recovery_key(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterString.lift,
|
|
errorHandler: FfiConverterTypeRecoveryError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func verificationState() -> VerificationState {
|
|
return try! FfiConverterTypeVerificationState.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_verification_state(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func verificationStateListener(listener: VerificationStateListener) -> TaskHandle {
|
|
return try! FfiConverterTypeTaskHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_verification_state_listener(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceVerificationStateListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func waitForBackupUploadSteadyState(progressListener: BackupSteadyStateListener?) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_encryption_wait_for_backup_upload_steady_state(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterOptionCallbackInterfaceBackupSteadyStateListener.lower(progressListener)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeSteadyStateError.lift
|
|
)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeEncryption: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = Encryption
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> Encryption {
|
|
return Encryption(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: Encryption) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Encryption {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: Encryption, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeEncryption_lift(_ pointer: UnsafeMutableRawPointer) throws -> Encryption {
|
|
return try FfiConverterTypeEncryption.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeEncryption_lower(_ value: Encryption) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeEncryption.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol EventTimelineItemProtocol : AnyObject {
|
|
|
|
func canBeRepliedTo() -> Bool
|
|
|
|
func content() -> TimelineItemContent
|
|
|
|
func debugInfo() -> EventTimelineItemDebugInfo
|
|
|
|
func eventId() -> String?
|
|
|
|
func isEditable() -> Bool
|
|
|
|
func isLocal() -> Bool
|
|
|
|
func isOwn() -> Bool
|
|
|
|
func isRemote() -> Bool
|
|
|
|
func localSendState() -> EventSendState?
|
|
|
|
func origin() -> EventItemOrigin?
|
|
|
|
func reactions() -> [Reaction]
|
|
|
|
func readReceipts() -> [String: Receipt]
|
|
|
|
func sender() -> String
|
|
|
|
func senderProfile() -> ProfileDetails
|
|
|
|
func timestamp() -> UInt64
|
|
|
|
func transactionId() -> String?
|
|
|
|
}
|
|
|
|
open class EventTimelineItem:
|
|
EventTimelineItemProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_eventtimelineitem(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_eventtimelineitem(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func canBeRepliedTo() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_can_be_replied_to(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func content() -> TimelineItemContent {
|
|
return try! FfiConverterTypeTimelineItemContent.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_content(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func debugInfo() -> EventTimelineItemDebugInfo {
|
|
return try! FfiConverterTypeEventTimelineItemDebugInfo.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_debug_info(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func eventId() -> String? {
|
|
return try! FfiConverterOptionString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_event_id(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func isEditable() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_is_editable(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func isLocal() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_is_local(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func isOwn() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_is_own(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func isRemote() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_is_remote(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func localSendState() -> EventSendState? {
|
|
return try! FfiConverterOptionTypeEventSendState.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_local_send_state(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func origin() -> EventItemOrigin? {
|
|
return try! FfiConverterOptionTypeEventItemOrigin.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_origin(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func reactions() -> [Reaction] {
|
|
return try! FfiConverterSequenceTypeReaction.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_reactions(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func readReceipts() -> [String: Receipt] {
|
|
return try! FfiConverterDictionaryStringTypeReceipt.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_read_receipts(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func sender() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_sender(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func senderProfile() -> ProfileDetails {
|
|
return try! FfiConverterTypeProfileDetails.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_sender_profile(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func timestamp() -> UInt64 {
|
|
return try! FfiConverterUInt64.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_timestamp(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func transactionId() -> String? {
|
|
return try! FfiConverterOptionString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_eventtimelineitem_transaction_id(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeEventTimelineItem: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = EventTimelineItem
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> EventTimelineItem {
|
|
return EventTimelineItem(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: EventTimelineItem) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EventTimelineItem {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: EventTimelineItem, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeEventTimelineItem_lift(_ pointer: UnsafeMutableRawPointer) throws -> EventTimelineItem {
|
|
return try FfiConverterTypeEventTimelineItem.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeEventTimelineItem_lower(_ value: EventTimelineItem) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeEventTimelineItem.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol HomeserverLoginDetailsProtocol : AnyObject {
|
|
|
|
/**
|
|
* The URL of the discovered or manually set sliding sync proxy,
|
|
* if any.
|
|
*/
|
|
func slidingSyncProxy() -> String?
|
|
|
|
/**
|
|
* Whether the current homeserver supports login using OIDC.
|
|
*/
|
|
func supportsOidcLogin() -> Bool
|
|
|
|
/**
|
|
* Whether the current homeserver supports the password login flow.
|
|
*/
|
|
func supportsPasswordLogin() -> Bool
|
|
|
|
/**
|
|
* The URL of the currently configured homeserver.
|
|
*/
|
|
func url() -> String
|
|
|
|
}
|
|
|
|
open class HomeserverLoginDetails:
|
|
HomeserverLoginDetailsProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_homeserverlogindetails(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_homeserverlogindetails(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* The URL of the discovered or manually set sliding sync proxy,
|
|
* if any.
|
|
*/
|
|
open func slidingSyncProxy() -> String? {
|
|
return try! FfiConverterOptionString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_sliding_sync_proxy(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Whether the current homeserver supports login using OIDC.
|
|
*/
|
|
open func supportsOidcLogin() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_supports_oidc_login(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Whether the current homeserver supports the password login flow.
|
|
*/
|
|
open func supportsPasswordLogin() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_supports_password_login(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* The URL of the currently configured homeserver.
|
|
*/
|
|
open func url() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_homeserverlogindetails_url(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeHomeserverLoginDetails: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = HomeserverLoginDetails
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> HomeserverLoginDetails {
|
|
return HomeserverLoginDetails(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: HomeserverLoginDetails) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> HomeserverLoginDetails {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: HomeserverLoginDetails, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeHomeserverLoginDetails_lift(_ pointer: UnsafeMutableRawPointer) throws -> HomeserverLoginDetails {
|
|
return try FfiConverterTypeHomeserverLoginDetails.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeHomeserverLoginDetails_lower(_ value: HomeserverLoginDetails) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeHomeserverLoginDetails.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* A file handle that takes ownership of a media file on disk. When the handle
|
|
* is dropped, the file will be removed from the disk.
|
|
*/
|
|
public protocol MediaFileHandleProtocol : AnyObject {
|
|
|
|
/**
|
|
* Get the media file's path.
|
|
*/
|
|
func path() throws -> String
|
|
|
|
func persist(path: String) throws -> Bool
|
|
|
|
}
|
|
|
|
/**
|
|
* A file handle that takes ownership of a media file on disk. When the handle
|
|
* is dropped, the file will be removed from the disk.
|
|
*/
|
|
open class MediaFileHandle:
|
|
MediaFileHandleProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_mediafilehandle(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_mediafilehandle(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Get the media file's path.
|
|
*/
|
|
open func path() throws -> String {
|
|
return try FfiConverterString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_mediafilehandle_path(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func persist(path: String) throws -> Bool {
|
|
return try FfiConverterBool.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_mediafilehandle_persist(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(path),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeMediaFileHandle: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = MediaFileHandle
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> MediaFileHandle {
|
|
return MediaFileHandle(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: MediaFileHandle) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MediaFileHandle {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: MediaFileHandle, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeMediaFileHandle_lift(_ pointer: UnsafeMutableRawPointer) throws -> MediaFileHandle {
|
|
return try FfiConverterTypeMediaFileHandle.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeMediaFileHandle_lower(_ value: MediaFileHandle) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeMediaFileHandle.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol MediaSourceProtocol : AnyObject {
|
|
|
|
func toJson() -> String
|
|
|
|
func url() -> String
|
|
|
|
}
|
|
|
|
open class MediaSource:
|
|
MediaSourceProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_mediasource(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_mediasource(pointer, $0) }
|
|
}
|
|
|
|
|
|
public static func fromJson(json: String) throws -> MediaSource {
|
|
return MediaSource(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_constructor_mediasource_from_json(
|
|
FfiConverterString.lower(json),$0)
|
|
})
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func toJson() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_mediasource_to_json(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func url() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_mediasource_url(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeMediaSource: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = MediaSource
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> MediaSource {
|
|
return MediaSource(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: MediaSource) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MediaSource {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: MediaSource, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeMediaSource_lift(_ pointer: UnsafeMutableRawPointer) throws -> MediaSource {
|
|
return try FfiConverterTypeMediaSource.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeMediaSource_lower(_ value: MediaSource) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeMediaSource.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol MessageProtocol : AnyObject {
|
|
|
|
func body() -> String
|
|
|
|
func inReplyTo() -> InReplyToDetails?
|
|
|
|
func isEdited() -> Bool
|
|
|
|
func isThreaded() -> Bool
|
|
|
|
func msgtype() -> MessageType
|
|
|
|
}
|
|
|
|
open class Message:
|
|
MessageProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_message(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_message(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func body() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_message_body(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func inReplyTo() -> InReplyToDetails? {
|
|
return try! FfiConverterOptionTypeInReplyToDetails.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_message_in_reply_to(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func isEdited() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_message_is_edited(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func isThreaded() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_message_is_threaded(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func msgtype() -> MessageType {
|
|
return try! FfiConverterTypeMessageType.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_message_msgtype(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeMessage: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = Message
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> Message {
|
|
return Message(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: Message) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Message {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: Message, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeMessage_lift(_ pointer: UnsafeMutableRawPointer) throws -> Message {
|
|
return try FfiConverterTypeMessage.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeMessage_lower(_ value: Message) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeMessage.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol NotificationClientProtocol : AnyObject {
|
|
|
|
/**
|
|
* See also documentation of
|
|
* `MatrixNotificationClient::get_notification`.
|
|
*/
|
|
func getNotification(roomId: String, eventId: String) throws -> NotificationItem?
|
|
|
|
}
|
|
|
|
open class NotificationClient:
|
|
NotificationClientProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_notificationclient(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_notificationclient(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* See also documentation of
|
|
* `MatrixNotificationClient::get_notification`.
|
|
*/
|
|
open func getNotification(roomId: String, eventId: String) throws -> NotificationItem? {
|
|
return try FfiConverterOptionTypeNotificationItem.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationclient_get_notification(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(roomId),
|
|
FfiConverterString.lower(eventId),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeNotificationClient: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = NotificationClient
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> NotificationClient {
|
|
return NotificationClient(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: NotificationClient) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationClient {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: NotificationClient, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeNotificationClient_lift(_ pointer: UnsafeMutableRawPointer) throws -> NotificationClient {
|
|
return try FfiConverterTypeNotificationClient.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeNotificationClient_lower(_ value: NotificationClient) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeNotificationClient.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol NotificationClientBuilderProtocol : AnyObject {
|
|
|
|
/**
|
|
* Filter out the notification event according to the push rules present in
|
|
* the event.
|
|
*/
|
|
func filterByPushRules() -> NotificationClientBuilder
|
|
|
|
func finish() -> NotificationClient
|
|
|
|
}
|
|
|
|
open class NotificationClientBuilder:
|
|
NotificationClientBuilderProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_notificationclientbuilder(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_notificationclientbuilder(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Filter out the notification event according to the push rules present in
|
|
* the event.
|
|
*/
|
|
open func filterByPushRules() -> NotificationClientBuilder {
|
|
return try! FfiConverterTypeNotificationClientBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationclientbuilder_filter_by_push_rules(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func finish() -> NotificationClient {
|
|
return try! FfiConverterTypeNotificationClient.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationclientbuilder_finish(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeNotificationClientBuilder: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = NotificationClientBuilder
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> NotificationClientBuilder {
|
|
return NotificationClientBuilder(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: NotificationClientBuilder) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationClientBuilder {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: NotificationClientBuilder, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeNotificationClientBuilder_lift(_ pointer: UnsafeMutableRawPointer) throws -> NotificationClientBuilder {
|
|
return try FfiConverterTypeNotificationClientBuilder.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeNotificationClientBuilder_lower(_ value: NotificationClientBuilder) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeNotificationClientBuilder.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol NotificationSettingsProtocol : AnyObject {
|
|
|
|
/**
|
|
* Check whether [MSC 4028 push rule][rule] is enabled on the homeserver.
|
|
*
|
|
* [rule]: https://github.com/matrix-org/matrix-spec-proposals/blob/giomfo/push_encrypted_events/proposals/4028-push-all-encrypted-events-except-for-muted-rooms.md
|
|
*/
|
|
func canHomeserverPushEncryptedEventToDevice() async -> Bool
|
|
|
|
/**
|
|
* Returns true if [MSC 4028 push rule][rule] is supported and enabled.
|
|
*
|
|
* [rule]: https://github.com/matrix-org/matrix-spec-proposals/blob/giomfo/push_encrypted_events/proposals/4028-push-all-encrypted-events-except-for-muted-rooms.md
|
|
*/
|
|
func canPushEncryptedEventToDevice() async -> Bool
|
|
|
|
/**
|
|
* Get whether some enabled keyword rules exist.
|
|
*/
|
|
func containsKeywordsRules() async -> Bool
|
|
|
|
/**
|
|
* Get the default room notification mode
|
|
*
|
|
* The mode will depend on the associated `PushRule` based on whether the
|
|
* room is encrypted or not, and on the number of members.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `is_encrypted` - whether the room is encrypted
|
|
* * `is_one_to_one` - whether the room is a direct chats involving two
|
|
* people
|
|
*/
|
|
func getDefaultRoomNotificationMode(isEncrypted: Bool, isOneToOne: Bool) async -> RoomNotificationMode
|
|
|
|
/**
|
|
* Get the notification settings for a room.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `room_id` - the room ID
|
|
* * `is_encrypted` - whether the room is encrypted
|
|
* * `is_one_to_one` - whether the room is a direct chat involving two
|
|
* people
|
|
*/
|
|
func getRoomNotificationSettings(roomId: String, isEncrypted: Bool, isOneToOne: Bool) async throws -> RoomNotificationSettings
|
|
|
|
/**
|
|
* Get all room IDs for which a user-defined rule exists.
|
|
*/
|
|
func getRoomsWithUserDefinedRules(enabled: Bool?) async -> [String]
|
|
|
|
/**
|
|
* Get the user defined room notification mode
|
|
*/
|
|
func getUserDefinedRoomNotificationMode(roomId: String) async throws -> RoomNotificationMode?
|
|
|
|
/**
|
|
* Get whether the `.m.rule.call` push rule is enabled
|
|
*/
|
|
func isCallEnabled() async throws -> Bool
|
|
|
|
/**
|
|
* Get whether the `.m.rule.invite_for_me` push rule is enabled
|
|
*/
|
|
func isInviteForMeEnabled() async throws -> Bool
|
|
|
|
/**
|
|
* Get whether room mentions are enabled.
|
|
*/
|
|
func isRoomMentionEnabled() async throws -> Bool
|
|
|
|
/**
|
|
* Get whether user mentions are enabled.
|
|
*/
|
|
func isUserMentionEnabled() async throws -> Bool
|
|
|
|
/**
|
|
* Restore the default notification mode for a room
|
|
*/
|
|
func restoreDefaultRoomNotificationMode(roomId: String) async throws
|
|
|
|
/**
|
|
* Set whether the `.m.rule.call` push rule is enabled
|
|
*/
|
|
func setCallEnabled(enabled: Bool) async throws
|
|
|
|
/**
|
|
* Set the default room notification mode
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `is_encrypted` - whether the mode is for encrypted rooms
|
|
* * `is_one_to_one` - whether the mode is for direct chats involving two
|
|
* people
|
|
* * `mode` - the new default mode
|
|
*/
|
|
func setDefaultRoomNotificationMode(isEncrypted: Bool, isOneToOne: Bool, mode: RoomNotificationMode) async throws
|
|
|
|
func setDelegate(delegate: NotificationSettingsDelegate?)
|
|
|
|
/**
|
|
* Set whether the `.m.rule.invite_for_me` push rule is enabled
|
|
*/
|
|
func setInviteForMeEnabled(enabled: Bool) async throws
|
|
|
|
/**
|
|
* Set whether room mentions are enabled.
|
|
*/
|
|
func setRoomMentionEnabled(enabled: Bool) async throws
|
|
|
|
/**
|
|
* Set the notification mode for a room.
|
|
*/
|
|
func setRoomNotificationMode(roomId: String, mode: RoomNotificationMode) async throws
|
|
|
|
/**
|
|
* Set whether user mentions are enabled.
|
|
*/
|
|
func setUserMentionEnabled(enabled: Bool) async throws
|
|
|
|
/**
|
|
* Unmute a room.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `room_id` - the room to unmute
|
|
* * `is_encrypted` - whether the room is encrypted
|
|
* * `is_one_to_one` - whether the room is a direct chat involving two
|
|
* people
|
|
*/
|
|
func unmuteRoom(roomId: String, isEncrypted: Bool, isOneToOne: Bool) async throws
|
|
|
|
}
|
|
|
|
open class NotificationSettings:
|
|
NotificationSettingsProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_notificationsettings(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_notificationsettings(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Check whether [MSC 4028 push rule][rule] is enabled on the homeserver.
|
|
*
|
|
* [rule]: https://github.com/matrix-org/matrix-spec-proposals/blob/giomfo/push_encrypted_events/proposals/4028-push-all-encrypted-events-except-for-muted-rooms.md
|
|
*/
|
|
open func canHomeserverPushEncryptedEventToDevice() async -> Bool {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_can_homeserver_push_encrypted_event_to_device(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Returns true if [MSC 4028 push rule][rule] is supported and enabled.
|
|
*
|
|
* [rule]: https://github.com/matrix-org/matrix-spec-proposals/blob/giomfo/push_encrypted_events/proposals/4028-push-all-encrypted-events-except-for-muted-rooms.md
|
|
*/
|
|
open func canPushEncryptedEventToDevice() async -> Bool {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_can_push_encrypted_event_to_device(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Get whether some enabled keyword rules exist.
|
|
*/
|
|
open func containsKeywordsRules() async -> Bool {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_contains_keywords_rules(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Get the default room notification mode
|
|
*
|
|
* The mode will depend on the associated `PushRule` based on whether the
|
|
* room is encrypted or not, and on the number of members.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `is_encrypted` - whether the room is encrypted
|
|
* * `is_one_to_one` - whether the room is a direct chats involving two
|
|
* people
|
|
*/
|
|
open func getDefaultRoomNotificationMode(isEncrypted: Bool, isOneToOne: Bool) async -> RoomNotificationMode {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_get_default_room_notification_mode(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(isEncrypted),
|
|
FfiConverterBool.lower(isOneToOne)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterTypeRoomNotificationMode.lift,
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Get the notification settings for a room.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `room_id` - the room ID
|
|
* * `is_encrypted` - whether the room is encrypted
|
|
* * `is_one_to_one` - whether the room is a direct chat involving two
|
|
* people
|
|
*/
|
|
open func getRoomNotificationSettings(roomId: String, isEncrypted: Bool, isOneToOne: Bool) async throws -> RoomNotificationSettings {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_get_room_notification_settings(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(roomId),
|
|
FfiConverterBool.lower(isEncrypted),
|
|
FfiConverterBool.lower(isOneToOne)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterTypeRoomNotificationSettings.lift,
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Get all room IDs for which a user-defined rule exists.
|
|
*/
|
|
open func getRoomsWithUserDefinedRules(enabled: Bool?) async -> [String] {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_get_rooms_with_user_defined_rules(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterOptionBool.lower(enabled)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterSequenceString.lift,
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Get the user defined room notification mode
|
|
*/
|
|
open func getUserDefinedRoomNotificationMode(roomId: String) async throws -> RoomNotificationMode? {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_get_user_defined_room_notification_mode(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(roomId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterOptionTypeRoomNotificationMode.lift,
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Get whether the `.m.rule.call` push rule is enabled
|
|
*/
|
|
open func isCallEnabled() async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_is_call_enabled(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Get whether the `.m.rule.invite_for_me` push rule is enabled
|
|
*/
|
|
open func isInviteForMeEnabled() async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_is_invite_for_me_enabled(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Get whether room mentions are enabled.
|
|
*/
|
|
open func isRoomMentionEnabled() async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_is_room_mention_enabled(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Get whether user mentions are enabled.
|
|
*/
|
|
open func isUserMentionEnabled() async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_is_user_mention_enabled(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Restore the default notification mode for a room
|
|
*/
|
|
open func restoreDefaultRoomNotificationMode(roomId: String) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_restore_default_room_notification_mode(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(roomId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Set whether the `.m.rule.call` push rule is enabled
|
|
*/
|
|
open func setCallEnabled(enabled: Bool) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_set_call_enabled(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(enabled)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Set the default room notification mode
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `is_encrypted` - whether the mode is for encrypted rooms
|
|
* * `is_one_to_one` - whether the mode is for direct chats involving two
|
|
* people
|
|
* * `mode` - the new default mode
|
|
*/
|
|
open func setDefaultRoomNotificationMode(isEncrypted: Bool, isOneToOne: Bool, mode: RoomNotificationMode) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_set_default_room_notification_mode(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(isEncrypted),
|
|
FfiConverterBool.lower(isOneToOne),
|
|
FfiConverterTypeRoomNotificationMode.lower(mode)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func setDelegate(delegate: NotificationSettingsDelegate?) {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_set_delegate(self.uniffiClonePointer(),
|
|
FfiConverterOptionCallbackInterfaceNotificationSettingsDelegate.lower(delegate),$0
|
|
)
|
|
}
|
|
}
|
|
/**
|
|
* Set whether the `.m.rule.invite_for_me` push rule is enabled
|
|
*/
|
|
open func setInviteForMeEnabled(enabled: Bool) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_set_invite_for_me_enabled(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(enabled)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Set whether room mentions are enabled.
|
|
*/
|
|
open func setRoomMentionEnabled(enabled: Bool) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_set_room_mention_enabled(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(enabled)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Set the notification mode for a room.
|
|
*/
|
|
open func setRoomNotificationMode(roomId: String, mode: RoomNotificationMode) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_set_room_notification_mode(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(roomId),
|
|
FfiConverterTypeRoomNotificationMode.lower(mode)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Set whether user mentions are enabled.
|
|
*/
|
|
open func setUserMentionEnabled(enabled: Bool) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_set_user_mention_enabled(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(enabled)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Unmute a room.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `room_id` - the room to unmute
|
|
* * `is_encrypted` - whether the room is encrypted
|
|
* * `is_one_to_one` - whether the room is a direct chat involving two
|
|
* people
|
|
*/
|
|
open func unmuteRoom(roomId: String, isEncrypted: Bool, isOneToOne: Bool) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_notificationsettings_unmute_room(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(roomId),
|
|
FfiConverterBool.lower(isEncrypted),
|
|
FfiConverterBool.lower(isOneToOne)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeNotificationSettingsError.lift
|
|
)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeNotificationSettings: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = NotificationSettings
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> NotificationSettings {
|
|
return NotificationSettings(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: NotificationSettings) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationSettings {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: NotificationSettings, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeNotificationSettings_lift(_ pointer: UnsafeMutableRawPointer) throws -> NotificationSettings {
|
|
return try FfiConverterTypeNotificationSettings.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeNotificationSettings_lower(_ value: NotificationSettings) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeNotificationSettings.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* The data required to authenticate against an OIDC server.
|
|
*/
|
|
public protocol OidcAuthenticationDataProtocol : AnyObject {
|
|
|
|
/**
|
|
* The login URL to use for authentication.
|
|
*/
|
|
func loginUrl() -> String
|
|
|
|
}
|
|
|
|
/**
|
|
* The data required to authenticate against an OIDC server.
|
|
*/
|
|
open class OidcAuthenticationData:
|
|
OidcAuthenticationDataProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_oidcauthenticationdata(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_oidcauthenticationdata(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* The login URL to use for authentication.
|
|
*/
|
|
open func loginUrl() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_oidcauthenticationdata_login_url(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeOidcAuthenticationData: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = OidcAuthenticationData
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> OidcAuthenticationData {
|
|
return OidcAuthenticationData(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: OidcAuthenticationData) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OidcAuthenticationData {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: OidcAuthenticationData, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeOidcAuthenticationData_lift(_ pointer: UnsafeMutableRawPointer) throws -> OidcAuthenticationData {
|
|
return try FfiConverterTypeOidcAuthenticationData.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeOidcAuthenticationData_lower(_ value: OidcAuthenticationData) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeOidcAuthenticationData.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomProtocol : AnyObject {
|
|
|
|
func activeMembersCount() -> UInt64
|
|
|
|
/**
|
|
* Returns a Vec of userId's that participate in the room call.
|
|
*
|
|
* matrix_rtc memberships with application "m.call" and scope "m.room" are
|
|
* considered. A user can occur twice if they join with two devices.
|
|
* convert to a set depending if the different users are required or the
|
|
* amount of sessions.
|
|
*
|
|
* The vector is ordered by oldest membership user to newest.
|
|
*/
|
|
func activeRoomCallParticipants() -> [String]
|
|
|
|
func alternativeAliases() -> [String]
|
|
|
|
func applyPowerLevelChanges(changes: RoomPowerLevelChanges) async throws
|
|
|
|
func avatarUrl() -> String?
|
|
|
|
func banUser(userId: String, reason: String?) async throws
|
|
|
|
func canUserBan(userId: String) async throws -> Bool
|
|
|
|
func canUserInvite(userId: String) async throws -> Bool
|
|
|
|
func canUserKick(userId: String) async throws -> Bool
|
|
|
|
func canUserRedactOther(userId: String) async throws -> Bool
|
|
|
|
func canUserRedactOwn(userId: String) async throws -> Bool
|
|
|
|
func canUserSendMessage(userId: String, message: MessageLikeEventType) async throws -> Bool
|
|
|
|
func canUserSendState(userId: String, stateEvent: StateEventType) async throws -> Bool
|
|
|
|
func canUserTriggerRoomNotification(userId: String) async throws -> Bool
|
|
|
|
func canonicalAlias() -> String?
|
|
|
|
/**
|
|
* Forces the currently active room key, which is used to encrypt messages,
|
|
* to be rotated.
|
|
*
|
|
* A new room key will be crated and shared with all the room members the
|
|
* next time a message will be sent. You don't have to call this method,
|
|
* room keys will be rotated automatically when necessary. This method is
|
|
* still useful for debugging purposes.
|
|
*/
|
|
func discardRoomKey() async throws
|
|
|
|
func displayName() throws -> String
|
|
|
|
func getPowerLevels() async throws -> RoomPowerLevels
|
|
|
|
/**
|
|
* Is there a non expired membership with application "m.call" and scope
|
|
* "m.room" in this room.
|
|
*/
|
|
func hasActiveRoomCall() -> Bool
|
|
|
|
func id() -> String
|
|
|
|
/**
|
|
* Ignores a user.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `user_id` - The ID of the user to ignore.
|
|
*/
|
|
func ignoreUser(userId: String) async throws
|
|
|
|
func inviteUserById(userId: String) throws
|
|
|
|
func invitedMembersCount() -> UInt64
|
|
|
|
func inviter() -> RoomMember?
|
|
|
|
func isDirect() -> Bool
|
|
|
|
func isEncrypted() throws -> Bool
|
|
|
|
func isPublic() -> Bool
|
|
|
|
func isSpace() -> Bool
|
|
|
|
func isTombstoned() -> Bool
|
|
|
|
/**
|
|
* Join this room.
|
|
*
|
|
* Only invited and left rooms can be joined via this method.
|
|
*/
|
|
func join() throws
|
|
|
|
func joinedMembersCount() -> UInt64
|
|
|
|
func kickUser(userId: String, reason: String?) async throws
|
|
|
|
/**
|
|
* Leave this room.
|
|
*
|
|
* Only invited and joined rooms can be left.
|
|
*/
|
|
func leave() throws
|
|
|
|
/**
|
|
* Mark a room as read, by attaching a read receipt on the latest event.
|
|
*
|
|
* Note: this does NOT unset the unread flag; it's the caller's
|
|
* responsibility to do so, if needs be.
|
|
*/
|
|
func markAsRead(receiptType: ReceiptType) async throws
|
|
|
|
func matrixToEventPermalink(eventId: String) async throws -> String
|
|
|
|
func matrixToPermalink() async throws -> String
|
|
|
|
func member(userId: String) async throws -> RoomMember
|
|
|
|
func memberAvatarUrl(userId: String) throws -> String?
|
|
|
|
func memberDisplayName(userId: String) throws -> String?
|
|
|
|
func members() async throws -> RoomMembersIterator
|
|
|
|
func membersNoSync() async throws -> RoomMembersIterator
|
|
|
|
func membership() -> Membership
|
|
|
|
func name() -> String?
|
|
|
|
func ownUserId() -> String
|
|
|
|
/**
|
|
* Redacts an event from the room.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `event_id` - The ID of the event to redact
|
|
*
|
|
* * `reason` - The reason for the event being redacted (optional).
|
|
* its transaction ID (optional). If not given one is created.
|
|
*/
|
|
func redact(eventId: String, reason: String?) throws
|
|
|
|
/**
|
|
* Removes the current room avatar
|
|
*/
|
|
func removeAvatar() throws
|
|
|
|
/**
|
|
* Reports an event from the room.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `event_id` - The ID of the event to report
|
|
*
|
|
* * `reason` - The reason for the event being reported (optional).
|
|
*
|
|
* * `score` - The score to rate this content as where -100 is most
|
|
* offensive and 0 is inoffensive (optional).
|
|
*/
|
|
func reportContent(eventId: String, score: Int32?, reason: String?) throws
|
|
|
|
func resetPowerLevels() async throws -> RoomPowerLevels
|
|
|
|
func roomInfo() async throws -> RoomInfo
|
|
|
|
func setIsFavourite(isFavourite: Bool, tagOrder: Double?) async throws
|
|
|
|
func setIsLowPriority(isLowPriority: Bool, tagOrder: Double?) async throws
|
|
|
|
/**
|
|
* Sets a new name to the room.
|
|
*/
|
|
func setName(name: String) throws
|
|
|
|
/**
|
|
* Sets a new topic in the room.
|
|
*/
|
|
func setTopic(topic: String) throws
|
|
|
|
/**
|
|
* Set (or unset) a flag on the room to indicate that the user has
|
|
* explicitly marked it as unread.
|
|
*/
|
|
func setUnreadFlag(newValue: Bool) async throws
|
|
|
|
func subscribeToRoomInfoUpdates(listener: RoomInfoListener) -> TaskHandle
|
|
|
|
func subscribeToTypingNotifications(listener: TypingNotificationsListener) -> TaskHandle
|
|
|
|
func suggestedRoleForUser(userId: String) async throws -> RoomMemberRole
|
|
|
|
func timeline() async throws -> Timeline
|
|
|
|
func topic() -> String?
|
|
|
|
func typingNotice(isTyping: Bool) async throws
|
|
|
|
func unbanUser(userId: String, reason: String?) async throws
|
|
|
|
func updatePowerLevelsForUsers(updates: [UserPowerLevelUpdate]) async throws
|
|
|
|
/**
|
|
* Upload and set the room's avatar.
|
|
*
|
|
* This will upload the data produced by the reader to the homeserver's
|
|
* content repository, and set the room's avatar to the MXC URI for the
|
|
* uploaded file.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `mime_type` - The mime description of the avatar, for example
|
|
* image/jpeg
|
|
* * `data` - The raw data that will be uploaded to the homeserver's
|
|
* content repository
|
|
* * `media_info` - The media info used as avatar image info.
|
|
*/
|
|
func uploadAvatar(mimeType: String, data: Data, mediaInfo: ImageInfo?) throws
|
|
|
|
}
|
|
|
|
open class Room:
|
|
RoomProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_room(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_room(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func activeMembersCount() -> UInt64 {
|
|
return try! FfiConverterUInt64.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_active_members_count(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Returns a Vec of userId's that participate in the room call.
|
|
*
|
|
* matrix_rtc memberships with application "m.call" and scope "m.room" are
|
|
* considered. A user can occur twice if they join with two devices.
|
|
* convert to a set depending if the different users are required or the
|
|
* amount of sessions.
|
|
*
|
|
* The vector is ordered by oldest membership user to newest.
|
|
*/
|
|
open func activeRoomCallParticipants() -> [String] {
|
|
return try! FfiConverterSequenceString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_active_room_call_participants(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func alternativeAliases() -> [String] {
|
|
return try! FfiConverterSequenceString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_alternative_aliases(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func applyPowerLevelChanges(changes: RoomPowerLevelChanges) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_apply_power_level_changes(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterTypeRoomPowerLevelChanges_lower(changes)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func avatarUrl() -> String? {
|
|
return try! FfiConverterOptionString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_avatar_url(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func banUser(userId: String, reason: String?) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_ban_user(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId),
|
|
FfiConverterOptionString.lower(reason)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func canUserBan(userId: String) async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_can_user_ban(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func canUserInvite(userId: String) async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_can_user_invite(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func canUserKick(userId: String) async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_can_user_kick(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func canUserRedactOther(userId: String) async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_can_user_redact_other(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func canUserRedactOwn(userId: String) async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_can_user_redact_own(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func canUserSendMessage(userId: String, message: MessageLikeEventType) async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_can_user_send_message(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId),
|
|
FfiConverterTypeMessageLikeEventType.lower(message)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func canUserSendState(userId: String, stateEvent: StateEventType) async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_can_user_send_state(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId),
|
|
FfiConverterTypeStateEventType.lower(stateEvent)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func canUserTriggerRoomNotification(userId: String) async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_can_user_trigger_room_notification(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func canonicalAlias() -> String? {
|
|
return try! FfiConverterOptionString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_canonical_alias(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Forces the currently active room key, which is used to encrypt messages,
|
|
* to be rotated.
|
|
*
|
|
* A new room key will be crated and shared with all the room members the
|
|
* next time a message will be sent. You don't have to call this method,
|
|
* room keys will be rotated automatically when necessary. This method is
|
|
* still useful for debugging purposes.
|
|
*/
|
|
open func discardRoomKey() async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_discard_room_key(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func displayName() throws -> String {
|
|
return try FfiConverterString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_display_name(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func getPowerLevels() async throws -> RoomPowerLevels {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_get_power_levels(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterTypeRoomPowerLevels.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Is there a non expired membership with application "m.call" and scope
|
|
* "m.room" in this room.
|
|
*/
|
|
open func hasActiveRoomCall() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_has_active_room_call(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func id() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_id(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Ignores a user.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `user_id` - The ID of the user to ignore.
|
|
*/
|
|
open func ignoreUser(userId: String) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_ignore_user(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func inviteUserById(userId: String) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_invite_user_by_id(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId),$0
|
|
)
|
|
}
|
|
}
|
|
open func invitedMembersCount() -> UInt64 {
|
|
return try! FfiConverterUInt64.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_invited_members_count(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func inviter() -> RoomMember? {
|
|
return try! FfiConverterOptionTypeRoomMember.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_inviter(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func isDirect() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_is_direct(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func isEncrypted() throws -> Bool {
|
|
return try FfiConverterBool.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_is_encrypted(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func isPublic() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_is_public(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func isSpace() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_is_space(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func isTombstoned() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_is_tombstoned(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Join this room.
|
|
*
|
|
* Only invited and left rooms can be joined via this method.
|
|
*/
|
|
open func join() throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_join(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
}
|
|
open func joinedMembersCount() -> UInt64 {
|
|
return try! FfiConverterUInt64.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_joined_members_count(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func kickUser(userId: String, reason: String?) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_kick_user(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId),
|
|
FfiConverterOptionString.lower(reason)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Leave this room.
|
|
*
|
|
* Only invited and joined rooms can be left.
|
|
*/
|
|
open func leave() throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_leave(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
}
|
|
/**
|
|
* Mark a room as read, by attaching a read receipt on the latest event.
|
|
*
|
|
* Note: this does NOT unset the unread flag; it's the caller's
|
|
* responsibility to do so, if needs be.
|
|
*/
|
|
open func markAsRead(receiptType: ReceiptType) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_mark_as_read(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterTypeReceiptType.lower(receiptType)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func matrixToEventPermalink(eventId: String) async throws -> String {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_matrix_to_event_permalink(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(eventId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterString.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func matrixToPermalink() async throws -> String {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_matrix_to_permalink(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterString.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func member(userId: String) async throws -> RoomMember {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_member(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterTypeRoomMember.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func memberAvatarUrl(userId: String) throws -> String? {
|
|
return try FfiConverterOptionString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_member_avatar_url(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func memberDisplayName(userId: String) throws -> String? {
|
|
return try FfiConverterOptionString.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_member_display_name(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func members() async throws -> RoomMembersIterator {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_members(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeRoomMembersIterator.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func membersNoSync() async throws -> RoomMembersIterator {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_members_no_sync(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeRoomMembersIterator.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func membership() -> Membership {
|
|
return try! FfiConverterTypeMembership.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_membership(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func name() -> String? {
|
|
return try! FfiConverterOptionString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_name(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func ownUserId() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_own_user_id(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Redacts an event from the room.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `event_id` - The ID of the event to redact
|
|
*
|
|
* * `reason` - The reason for the event being redacted (optional).
|
|
* its transaction ID (optional). If not given one is created.
|
|
*/
|
|
open func redact(eventId: String, reason: String?) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_redact(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(eventId),
|
|
FfiConverterOptionString.lower(reason),$0
|
|
)
|
|
}
|
|
}
|
|
/**
|
|
* Removes the current room avatar
|
|
*/
|
|
open func removeAvatar() throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_remove_avatar(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
}
|
|
/**
|
|
* Reports an event from the room.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `event_id` - The ID of the event to report
|
|
*
|
|
* * `reason` - The reason for the event being reported (optional).
|
|
*
|
|
* * `score` - The score to rate this content as where -100 is most
|
|
* offensive and 0 is inoffensive (optional).
|
|
*/
|
|
open func reportContent(eventId: String, score: Int32?, reason: String?) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_report_content(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(eventId),
|
|
FfiConverterOptionInt32.lower(score),
|
|
FfiConverterOptionString.lower(reason),$0
|
|
)
|
|
}
|
|
}
|
|
open func resetPowerLevels() async throws -> RoomPowerLevels {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_reset_power_levels(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterTypeRoomPowerLevels.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func roomInfo() async throws -> RoomInfo {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_room_info(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterTypeRoomInfo.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func setIsFavourite(isFavourite: Bool, tagOrder: Double?) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_set_is_favourite(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(isFavourite),
|
|
FfiConverterOptionDouble.lower(tagOrder)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func setIsLowPriority(isLowPriority: Bool, tagOrder: Double?) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_set_is_low_priority(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(isLowPriority),
|
|
FfiConverterOptionDouble.lower(tagOrder)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Sets a new name to the room.
|
|
*/
|
|
open func setName(name: String) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_set_name(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(name),$0
|
|
)
|
|
}
|
|
}
|
|
/**
|
|
* Sets a new topic in the room.
|
|
*/
|
|
open func setTopic(topic: String) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_set_topic(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(topic),$0
|
|
)
|
|
}
|
|
}
|
|
/**
|
|
* Set (or unset) a flag on the room to indicate that the user has
|
|
* explicitly marked it as unread.
|
|
*/
|
|
open func setUnreadFlag(newValue: Bool) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_set_unread_flag(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(newValue)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func subscribeToRoomInfoUpdates(listener: RoomInfoListener) -> TaskHandle {
|
|
return try! FfiConverterTypeTaskHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_subscribe_to_room_info_updates(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceRoomInfoListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func subscribeToTypingNotifications(listener: TypingNotificationsListener) -> TaskHandle {
|
|
return try! FfiConverterTypeTaskHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_subscribe_to_typing_notifications(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceTypingNotificationsListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func suggestedRoleForUser(userId: String) async throws -> RoomMemberRole {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_suggested_role_for_user(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterTypeRoomMemberRole_lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func timeline() async throws -> Timeline {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_timeline(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeTimeline.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func topic() -> String? {
|
|
return try! FfiConverterOptionString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_room_topic(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func typingNotice(isTyping: Bool) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_typing_notice(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(isTyping)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func unbanUser(userId: String, reason: String?) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_unban_user(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(userId),
|
|
FfiConverterOptionString.lower(reason)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func updatePowerLevelsForUsers(updates: [UserPowerLevelUpdate]) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_update_power_levels_for_users(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterSequenceTypeUserPowerLevelUpdate.lower(updates)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Upload and set the room's avatar.
|
|
*
|
|
* This will upload the data produced by the reader to the homeserver's
|
|
* content repository, and set the room's avatar to the MXC URI for the
|
|
* uploaded file.
|
|
*
|
|
* # Arguments
|
|
*
|
|
* * `mime_type` - The mime description of the avatar, for example
|
|
* image/jpeg
|
|
* * `data` - The raw data that will be uploaded to the homeserver's
|
|
* content repository
|
|
* * `media_info` - The media info used as avatar image info.
|
|
*/
|
|
open func uploadAvatar(mimeType: String, data: Data, mediaInfo: ImageInfo?) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_room_upload_avatar(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(mimeType),
|
|
FfiConverterData.lower(data),
|
|
FfiConverterOptionTypeImageInfo.lower(mediaInfo),$0
|
|
)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeRoom: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = Room
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> Room {
|
|
return Room(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: Room) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Room {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: Room, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeRoom_lift(_ pointer: UnsafeMutableRawPointer) throws -> Room {
|
|
return try FfiConverterTypeRoom.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeRoom_lower(_ value: Room) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeRoom.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomDirectorySearchProtocol : AnyObject {
|
|
|
|
func isAtLastPage() async throws -> Bool
|
|
|
|
func loadedPages() async throws -> UInt32
|
|
|
|
func nextPage() async throws
|
|
|
|
func results(listener: RoomDirectorySearchEntriesListener) async -> TaskHandle
|
|
|
|
func search(filter: String?, batchSize: UInt32) async throws
|
|
|
|
}
|
|
|
|
open class RoomDirectorySearch:
|
|
RoomDirectorySearchProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_roomdirectorysearch(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_roomdirectorysearch(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func isAtLastPage() async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomdirectorysearch_is_at_last_page(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func loadedPages() async throws -> UInt32 {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomdirectorysearch_loaded_pages(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_u32,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_u32,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_u32,
|
|
liftFunc: FfiConverterUInt32.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func nextPage() async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomdirectorysearch_next_page(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func results(listener: RoomDirectorySearchEntriesListener) async -> TaskHandle {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomdirectorysearch_results(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceRoomDirectorySearchEntriesListener.lower(listener)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeTaskHandle.lift,
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
open func search(filter: String?, batchSize: UInt32) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomdirectorysearch_search(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterOptionString.lower(filter),
|
|
FfiConverterUInt32.lower(batchSize)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeRoomDirectorySearch: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = RoomDirectorySearch
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomDirectorySearch {
|
|
return RoomDirectorySearch(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: RoomDirectorySearch) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomDirectorySearch {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: RoomDirectorySearch, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeRoomDirectorySearch_lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomDirectorySearch {
|
|
return try FfiConverterTypeRoomDirectorySearch.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomDirectorySearch_lower(_ value: RoomDirectorySearch) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeRoomDirectorySearch.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomListProtocol : AnyObject {
|
|
|
|
func entries(listener: RoomListEntriesListener) -> RoomListEntriesResult
|
|
|
|
func entriesWithDynamicAdapters(pageSize: UInt32, listener: RoomListEntriesListener) -> RoomListEntriesWithDynamicAdaptersResult
|
|
|
|
func loadingState(listener: RoomListLoadingStateListener) throws -> RoomListLoadingStateResult
|
|
|
|
func room(roomId: String) throws -> RoomListItem
|
|
|
|
}
|
|
|
|
open class RoomList:
|
|
RoomListProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_roomlist(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_roomlist(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func entries(listener: RoomListEntriesListener) -> RoomListEntriesResult {
|
|
return try! FfiConverterTypeRoomListEntriesResult.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlist_entries(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceRoomListEntriesListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func entriesWithDynamicAdapters(pageSize: UInt32, listener: RoomListEntriesListener) -> RoomListEntriesWithDynamicAdaptersResult {
|
|
return try! FfiConverterTypeRoomListEntriesWithDynamicAdaptersResult.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlist_entries_with_dynamic_adapters(self.uniffiClonePointer(),
|
|
FfiConverterUInt32.lower(pageSize),
|
|
FfiConverterCallbackInterfaceRoomListEntriesListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func loadingState(listener: RoomListLoadingStateListener) throws -> RoomListLoadingStateResult {
|
|
return try FfiConverterTypeRoomListLoadingStateResult.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeRoomListError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlist_loading_state(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceRoomListLoadingStateListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func room(roomId: String) throws -> RoomListItem {
|
|
return try FfiConverterTypeRoomListItem.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeRoomListError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlist_room(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(roomId),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeRoomList: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = RoomList
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomList {
|
|
return RoomList(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: RoomList) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomList {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: RoomList, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeRoomList_lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomList {
|
|
return try FfiConverterTypeRoomList.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomList_lower(_ value: RoomList) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeRoomList.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomListDynamicEntriesControllerProtocol : AnyObject {
|
|
|
|
func addOnePage()
|
|
|
|
func resetToOnePage()
|
|
|
|
func setFilter(kind: RoomListEntriesDynamicFilterKind) -> Bool
|
|
|
|
}
|
|
|
|
open class RoomListDynamicEntriesController:
|
|
RoomListDynamicEntriesControllerProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_roomlistdynamicentriescontroller(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_roomlistdynamicentriescontroller(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func addOnePage() {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistdynamicentriescontroller_add_one_page(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
}
|
|
open func resetToOnePage() {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistdynamicentriescontroller_reset_to_one_page(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
}
|
|
open func setFilter(kind: RoomListEntriesDynamicFilterKind) -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistdynamicentriescontroller_set_filter(self.uniffiClonePointer(),
|
|
FfiConverterTypeRoomListEntriesDynamicFilterKind.lower(kind),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeRoomListDynamicEntriesController: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = RoomListDynamicEntriesController
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomListDynamicEntriesController {
|
|
return RoomListDynamicEntriesController(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: RoomListDynamicEntriesController) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListDynamicEntriesController {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: RoomListDynamicEntriesController, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeRoomListDynamicEntriesController_lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomListDynamicEntriesController {
|
|
return try FfiConverterTypeRoomListDynamicEntriesController.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListDynamicEntriesController_lower(_ value: RoomListDynamicEntriesController) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeRoomListDynamicEntriesController.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomListItemProtocol : AnyObject {
|
|
|
|
func avatarUrl() -> String?
|
|
|
|
func canonicalAlias() -> String?
|
|
|
|
/**
|
|
* Building a `Room`. If its internal timeline hasn't been initialized
|
|
* it'll fail.
|
|
*/
|
|
func fullRoom() async throws -> Room
|
|
|
|
func id() -> String
|
|
|
|
/**
|
|
* Initializes the timeline for this room using the provided parameters.
|
|
*
|
|
* * `event_type_filter` - An optional [`TimelineEventTypeFilter`] to be
|
|
* used to filter timeline events besides the default timeline filter. If
|
|
* `None` is passed, only the default timeline filter will be used.
|
|
*/
|
|
func initTimeline(eventTypeFilter: TimelineEventTypeFilter?) async throws
|
|
|
|
func isDirect() -> Bool
|
|
|
|
/**
|
|
* Checks whether the Room's timeline has been initialized before.
|
|
*/
|
|
func isTimelineInitialized() -> Bool
|
|
|
|
func latestEvent() async -> EventTimelineItem?
|
|
|
|
func name() -> String?
|
|
|
|
func roomInfo() async throws -> RoomInfo
|
|
|
|
func subscribe(settings: RoomSubscription?)
|
|
|
|
func unsubscribe()
|
|
|
|
}
|
|
|
|
open class RoomListItem:
|
|
RoomListItemProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_roomlistitem(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_roomlistitem(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func avatarUrl() -> String? {
|
|
return try! FfiConverterOptionString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_avatar_url(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func canonicalAlias() -> String? {
|
|
return try! FfiConverterOptionString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_canonical_alias(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Building a `Room`. If its internal timeline hasn't been initialized
|
|
* it'll fail.
|
|
*/
|
|
open func fullRoom() async throws -> Room {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_full_room(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeRoom.lift,
|
|
errorHandler: FfiConverterTypeRoomListError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func id() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_id(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Initializes the timeline for this room using the provided parameters.
|
|
*
|
|
* * `event_type_filter` - An optional [`TimelineEventTypeFilter`] to be
|
|
* used to filter timeline events besides the default timeline filter. If
|
|
* `None` is passed, only the default timeline filter will be used.
|
|
*/
|
|
open func initTimeline(eventTypeFilter: TimelineEventTypeFilter?) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_init_timeline(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterOptionTypeTimelineEventTypeFilter.lower(eventTypeFilter)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeRoomListError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func isDirect() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_is_direct(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Checks whether the Room's timeline has been initialized before.
|
|
*/
|
|
open func isTimelineInitialized() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_is_timeline_initialized(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func latestEvent() async -> EventTimelineItem? {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_latest_event(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterOptionTypeEventTimelineItem.lift,
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
open func name() -> String? {
|
|
return try! FfiConverterOptionString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_name(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func roomInfo() async throws -> RoomInfo {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_room_info(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterTypeRoomInfo.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func subscribe(settings: RoomSubscription?) {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_subscribe(self.uniffiClonePointer(),
|
|
FfiConverterOptionTypeRoomSubscription.lower(settings),$0
|
|
)
|
|
}
|
|
}
|
|
open func unsubscribe() {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistitem_unsubscribe(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeRoomListItem: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = RoomListItem
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomListItem {
|
|
return RoomListItem(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: RoomListItem) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListItem {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: RoomListItem, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeRoomListItem_lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomListItem {
|
|
return try FfiConverterTypeRoomListItem.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListItem_lower(_ value: RoomListItem) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeRoomListItem.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomListServiceProtocol : AnyObject {
|
|
|
|
func allRooms() async throws -> RoomList
|
|
|
|
func applyInput(input: RoomListInput) async throws
|
|
|
|
func invites() async throws -> RoomList
|
|
|
|
func room(roomId: String) throws -> RoomListItem
|
|
|
|
func state(listener: RoomListServiceStateListener) -> TaskHandle
|
|
|
|
func syncIndicator(delayBeforeShowingInMs: UInt32, delayBeforeHidingInMs: UInt32, listener: RoomListServiceSyncIndicatorListener) -> TaskHandle
|
|
|
|
}
|
|
|
|
open class RoomListService:
|
|
RoomListServiceProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_roomlistservice(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_roomlistservice(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func allRooms() async throws -> RoomList {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistservice_all_rooms(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeRoomList.lift,
|
|
errorHandler: FfiConverterTypeRoomListError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func applyInput(input: RoomListInput) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistservice_apply_input(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterTypeRoomListInput.lower(input)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeRoomListError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func invites() async throws -> RoomList {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistservice_invites(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeRoomList.lift,
|
|
errorHandler: FfiConverterTypeRoomListError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func room(roomId: String) throws -> RoomListItem {
|
|
return try FfiConverterTypeRoomListItem.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeRoomListError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistservice_room(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(roomId),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func state(listener: RoomListServiceStateListener) -> TaskHandle {
|
|
return try! FfiConverterTypeTaskHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistservice_state(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceRoomListServiceStateListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func syncIndicator(delayBeforeShowingInMs: UInt32, delayBeforeHidingInMs: UInt32, listener: RoomListServiceSyncIndicatorListener) -> TaskHandle {
|
|
return try! FfiConverterTypeTaskHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roomlistservice_sync_indicator(self.uniffiClonePointer(),
|
|
FfiConverterUInt32.lower(delayBeforeShowingInMs),
|
|
FfiConverterUInt32.lower(delayBeforeHidingInMs),
|
|
FfiConverterCallbackInterfaceRoomListServiceSyncIndicatorListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeRoomListService: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = RoomListService
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomListService {
|
|
return RoomListService(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: RoomListService) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListService {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: RoomListService, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeRoomListService_lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomListService {
|
|
return try FfiConverterTypeRoomListService.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListService_lower(_ value: RoomListService) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeRoomListService.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomMembersIteratorProtocol : AnyObject {
|
|
|
|
func len() -> UInt32
|
|
|
|
func nextChunk(chunkSize: UInt32) -> [RoomMember]?
|
|
|
|
}
|
|
|
|
open class RoomMembersIterator:
|
|
RoomMembersIteratorProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_roommembersiterator(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_roommembersiterator(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func len() -> UInt32 {
|
|
return try! FfiConverterUInt32.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roommembersiterator_len(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func nextChunk(chunkSize: UInt32) -> [RoomMember]? {
|
|
return try! FfiConverterOptionSequenceTypeRoomMember.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roommembersiterator_next_chunk(self.uniffiClonePointer(),
|
|
FfiConverterUInt32.lower(chunkSize),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeRoomMembersIterator: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = RoomMembersIterator
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomMembersIterator {
|
|
return RoomMembersIterator(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: RoomMembersIterator) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomMembersIterator {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: RoomMembersIterator, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeRoomMembersIterator_lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomMembersIterator {
|
|
return try FfiConverterTypeRoomMembersIterator.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomMembersIterator_lower(_ value: RoomMembersIterator) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeRoomMembersIterator.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomMessageEventContentWithoutRelationProtocol : AnyObject {
|
|
|
|
func withMentions(mentions: Mentions) -> RoomMessageEventContentWithoutRelation
|
|
|
|
}
|
|
|
|
open class RoomMessageEventContentWithoutRelation:
|
|
RoomMessageEventContentWithoutRelationProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_roommessageeventcontentwithoutrelation(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_roommessageeventcontentwithoutrelation(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func withMentions(mentions: Mentions) -> RoomMessageEventContentWithoutRelation {
|
|
return try! FfiConverterTypeRoomMessageEventContentWithoutRelation.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_roommessageeventcontentwithoutrelation_with_mentions(self.uniffiClonePointer(),
|
|
FfiConverterTypeMentions.lower(mentions),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeRoomMessageEventContentWithoutRelation: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = RoomMessageEventContentWithoutRelation
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomMessageEventContentWithoutRelation {
|
|
return RoomMessageEventContentWithoutRelation(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: RoomMessageEventContentWithoutRelation) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomMessageEventContentWithoutRelation {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: RoomMessageEventContentWithoutRelation, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeRoomMessageEventContentWithoutRelation_lift(_ pointer: UnsafeMutableRawPointer) throws -> RoomMessageEventContentWithoutRelation {
|
|
return try FfiConverterTypeRoomMessageEventContentWithoutRelation.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomMessageEventContentWithoutRelation_lower(_ value: RoomMessageEventContentWithoutRelation) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeRoomMessageEventContentWithoutRelation.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol SendAttachmentJoinHandleProtocol : AnyObject {
|
|
|
|
func cancel()
|
|
|
|
func join() async throws
|
|
|
|
}
|
|
|
|
open class SendAttachmentJoinHandle:
|
|
SendAttachmentJoinHandleProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_sendattachmentjoinhandle(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_sendattachmentjoinhandle(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func cancel() {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_sendattachmentjoinhandle_cancel(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
}
|
|
open func join() async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_sendattachmentjoinhandle_join(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeRoomError.lift
|
|
)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeSendAttachmentJoinHandle: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = SendAttachmentJoinHandle
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> SendAttachmentJoinHandle {
|
|
return SendAttachmentJoinHandle(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: SendAttachmentJoinHandle) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SendAttachmentJoinHandle {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: SendAttachmentJoinHandle, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeSendAttachmentJoinHandle_lift(_ pointer: UnsafeMutableRawPointer) throws -> SendAttachmentJoinHandle {
|
|
return try FfiConverterTypeSendAttachmentJoinHandle.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeSendAttachmentJoinHandle_lower(_ value: SendAttachmentJoinHandle) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeSendAttachmentJoinHandle.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol SessionVerificationControllerProtocol : AnyObject {
|
|
|
|
func approveVerification() async throws
|
|
|
|
func cancelVerification() async throws
|
|
|
|
func declineVerification() async throws
|
|
|
|
func isVerified() async throws -> Bool
|
|
|
|
func requestVerification() async throws
|
|
|
|
func setDelegate(delegate: SessionVerificationControllerDelegate?)
|
|
|
|
func startSasVerification() async throws
|
|
|
|
}
|
|
|
|
open class SessionVerificationController:
|
|
SessionVerificationControllerProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_sessionverificationcontroller(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_sessionverificationcontroller(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func approveVerification() async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_sessionverificationcontroller_approve_verification(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func cancelVerification() async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_sessionverificationcontroller_cancel_verification(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func declineVerification() async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_sessionverificationcontroller_decline_verification(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func isVerified() async throws -> Bool {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_sessionverificationcontroller_is_verified(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func requestVerification() async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_sessionverificationcontroller_request_verification(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func setDelegate(delegate: SessionVerificationControllerDelegate?) {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_sessionverificationcontroller_set_delegate(self.uniffiClonePointer(),
|
|
FfiConverterOptionCallbackInterfaceSessionVerificationControllerDelegate.lower(delegate),$0
|
|
)
|
|
}
|
|
}
|
|
open func startSasVerification() async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_sessionverificationcontroller_start_sas_verification(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeSessionVerificationController: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = SessionVerificationController
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> SessionVerificationController {
|
|
return SessionVerificationController(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: SessionVerificationController) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SessionVerificationController {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: SessionVerificationController, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeSessionVerificationController_lift(_ pointer: UnsafeMutableRawPointer) throws -> SessionVerificationController {
|
|
return try FfiConverterTypeSessionVerificationController.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeSessionVerificationController_lower(_ value: SessionVerificationController) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeSessionVerificationController.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol SessionVerificationEmojiProtocol : AnyObject {
|
|
|
|
func description() -> String
|
|
|
|
func symbol() -> String
|
|
|
|
}
|
|
|
|
open class SessionVerificationEmoji:
|
|
SessionVerificationEmojiProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_sessionverificationemoji(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_sessionverificationemoji(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func description() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_sessionverificationemoji_description(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func symbol() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_sessionverificationemoji_symbol(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeSessionVerificationEmoji: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = SessionVerificationEmoji
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> SessionVerificationEmoji {
|
|
return SessionVerificationEmoji(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: SessionVerificationEmoji) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SessionVerificationEmoji {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: SessionVerificationEmoji, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeSessionVerificationEmoji_lift(_ pointer: UnsafeMutableRawPointer) throws -> SessionVerificationEmoji {
|
|
return try FfiConverterTypeSessionVerificationEmoji.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeSessionVerificationEmoji_lower(_ value: SessionVerificationEmoji) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeSessionVerificationEmoji.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol SpanProtocol : AnyObject {
|
|
|
|
func enter()
|
|
|
|
func exit()
|
|
|
|
func isNone() -> Bool
|
|
|
|
}
|
|
|
|
open class Span:
|
|
SpanProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_span(self.pointer, $0) }
|
|
}
|
|
/**
|
|
* Create a span originating at the given callsite (file, line and column).
|
|
*
|
|
* The target should be something like a module path, and can be referenced
|
|
* in the filter string given to `setup_tracing`. `level` and `target`
|
|
* for a callsite are fixed at the first creation of a span for that
|
|
* callsite and can not be changed afterwards, i.e. the level and
|
|
* target passed for second and following creation of a span with the same
|
|
* callsite will be ignored.
|
|
*
|
|
* This function leaks a little bit of memory for each unique (file + line
|
|
* + level + target + name) it is called with. Please make sure that the
|
|
* number of different combinations of those parameters this can be called
|
|
* with is constant in the final executable.
|
|
*
|
|
* For a span to have an effect, you must `.enter()` it at the start of a
|
|
* logical unit of work and `.exit()` it at the end of the same (including
|
|
* on failure). Entering registers the span in thread-local storage, so
|
|
* future calls to `log_event` on the same thread are able to attach the
|
|
* events they create to the span, exiting unregisters it. For this to
|
|
* work, exiting a span must be done on the same thread where it was
|
|
* entered. It is possible to enter a span on multiple threads, in which
|
|
* case it should also be exited on all of them individually; that is,
|
|
* unless you *want* the span to be attached to all further events created
|
|
* on that thread.
|
|
*/
|
|
public convenience init(file: String, line: UInt32?, level: LogLevel, target: String, name: String) {
|
|
self.init(unsafeFromRawPointer: try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_constructor_span_new(
|
|
FfiConverterString.lower(file),
|
|
FfiConverterOptionUInt32.lower(line),
|
|
FfiConverterTypeLogLevel.lower(level),
|
|
FfiConverterString.lower(target),
|
|
FfiConverterString.lower(name),$0)
|
|
})
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_span(pointer, $0) }
|
|
}
|
|
|
|
|
|
public static func current() -> Span {
|
|
return Span(unsafeFromRawPointer: try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_constructor_span_current($0)
|
|
})
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func enter() {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_span_enter(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
}
|
|
open func exit() {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_span_exit(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
}
|
|
open func isNone() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_span_is_none(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeSpan: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = Span
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> Span {
|
|
return Span(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: Span) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Span {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: Span, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeSpan_lift(_ pointer: UnsafeMutableRawPointer) throws -> Span {
|
|
return try FfiConverterTypeSpan.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeSpan_lower(_ value: Span) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeSpan.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol SyncServiceProtocol : AnyObject {
|
|
|
|
func roomListService() -> RoomListService
|
|
|
|
func start() async
|
|
|
|
func state(listener: SyncServiceStateObserver) -> TaskHandle
|
|
|
|
func stop() async throws
|
|
|
|
}
|
|
|
|
open class SyncService:
|
|
SyncServiceProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_syncservice(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_syncservice(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func roomListService() -> RoomListService {
|
|
return try! FfiConverterTypeRoomListService.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_syncservice_room_list_service(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func start() async {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_syncservice_start(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
open func state(listener: SyncServiceStateObserver) -> TaskHandle {
|
|
return try! FfiConverterTypeTaskHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_syncservice_state(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceSyncServiceStateObserver.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func stop() async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_syncservice_stop(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeSyncService: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = SyncService
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> SyncService {
|
|
return SyncService(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: SyncService) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SyncService {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: SyncService, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeSyncService_lift(_ pointer: UnsafeMutableRawPointer) throws -> SyncService {
|
|
return try FfiConverterTypeSyncService.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeSyncService_lower(_ value: SyncService) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeSyncService.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol SyncServiceBuilderProtocol : AnyObject {
|
|
|
|
func finish() async throws -> SyncService
|
|
|
|
func withCrossProcessLock(appIdentifier: String?) -> SyncServiceBuilder
|
|
|
|
func withUnifiedInvitesInRoomList(withUnifiedInvites: Bool) -> SyncServiceBuilder
|
|
|
|
func withUtdHook(delegate: UnableToDecryptDelegate) -> SyncServiceBuilder
|
|
|
|
}
|
|
|
|
open class SyncServiceBuilder:
|
|
SyncServiceBuilderProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_syncservicebuilder(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_syncservicebuilder(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func finish() async throws -> SyncService {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_syncservicebuilder_finish(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_pointer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_pointer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_pointer,
|
|
liftFunc: FfiConverterTypeSyncService.lift,
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func withCrossProcessLock(appIdentifier: String?) -> SyncServiceBuilder {
|
|
return try! FfiConverterTypeSyncServiceBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_syncservicebuilder_with_cross_process_lock(self.uniffiClonePointer(),
|
|
FfiConverterOptionString.lower(appIdentifier),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func withUnifiedInvitesInRoomList(withUnifiedInvites: Bool) -> SyncServiceBuilder {
|
|
return try! FfiConverterTypeSyncServiceBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_syncservicebuilder_with_unified_invites_in_room_list(self.uniffiClonePointer(),
|
|
FfiConverterBool.lower(withUnifiedInvites),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func withUtdHook(delegate: UnableToDecryptDelegate) -> SyncServiceBuilder {
|
|
return try! FfiConverterTypeSyncServiceBuilder.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_syncservicebuilder_with_utd_hook(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceUnableToDecryptDelegate.lower(delegate),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeSyncServiceBuilder: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = SyncServiceBuilder
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> SyncServiceBuilder {
|
|
return SyncServiceBuilder(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: SyncServiceBuilder) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SyncServiceBuilder {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: SyncServiceBuilder, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeSyncServiceBuilder_lift(_ pointer: UnsafeMutableRawPointer) throws -> SyncServiceBuilder {
|
|
return try FfiConverterTypeSyncServiceBuilder.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeSyncServiceBuilder_lower(_ value: SyncServiceBuilder) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeSyncServiceBuilder.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* A task handle is a way to keep the handle a task running by itself in
|
|
* detached mode.
|
|
*
|
|
* It's a thin wrapper around [`JoinHandle`].
|
|
*/
|
|
public protocol TaskHandleProtocol : AnyObject {
|
|
|
|
func cancel()
|
|
|
|
/**
|
|
* Check whether the handle is finished.
|
|
*/
|
|
func isFinished() -> Bool
|
|
|
|
}
|
|
|
|
/**
|
|
* A task handle is a way to keep the handle a task running by itself in
|
|
* detached mode.
|
|
*
|
|
* It's a thin wrapper around [`JoinHandle`].
|
|
*/
|
|
open class TaskHandle:
|
|
TaskHandleProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_taskhandle(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_taskhandle(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func cancel() {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_taskhandle_cancel(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
}
|
|
/**
|
|
* Check whether the handle is finished.
|
|
*/
|
|
open func isFinished() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_taskhandle_is_finished(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeTaskHandle: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = TaskHandle
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> TaskHandle {
|
|
return TaskHandle(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: TaskHandle) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TaskHandle {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: TaskHandle, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeTaskHandle_lift(_ pointer: UnsafeMutableRawPointer) throws -> TaskHandle {
|
|
return try FfiConverterTypeTaskHandle.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeTaskHandle_lower(_ value: TaskHandle) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeTaskHandle.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol TimelineProtocol : AnyObject {
|
|
|
|
func addListener(listener: TimelineListener) async -> RoomTimelineListenerResult
|
|
|
|
func cancelSend(txnId: String)
|
|
|
|
func createPoll(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind) throws
|
|
|
|
func edit(newContent: RoomMessageEventContentWithoutRelation, editItem: EventTimelineItem) throws
|
|
|
|
func editPoll(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind, editItem: EventTimelineItem) async throws
|
|
|
|
func endPoll(pollStartId: String, text: String) throws
|
|
|
|
func fetchDetailsForEvent(eventId: String) throws
|
|
|
|
func fetchMembers() async
|
|
|
|
func getEventTimelineItemByEventId(eventId: String) throws -> EventTimelineItem
|
|
|
|
func getTimelineEventContentByEventId(eventId: String) throws -> RoomMessageEventContentWithoutRelation
|
|
|
|
func latestEvent() async -> EventTimelineItem?
|
|
|
|
/**
|
|
* Mark the room as read by trying to attach an *unthreaded* read receipt
|
|
* to the latest room event.
|
|
*
|
|
* This works even if the latest event belongs to a thread, as a threaded
|
|
* reply also belongs to the unthreaded timeline. No threaded receipt
|
|
* will be sent here (see also #3123).
|
|
*/
|
|
func markAsRead(receiptType: ReceiptType) async throws
|
|
|
|
/**
|
|
* Loads older messages into the timeline.
|
|
*
|
|
* Raises an exception if there are no timeline listeners.
|
|
*/
|
|
func paginateBackwards(opts: PaginationOptions) throws
|
|
|
|
func retryDecryption(sessionIds: [String])
|
|
|
|
func retrySend(txnId: String)
|
|
|
|
func send(msg: RoomMessageEventContentWithoutRelation)
|
|
|
|
func sendAudio(url: String, audioInfo: AudioInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?) -> SendAttachmentJoinHandle
|
|
|
|
func sendFile(url: String, fileInfo: FileInfo, progressWatcher: ProgressWatcher?) -> SendAttachmentJoinHandle
|
|
|
|
func sendImage(url: String, thumbnailUrl: String?, imageInfo: ImageInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?) -> SendAttachmentJoinHandle
|
|
|
|
func sendLocation(body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?)
|
|
|
|
func sendPollResponse(pollStartId: String, answers: [String]) throws
|
|
|
|
func sendReadReceipt(receiptType: ReceiptType, eventId: String) throws
|
|
|
|
func sendReply(msg: RoomMessageEventContentWithoutRelation, replyItem: EventTimelineItem) throws
|
|
|
|
func sendVideo(url: String, thumbnailUrl: String?, videoInfo: VideoInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?) -> SendAttachmentJoinHandle
|
|
|
|
func sendVoiceMessage(url: String, audioInfo: AudioInfo, waveform: [UInt16], caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?) -> SendAttachmentJoinHandle
|
|
|
|
func subscribeToBackPaginationStatus(listener: BackPaginationStatusListener) throws -> TaskHandle
|
|
|
|
func toggleReaction(eventId: String, key: String) throws
|
|
|
|
}
|
|
|
|
open class Timeline:
|
|
TimelineProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_timeline(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_timeline(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func addListener(listener: TimelineListener) async -> RoomTimelineListenerResult {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_add_listener(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceTimelineListener.lower(listener)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterTypeRoomTimelineListenerResult.lift,
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
open func cancelSend(txnId: String) {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_cancel_send(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(txnId),$0
|
|
)
|
|
}
|
|
}
|
|
open func createPoll(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_create_poll(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(question),
|
|
FfiConverterSequenceString.lower(answers),
|
|
FfiConverterUInt8.lower(maxSelections),
|
|
FfiConverterTypePollKind.lower(pollKind),$0
|
|
)
|
|
}
|
|
}
|
|
open func edit(newContent: RoomMessageEventContentWithoutRelation, editItem: EventTimelineItem) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_edit(self.uniffiClonePointer(),
|
|
FfiConverterTypeRoomMessageEventContentWithoutRelation.lower(newContent),
|
|
FfiConverterTypeEventTimelineItem.lower(editItem),$0
|
|
)
|
|
}
|
|
}
|
|
open func editPoll(question: String, answers: [String], maxSelections: UInt8, pollKind: PollKind, editItem: EventTimelineItem) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_edit_poll(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(question),
|
|
FfiConverterSequenceString.lower(answers),
|
|
FfiConverterUInt8.lower(maxSelections),
|
|
FfiConverterTypePollKind.lower(pollKind),
|
|
FfiConverterTypeEventTimelineItem.lower(editItem)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
open func endPoll(pollStartId: String, text: String) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_end_poll(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(pollStartId),
|
|
FfiConverterString.lower(text),$0
|
|
)
|
|
}
|
|
}
|
|
open func fetchDetailsForEvent(eventId: String) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_fetch_details_for_event(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(eventId),$0
|
|
)
|
|
}
|
|
}
|
|
open func fetchMembers() async {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_fetch_members(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
open func getEventTimelineItemByEventId(eventId: String) throws -> EventTimelineItem {
|
|
return try FfiConverterTypeEventTimelineItem.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_get_event_timeline_item_by_event_id(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(eventId),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func getTimelineEventContentByEventId(eventId: String) throws -> RoomMessageEventContentWithoutRelation {
|
|
return try FfiConverterTypeRoomMessageEventContentWithoutRelation.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_get_timeline_event_content_by_event_id(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(eventId),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func latestEvent() async -> EventTimelineItem? {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_latest_event(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterOptionTypeEventTimelineItem.lift,
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Mark the room as read by trying to attach an *unthreaded* read receipt
|
|
* to the latest room event.
|
|
*
|
|
* This works even if the latest event belongs to a thread, as a threaded
|
|
* reply also belongs to the unthreaded timeline. No threaded receipt
|
|
* will be sent here (see also #3123).
|
|
*/
|
|
open func markAsRead(receiptType: ReceiptType) async throws {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_mark_as_read(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterTypeReceiptType.lower(receiptType)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: FfiConverterTypeClientError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* Loads older messages into the timeline.
|
|
*
|
|
* Raises an exception if there are no timeline listeners.
|
|
*/
|
|
open func paginateBackwards(opts: PaginationOptions) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_paginate_backwards(self.uniffiClonePointer(),
|
|
FfiConverterTypePaginationOptions.lower(opts),$0
|
|
)
|
|
}
|
|
}
|
|
open func retryDecryption(sessionIds: [String]) {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_retry_decryption(self.uniffiClonePointer(),
|
|
FfiConverterSequenceString.lower(sessionIds),$0
|
|
)
|
|
}
|
|
}
|
|
open func retrySend(txnId: String) {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_retry_send(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(txnId),$0
|
|
)
|
|
}
|
|
}
|
|
open func send(msg: RoomMessageEventContentWithoutRelation) {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_send(self.uniffiClonePointer(),
|
|
FfiConverterTypeRoomMessageEventContentWithoutRelation.lower(msg),$0
|
|
)
|
|
}
|
|
}
|
|
open func sendAudio(url: String, audioInfo: AudioInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?) -> SendAttachmentJoinHandle {
|
|
return try! FfiConverterTypeSendAttachmentJoinHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_send_audio(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(url),
|
|
FfiConverterTypeAudioInfo.lower(audioInfo),
|
|
FfiConverterOptionString.lower(caption),
|
|
FfiConverterOptionTypeFormattedBody.lower(formattedCaption),
|
|
FfiConverterOptionCallbackInterfaceProgressWatcher.lower(progressWatcher),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func sendFile(url: String, fileInfo: FileInfo, progressWatcher: ProgressWatcher?) -> SendAttachmentJoinHandle {
|
|
return try! FfiConverterTypeSendAttachmentJoinHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_send_file(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(url),
|
|
FfiConverterTypeFileInfo.lower(fileInfo),
|
|
FfiConverterOptionCallbackInterfaceProgressWatcher.lower(progressWatcher),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func sendImage(url: String, thumbnailUrl: String?, imageInfo: ImageInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?) -> SendAttachmentJoinHandle {
|
|
return try! FfiConverterTypeSendAttachmentJoinHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_send_image(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(url),
|
|
FfiConverterOptionString.lower(thumbnailUrl),
|
|
FfiConverterTypeImageInfo.lower(imageInfo),
|
|
FfiConverterOptionString.lower(caption),
|
|
FfiConverterOptionTypeFormattedBody.lower(formattedCaption),
|
|
FfiConverterOptionCallbackInterfaceProgressWatcher.lower(progressWatcher),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func sendLocation(body: String, geoUri: String, description: String?, zoomLevel: UInt8?, assetType: AssetType?) {
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_send_location(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(body),
|
|
FfiConverterString.lower(geoUri),
|
|
FfiConverterOptionString.lower(description),
|
|
FfiConverterOptionUInt8.lower(zoomLevel),
|
|
FfiConverterOptionTypeAssetType.lower(assetType),$0
|
|
)
|
|
}
|
|
}
|
|
open func sendPollResponse(pollStartId: String, answers: [String]) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_send_poll_response(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(pollStartId),
|
|
FfiConverterSequenceString.lower(answers),$0
|
|
)
|
|
}
|
|
}
|
|
open func sendReadReceipt(receiptType: ReceiptType, eventId: String) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_send_read_receipt(self.uniffiClonePointer(),
|
|
FfiConverterTypeReceiptType.lower(receiptType),
|
|
FfiConverterString.lower(eventId),$0
|
|
)
|
|
}
|
|
}
|
|
open func sendReply(msg: RoomMessageEventContentWithoutRelation, replyItem: EventTimelineItem) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_send_reply(self.uniffiClonePointer(),
|
|
FfiConverterTypeRoomMessageEventContentWithoutRelation.lower(msg),
|
|
FfiConverterTypeEventTimelineItem.lower(replyItem),$0
|
|
)
|
|
}
|
|
}
|
|
open func sendVideo(url: String, thumbnailUrl: String?, videoInfo: VideoInfo, caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?) -> SendAttachmentJoinHandle {
|
|
return try! FfiConverterTypeSendAttachmentJoinHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_send_video(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(url),
|
|
FfiConverterOptionString.lower(thumbnailUrl),
|
|
FfiConverterTypeVideoInfo.lower(videoInfo),
|
|
FfiConverterOptionString.lower(caption),
|
|
FfiConverterOptionTypeFormattedBody.lower(formattedCaption),
|
|
FfiConverterOptionCallbackInterfaceProgressWatcher.lower(progressWatcher),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func sendVoiceMessage(url: String, audioInfo: AudioInfo, waveform: [UInt16], caption: String?, formattedCaption: FormattedBody?, progressWatcher: ProgressWatcher?) -> SendAttachmentJoinHandle {
|
|
return try! FfiConverterTypeSendAttachmentJoinHandle.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_send_voice_message(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(url),
|
|
FfiConverterTypeAudioInfo.lower(audioInfo),
|
|
FfiConverterSequenceUInt16.lower(waveform),
|
|
FfiConverterOptionString.lower(caption),
|
|
FfiConverterOptionTypeFormattedBody.lower(formattedCaption),
|
|
FfiConverterOptionCallbackInterfaceProgressWatcher.lower(progressWatcher),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func subscribeToBackPaginationStatus(listener: BackPaginationStatusListener) throws -> TaskHandle {
|
|
return try FfiConverterTypeTaskHandle.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_subscribe_to_back_pagination_status(self.uniffiClonePointer(),
|
|
FfiConverterCallbackInterfaceBackPaginationStatusListener.lower(listener),$0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func toggleReaction(eventId: String, key: String) throws {
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timeline_toggle_reaction(self.uniffiClonePointer(),
|
|
FfiConverterString.lower(eventId),
|
|
FfiConverterString.lower(key),$0
|
|
)
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeTimeline: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = Timeline
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> Timeline {
|
|
return Timeline(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: Timeline) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Timeline {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: Timeline, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeTimeline_lift(_ pointer: UnsafeMutableRawPointer) throws -> Timeline {
|
|
return try FfiConverterTypeTimeline.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeTimeline_lower(_ value: Timeline) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeTimeline.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol TimelineDiffProtocol : AnyObject {
|
|
|
|
func append() -> [TimelineItem]?
|
|
|
|
func change() -> TimelineChange
|
|
|
|
func insert() -> InsertData?
|
|
|
|
func pushBack() -> TimelineItem?
|
|
|
|
func pushFront() -> TimelineItem?
|
|
|
|
func remove() -> UInt32?
|
|
|
|
func reset() -> [TimelineItem]?
|
|
|
|
func set() -> SetData?
|
|
|
|
}
|
|
|
|
open class TimelineDiff:
|
|
TimelineDiffProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_timelinediff(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_timelinediff(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func append() -> [TimelineItem]? {
|
|
return try! FfiConverterOptionSequenceTypeTimelineItem.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelinediff_append(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func change() -> TimelineChange {
|
|
return try! FfiConverterTypeTimelineChange.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelinediff_change(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func insert() -> InsertData? {
|
|
return try! FfiConverterOptionTypeInsertData.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelinediff_insert(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func pushBack() -> TimelineItem? {
|
|
return try! FfiConverterOptionTypeTimelineItem.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelinediff_push_back(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func pushFront() -> TimelineItem? {
|
|
return try! FfiConverterOptionTypeTimelineItem.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelinediff_push_front(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func remove() -> UInt32? {
|
|
return try! FfiConverterOptionUInt32.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelinediff_remove(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func reset() -> [TimelineItem]? {
|
|
return try! FfiConverterOptionSequenceTypeTimelineItem.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelinediff_reset(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func set() -> SetData? {
|
|
return try! FfiConverterOptionTypeSetData.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelinediff_set(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeTimelineDiff: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = TimelineDiff
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> TimelineDiff {
|
|
return TimelineDiff(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: TimelineDiff) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TimelineDiff {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: TimelineDiff, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeTimelineDiff_lift(_ pointer: UnsafeMutableRawPointer) throws -> TimelineDiff {
|
|
return try FfiConverterTypeTimelineDiff.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeTimelineDiff_lower(_ value: TimelineDiff) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeTimelineDiff.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol TimelineEventProtocol : AnyObject {
|
|
|
|
func eventId() -> String
|
|
|
|
func eventType() throws -> TimelineEventType
|
|
|
|
func senderId() -> String
|
|
|
|
func timestamp() -> UInt64
|
|
|
|
}
|
|
|
|
open class TimelineEvent:
|
|
TimelineEventProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_timelineevent(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_timelineevent(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func eventId() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelineevent_event_id(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func eventType() throws -> TimelineEventType {
|
|
return try FfiConverterTypeTimelineEventType.lift(
|
|
try
|
|
rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_method_timelineevent_event_type(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func senderId() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelineevent_sender_id(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func timestamp() -> UInt64 {
|
|
return try! FfiConverterUInt64.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelineevent_timestamp(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeTimelineEvent: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = TimelineEvent
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> TimelineEvent {
|
|
return TimelineEvent(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: TimelineEvent) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TimelineEvent {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: TimelineEvent, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeTimelineEvent_lift(_ pointer: UnsafeMutableRawPointer) throws -> TimelineEvent {
|
|
return try FfiConverterTypeTimelineEvent.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeTimelineEvent_lower(_ value: TimelineEvent) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeTimelineEvent.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol TimelineEventTypeFilterProtocol : AnyObject {
|
|
|
|
}
|
|
|
|
open class TimelineEventTypeFilter:
|
|
TimelineEventTypeFilterProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_timelineeventtypefilter(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_timelineeventtypefilter(pointer, $0) }
|
|
}
|
|
|
|
|
|
public static func exclude(eventTypes: [FilterTimelineEventType]) -> TimelineEventTypeFilter {
|
|
return TimelineEventTypeFilter(unsafeFromRawPointer: try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_constructor_timelineeventtypefilter_exclude(
|
|
FfiConverterSequenceTypeFilterTimelineEventType.lower(eventTypes),$0)
|
|
})
|
|
}
|
|
|
|
|
|
public static func include(eventTypes: [FilterTimelineEventType]) -> TimelineEventTypeFilter {
|
|
return TimelineEventTypeFilter(unsafeFromRawPointer: try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_constructor_timelineeventtypefilter_include(
|
|
FfiConverterSequenceTypeFilterTimelineEventType.lower(eventTypes),$0)
|
|
})
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeTimelineEventTypeFilter: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = TimelineEventTypeFilter
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> TimelineEventTypeFilter {
|
|
return TimelineEventTypeFilter(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: TimelineEventTypeFilter) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TimelineEventTypeFilter {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: TimelineEventTypeFilter, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeTimelineEventTypeFilter_lift(_ pointer: UnsafeMutableRawPointer) throws -> TimelineEventTypeFilter {
|
|
return try FfiConverterTypeTimelineEventTypeFilter.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeTimelineEventTypeFilter_lower(_ value: TimelineEventTypeFilter) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeTimelineEventTypeFilter.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol TimelineItemProtocol : AnyObject {
|
|
|
|
func asEvent() -> EventTimelineItem?
|
|
|
|
func asVirtual() -> VirtualTimelineItem?
|
|
|
|
func fmtDebug() -> String
|
|
|
|
func uniqueId() -> UInt64
|
|
|
|
}
|
|
|
|
open class TimelineItem:
|
|
TimelineItemProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_timelineitem(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_timelineitem(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func asEvent() -> EventTimelineItem? {
|
|
return try! FfiConverterOptionTypeEventTimelineItem.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelineitem_as_event(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func asVirtual() -> VirtualTimelineItem? {
|
|
return try! FfiConverterOptionTypeVirtualTimelineItem.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelineitem_as_virtual(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func fmtDebug() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelineitem_fmt_debug(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func uniqueId() -> UInt64 {
|
|
return try! FfiConverterUInt64.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelineitem_unique_id(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeTimelineItem: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = TimelineItem
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> TimelineItem {
|
|
return TimelineItem(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: TimelineItem) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TimelineItem {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: TimelineItem, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeTimelineItem_lift(_ pointer: UnsafeMutableRawPointer) throws -> TimelineItem {
|
|
return try FfiConverterTypeTimelineItem.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeTimelineItem_lower(_ value: TimelineItem) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeTimelineItem.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol TimelineItemContentProtocol : AnyObject {
|
|
|
|
func asMessage() -> Message?
|
|
|
|
func kind() -> TimelineItemContentKind
|
|
|
|
}
|
|
|
|
open class TimelineItemContent:
|
|
TimelineItemContentProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_timelineitemcontent(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_timelineitemcontent(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func asMessage() -> Message? {
|
|
return try! FfiConverterOptionTypeMessage.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelineitemcontent_as_message(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func kind() -> TimelineItemContentKind {
|
|
return try! FfiConverterTypeTimelineItemContentKind.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_timelineitemcontent_kind(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeTimelineItemContent: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = TimelineItemContent
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> TimelineItemContent {
|
|
return TimelineItemContent(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: TimelineItemContent) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TimelineItemContent {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: TimelineItemContent, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeTimelineItemContent_lift(_ pointer: UnsafeMutableRawPointer) throws -> TimelineItemContent {
|
|
return try FfiConverterTypeTimelineItemContent.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeTimelineItemContent_lower(_ value: TimelineItemContent) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeTimelineItemContent.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol UnreadNotificationsCountProtocol : AnyObject {
|
|
|
|
func hasNotifications() -> Bool
|
|
|
|
func highlightCount() -> UInt32
|
|
|
|
func notificationCount() -> UInt32
|
|
|
|
}
|
|
|
|
open class UnreadNotificationsCount:
|
|
UnreadNotificationsCountProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_unreadnotificationscount(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_unreadnotificationscount(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func hasNotifications() -> Bool {
|
|
return try! FfiConverterBool.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_unreadnotificationscount_has_notifications(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func highlightCount() -> UInt32 {
|
|
return try! FfiConverterUInt32.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_unreadnotificationscount_highlight_count(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
open func notificationCount() -> UInt32 {
|
|
return try! FfiConverterUInt32.lift(
|
|
try!
|
|
rustCall() {
|
|
|
|
uniffi_matrix_sdk_ffi_fn_method_unreadnotificationscount_notification_count(self.uniffiClonePointer(), $0
|
|
)
|
|
}
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeUnreadNotificationsCount: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = UnreadNotificationsCount
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> UnreadNotificationsCount {
|
|
return UnreadNotificationsCount(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: UnreadNotificationsCount) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UnreadNotificationsCount {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: UnreadNotificationsCount, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeUnreadNotificationsCount_lift(_ pointer: UnsafeMutableRawPointer) throws -> UnreadNotificationsCount {
|
|
return try FfiConverterTypeUnreadNotificationsCount.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeUnreadNotificationsCount_lower(_ value: UnreadNotificationsCount) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeUnreadNotificationsCount.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* An object that handles all interactions of a widget living inside a webview
|
|
* or IFrame with the Matrix world.
|
|
*/
|
|
public protocol WidgetDriverProtocol : AnyObject {
|
|
|
|
func run(room: Room, capabilitiesProvider: WidgetCapabilitiesProvider) async
|
|
|
|
}
|
|
|
|
/**
|
|
* An object that handles all interactions of a widget living inside a webview
|
|
* or IFrame with the Matrix world.
|
|
*/
|
|
open class WidgetDriver:
|
|
WidgetDriverProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_widgetdriver(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_widgetdriver(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
open func run(room: Room, capabilitiesProvider: WidgetCapabilitiesProvider) async {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_widgetdriver_run(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterTypeRoom.lower(room),
|
|
FfiConverterCallbackInterfaceWidgetCapabilitiesProvider.lower(capabilitiesProvider)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_void,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_void,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_void,
|
|
liftFunc: { $0 },
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeWidgetDriver: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = WidgetDriver
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> WidgetDriver {
|
|
return WidgetDriver(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: WidgetDriver) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WidgetDriver {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: WidgetDriver, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeWidgetDriver_lift(_ pointer: UnsafeMutableRawPointer) throws -> WidgetDriver {
|
|
return try FfiConverterTypeWidgetDriver.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeWidgetDriver_lower(_ value: WidgetDriver) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeWidgetDriver.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* A handle that encapsulates the communication between a widget driver and the
|
|
* corresponding widget (inside a webview or IFrame).
|
|
*/
|
|
public protocol WidgetDriverHandleProtocol : AnyObject {
|
|
|
|
/**
|
|
* Receive a message from the widget driver.
|
|
*
|
|
* The message must be passed on to the widget.
|
|
*
|
|
* Returns `None` if the widget driver is no longer running.
|
|
*/
|
|
func recv() async -> String?
|
|
|
|
/**
|
|
*
|
|
* Returns `false` if the widget driver is no longer running.
|
|
*/
|
|
func send(msg: String) async -> Bool
|
|
|
|
}
|
|
|
|
/**
|
|
* A handle that encapsulates the communication between a widget driver and the
|
|
* corresponding widget (inside a webview or IFrame).
|
|
*/
|
|
open class WidgetDriverHandle:
|
|
WidgetDriverHandleProtocol {
|
|
fileprivate let pointer: UnsafeMutableRawPointer!
|
|
|
|
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
|
|
public struct NoPointer {
|
|
public init() {}
|
|
}
|
|
|
|
// TODO: We'd like this to be `private` but for Swifty reasons,
|
|
// we can't implement `FfiConverter` without making this `required` and we can't
|
|
// make it `required` without making it `public`.
|
|
required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
|
self.pointer = pointer
|
|
}
|
|
|
|
/// This constructor can be used to instantiate a fake object.
|
|
/// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
|
|
///
|
|
/// - Warning:
|
|
/// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash.
|
|
public init(noPointer: NoPointer) {
|
|
self.pointer = nil
|
|
}
|
|
|
|
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
|
|
return try! rustCall { uniffi_matrix_sdk_ffi_fn_clone_widgetdriverhandle(self.pointer, $0) }
|
|
}
|
|
|
|
deinit {
|
|
guard let pointer = pointer else {
|
|
return
|
|
}
|
|
|
|
try! rustCall { uniffi_matrix_sdk_ffi_fn_free_widgetdriverhandle(pointer, $0) }
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Receive a message from the widget driver.
|
|
*
|
|
* The message must be passed on to the widget.
|
|
*
|
|
* Returns `None` if the widget driver is no longer running.
|
|
*/
|
|
open func recv() async -> String? {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_widgetdriverhandle_recv(
|
|
self.uniffiClonePointer()
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterOptionString.lift,
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
*
|
|
* Returns `false` if the widget driver is no longer running.
|
|
*/
|
|
open func send(msg: String) async -> Bool {
|
|
return try! await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_method_widgetdriverhandle_send(
|
|
self.uniffiClonePointer(),
|
|
FfiConverterString.lower(msg)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_i8,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_i8,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_i8,
|
|
liftFunc: FfiConverterBool.lift,
|
|
errorHandler: nil
|
|
|
|
)
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public struct FfiConverterTypeWidgetDriverHandle: FfiConverter {
|
|
|
|
typealias FfiType = UnsafeMutableRawPointer
|
|
typealias SwiftType = WidgetDriverHandle
|
|
|
|
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> WidgetDriverHandle {
|
|
return WidgetDriverHandle(unsafeFromRawPointer: pointer)
|
|
}
|
|
|
|
public static func lower(_ value: WidgetDriverHandle) -> UnsafeMutableRawPointer {
|
|
return value.uniffiClonePointer()
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WidgetDriverHandle {
|
|
let v: UInt64 = try readInt(&buf)
|
|
// The Rust code won't compile if a pointer won't fit in a UInt64.
|
|
// We have to go via `UInt` because that's the thing that's the size of a pointer.
|
|
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
|
|
if (ptr == nil) {
|
|
throw UniffiInternalError.unexpectedNullPointer
|
|
}
|
|
return try lift(ptr!)
|
|
}
|
|
|
|
public static func write(_ value: WidgetDriverHandle, into buf: inout [UInt8]) {
|
|
// This fiddling is because `Int` is the thing that's the same size as a pointer.
|
|
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
|
|
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public func FfiConverterTypeWidgetDriverHandle_lift(_ pointer: UnsafeMutableRawPointer) throws -> WidgetDriverHandle {
|
|
return try FfiConverterTypeWidgetDriverHandle.lift(pointer)
|
|
}
|
|
|
|
public func FfiConverterTypeWidgetDriverHandle_lower(_ value: WidgetDriverHandle) -> UnsafeMutableRawPointer {
|
|
return FfiConverterTypeWidgetDriverHandle.lower(value)
|
|
}
|
|
|
|
|
|
public struct AudioInfo {
|
|
public var duration: TimeInterval?
|
|
public var size: UInt64?
|
|
public var mimetype: String?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(duration: TimeInterval?, size: UInt64?, mimetype: String?) {
|
|
self.duration = duration
|
|
self.size = size
|
|
self.mimetype = mimetype
|
|
}
|
|
}
|
|
|
|
|
|
extension AudioInfo: Equatable, Hashable {
|
|
public static func ==(lhs: AudioInfo, rhs: AudioInfo) -> Bool {
|
|
if lhs.duration != rhs.duration {
|
|
return false
|
|
}
|
|
if lhs.size != rhs.size {
|
|
return false
|
|
}
|
|
if lhs.mimetype != rhs.mimetype {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(duration)
|
|
hasher.combine(size)
|
|
hasher.combine(mimetype)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeAudioInfo: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AudioInfo {
|
|
return
|
|
try AudioInfo(
|
|
duration: FfiConverterOptionDuration.read(from: &buf),
|
|
size: FfiConverterOptionUInt64.read(from: &buf),
|
|
mimetype: FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: AudioInfo, into buf: inout [UInt8]) {
|
|
FfiConverterOptionDuration.write(value.duration, into: &buf)
|
|
FfiConverterOptionUInt64.write(value.size, into: &buf)
|
|
FfiConverterOptionString.write(value.mimetype, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeAudioInfo_lift(_ buf: RustBuffer) throws -> AudioInfo {
|
|
return try FfiConverterTypeAudioInfo.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeAudioInfo_lower(_ value: AudioInfo) -> RustBuffer {
|
|
return FfiConverterTypeAudioInfo.lower(value)
|
|
}
|
|
|
|
|
|
public struct AudioMessageContent {
|
|
public var body: String
|
|
public var formatted: FormattedBody?
|
|
public var filename: String?
|
|
public var source: MediaSource
|
|
public var info: AudioInfo?
|
|
public var audio: UnstableAudioDetailsContent?
|
|
public var voice: UnstableVoiceContent?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(body: String, formatted: FormattedBody?, filename: String?, source: MediaSource, info: AudioInfo?, audio: UnstableAudioDetailsContent?, voice: UnstableVoiceContent?) {
|
|
self.body = body
|
|
self.formatted = formatted
|
|
self.filename = filename
|
|
self.source = source
|
|
self.info = info
|
|
self.audio = audio
|
|
self.voice = voice
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeAudioMessageContent: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AudioMessageContent {
|
|
return
|
|
try AudioMessageContent(
|
|
body: FfiConverterString.read(from: &buf),
|
|
formatted: FfiConverterOptionTypeFormattedBody.read(from: &buf),
|
|
filename: FfiConverterOptionString.read(from: &buf),
|
|
source: FfiConverterTypeMediaSource.read(from: &buf),
|
|
info: FfiConverterOptionTypeAudioInfo.read(from: &buf),
|
|
audio: FfiConverterOptionTypeUnstableAudioDetailsContent.read(from: &buf),
|
|
voice: FfiConverterOptionTypeUnstableVoiceContent.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: AudioMessageContent, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.body, into: &buf)
|
|
FfiConverterOptionTypeFormattedBody.write(value.formatted, into: &buf)
|
|
FfiConverterOptionString.write(value.filename, into: &buf)
|
|
FfiConverterTypeMediaSource.write(value.source, into: &buf)
|
|
FfiConverterOptionTypeAudioInfo.write(value.info, into: &buf)
|
|
FfiConverterOptionTypeUnstableAudioDetailsContent.write(value.audio, into: &buf)
|
|
FfiConverterOptionTypeUnstableVoiceContent.write(value.voice, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeAudioMessageContent_lift(_ buf: RustBuffer) throws -> AudioMessageContent {
|
|
return try FfiConverterTypeAudioMessageContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeAudioMessageContent_lower(_ value: AudioMessageContent) -> RustBuffer {
|
|
return FfiConverterTypeAudioMessageContent.lower(value)
|
|
}
|
|
|
|
|
|
public struct ClientProperties {
|
|
/**
|
|
* The client_id provides the widget with the option to behave differently
|
|
* for different clients. e.g org.example.ios.
|
|
*/
|
|
public var clientId: String
|
|
/**
|
|
* The language tag the client is set to e.g. en-us. (Undefined and invalid
|
|
* becomes: `en-US`)
|
|
*/
|
|
public var languageTag: String?
|
|
/**
|
|
* A string describing the theme (dark, light) or org.example.dark.
|
|
* (default: `light`)
|
|
*/
|
|
public var theme: String?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(
|
|
/**
|
|
* The client_id provides the widget with the option to behave differently
|
|
* for different clients. e.g org.example.ios.
|
|
*/clientId: String,
|
|
/**
|
|
* The language tag the client is set to e.g. en-us. (Undefined and invalid
|
|
* becomes: `en-US`)
|
|
*/languageTag: String?,
|
|
/**
|
|
* A string describing the theme (dark, light) or org.example.dark.
|
|
* (default: `light`)
|
|
*/theme: String?) {
|
|
self.clientId = clientId
|
|
self.languageTag = languageTag
|
|
self.theme = theme
|
|
}
|
|
}
|
|
|
|
|
|
extension ClientProperties: Equatable, Hashable {
|
|
public static func ==(lhs: ClientProperties, rhs: ClientProperties) -> Bool {
|
|
if lhs.clientId != rhs.clientId {
|
|
return false
|
|
}
|
|
if lhs.languageTag != rhs.languageTag {
|
|
return false
|
|
}
|
|
if lhs.theme != rhs.theme {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(clientId)
|
|
hasher.combine(languageTag)
|
|
hasher.combine(theme)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeClientProperties: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ClientProperties {
|
|
return
|
|
try ClientProperties(
|
|
clientId: FfiConverterString.read(from: &buf),
|
|
languageTag: FfiConverterOptionString.read(from: &buf),
|
|
theme: FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: ClientProperties, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.clientId, into: &buf)
|
|
FfiConverterOptionString.write(value.languageTag, into: &buf)
|
|
FfiConverterOptionString.write(value.theme, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeClientProperties_lift(_ buf: RustBuffer) throws -> ClientProperties {
|
|
return try FfiConverterTypeClientProperties.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeClientProperties_lower(_ value: ClientProperties) -> RustBuffer {
|
|
return FfiConverterTypeClientProperties.lower(value)
|
|
}
|
|
|
|
|
|
public struct CreateRoomParameters {
|
|
public var name: String?
|
|
public var topic: String?
|
|
public var isEncrypted: Bool
|
|
public var isDirect: Bool
|
|
public var visibility: RoomVisibility
|
|
public var preset: RoomPreset
|
|
public var invite: [String]?
|
|
public var avatar: String?
|
|
public var powerLevelContentOverride: PowerLevels?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(name: String?, topic: String? = nil, isEncrypted: Bool, isDirect: Bool = false, visibility: RoomVisibility, preset: RoomPreset, invite: [String]? = nil, avatar: String? = nil, powerLevelContentOverride: PowerLevels? = nil) {
|
|
self.name = name
|
|
self.topic = topic
|
|
self.isEncrypted = isEncrypted
|
|
self.isDirect = isDirect
|
|
self.visibility = visibility
|
|
self.preset = preset
|
|
self.invite = invite
|
|
self.avatar = avatar
|
|
self.powerLevelContentOverride = powerLevelContentOverride
|
|
}
|
|
}
|
|
|
|
|
|
extension CreateRoomParameters: Equatable, Hashable {
|
|
public static func ==(lhs: CreateRoomParameters, rhs: CreateRoomParameters) -> Bool {
|
|
if lhs.name != rhs.name {
|
|
return false
|
|
}
|
|
if lhs.topic != rhs.topic {
|
|
return false
|
|
}
|
|
if lhs.isEncrypted != rhs.isEncrypted {
|
|
return false
|
|
}
|
|
if lhs.isDirect != rhs.isDirect {
|
|
return false
|
|
}
|
|
if lhs.visibility != rhs.visibility {
|
|
return false
|
|
}
|
|
if lhs.preset != rhs.preset {
|
|
return false
|
|
}
|
|
if lhs.invite != rhs.invite {
|
|
return false
|
|
}
|
|
if lhs.avatar != rhs.avatar {
|
|
return false
|
|
}
|
|
if lhs.powerLevelContentOverride != rhs.powerLevelContentOverride {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(name)
|
|
hasher.combine(topic)
|
|
hasher.combine(isEncrypted)
|
|
hasher.combine(isDirect)
|
|
hasher.combine(visibility)
|
|
hasher.combine(preset)
|
|
hasher.combine(invite)
|
|
hasher.combine(avatar)
|
|
hasher.combine(powerLevelContentOverride)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeCreateRoomParameters: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CreateRoomParameters {
|
|
return
|
|
try CreateRoomParameters(
|
|
name: FfiConverterOptionString.read(from: &buf),
|
|
topic: FfiConverterOptionString.read(from: &buf),
|
|
isEncrypted: FfiConverterBool.read(from: &buf),
|
|
isDirect: FfiConverterBool.read(from: &buf),
|
|
visibility: FfiConverterTypeRoomVisibility.read(from: &buf),
|
|
preset: FfiConverterTypeRoomPreset.read(from: &buf),
|
|
invite: FfiConverterOptionSequenceString.read(from: &buf),
|
|
avatar: FfiConverterOptionString.read(from: &buf),
|
|
powerLevelContentOverride: FfiConverterOptionTypePowerLevels.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: CreateRoomParameters, into buf: inout [UInt8]) {
|
|
FfiConverterOptionString.write(value.name, into: &buf)
|
|
FfiConverterOptionString.write(value.topic, into: &buf)
|
|
FfiConverterBool.write(value.isEncrypted, into: &buf)
|
|
FfiConverterBool.write(value.isDirect, into: &buf)
|
|
FfiConverterTypeRoomVisibility.write(value.visibility, into: &buf)
|
|
FfiConverterTypeRoomPreset.write(value.preset, into: &buf)
|
|
FfiConverterOptionSequenceString.write(value.invite, into: &buf)
|
|
FfiConverterOptionString.write(value.avatar, into: &buf)
|
|
FfiConverterOptionTypePowerLevels.write(value.powerLevelContentOverride, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeCreateRoomParameters_lift(_ buf: RustBuffer) throws -> CreateRoomParameters {
|
|
return try FfiConverterTypeCreateRoomParameters.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeCreateRoomParameters_lower(_ value: CreateRoomParameters) -> RustBuffer {
|
|
return FfiConverterTypeCreateRoomParameters.lower(value)
|
|
}
|
|
|
|
|
|
public struct EmoteMessageContent {
|
|
public var body: String
|
|
public var formatted: FormattedBody?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(body: String, formatted: FormattedBody?) {
|
|
self.body = body
|
|
self.formatted = formatted
|
|
}
|
|
}
|
|
|
|
|
|
extension EmoteMessageContent: Equatable, Hashable {
|
|
public static func ==(lhs: EmoteMessageContent, rhs: EmoteMessageContent) -> Bool {
|
|
if lhs.body != rhs.body {
|
|
return false
|
|
}
|
|
if lhs.formatted != rhs.formatted {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(body)
|
|
hasher.combine(formatted)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeEmoteMessageContent: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EmoteMessageContent {
|
|
return
|
|
try EmoteMessageContent(
|
|
body: FfiConverterString.read(from: &buf),
|
|
formatted: FfiConverterOptionTypeFormattedBody.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: EmoteMessageContent, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.body, into: &buf)
|
|
FfiConverterOptionTypeFormattedBody.write(value.formatted, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeEmoteMessageContent_lift(_ buf: RustBuffer) throws -> EmoteMessageContent {
|
|
return try FfiConverterTypeEmoteMessageContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeEmoteMessageContent_lower(_ value: EmoteMessageContent) -> RustBuffer {
|
|
return FfiConverterTypeEmoteMessageContent.lower(value)
|
|
}
|
|
|
|
|
|
public struct EventTimelineItemDebugInfo {
|
|
public var model: String
|
|
public var originalJson: String?
|
|
public var latestEditJson: String?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(model: String, originalJson: String?, latestEditJson: String?) {
|
|
self.model = model
|
|
self.originalJson = originalJson
|
|
self.latestEditJson = latestEditJson
|
|
}
|
|
}
|
|
|
|
|
|
extension EventTimelineItemDebugInfo: Equatable, Hashable {
|
|
public static func ==(lhs: EventTimelineItemDebugInfo, rhs: EventTimelineItemDebugInfo) -> Bool {
|
|
if lhs.model != rhs.model {
|
|
return false
|
|
}
|
|
if lhs.originalJson != rhs.originalJson {
|
|
return false
|
|
}
|
|
if lhs.latestEditJson != rhs.latestEditJson {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(model)
|
|
hasher.combine(originalJson)
|
|
hasher.combine(latestEditJson)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeEventTimelineItemDebugInfo: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EventTimelineItemDebugInfo {
|
|
return
|
|
try EventTimelineItemDebugInfo(
|
|
model: FfiConverterString.read(from: &buf),
|
|
originalJson: FfiConverterOptionString.read(from: &buf),
|
|
latestEditJson: FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: EventTimelineItemDebugInfo, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.model, into: &buf)
|
|
FfiConverterOptionString.write(value.originalJson, into: &buf)
|
|
FfiConverterOptionString.write(value.latestEditJson, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeEventTimelineItemDebugInfo_lift(_ buf: RustBuffer) throws -> EventTimelineItemDebugInfo {
|
|
return try FfiConverterTypeEventTimelineItemDebugInfo.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeEventTimelineItemDebugInfo_lower(_ value: EventTimelineItemDebugInfo) -> RustBuffer {
|
|
return FfiConverterTypeEventTimelineItemDebugInfo.lower(value)
|
|
}
|
|
|
|
|
|
public struct FileInfo {
|
|
public var mimetype: String?
|
|
public var size: UInt64?
|
|
public var thumbnailInfo: ThumbnailInfo?
|
|
public var thumbnailSource: MediaSource?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(mimetype: String?, size: UInt64?, thumbnailInfo: ThumbnailInfo?, thumbnailSource: MediaSource?) {
|
|
self.mimetype = mimetype
|
|
self.size = size
|
|
self.thumbnailInfo = thumbnailInfo
|
|
self.thumbnailSource = thumbnailSource
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeFileInfo: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FileInfo {
|
|
return
|
|
try FileInfo(
|
|
mimetype: FfiConverterOptionString.read(from: &buf),
|
|
size: FfiConverterOptionUInt64.read(from: &buf),
|
|
thumbnailInfo: FfiConverterOptionTypeThumbnailInfo.read(from: &buf),
|
|
thumbnailSource: FfiConverterOptionTypeMediaSource.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: FileInfo, into buf: inout [UInt8]) {
|
|
FfiConverterOptionString.write(value.mimetype, into: &buf)
|
|
FfiConverterOptionUInt64.write(value.size, into: &buf)
|
|
FfiConverterOptionTypeThumbnailInfo.write(value.thumbnailInfo, into: &buf)
|
|
FfiConverterOptionTypeMediaSource.write(value.thumbnailSource, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeFileInfo_lift(_ buf: RustBuffer) throws -> FileInfo {
|
|
return try FfiConverterTypeFileInfo.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeFileInfo_lower(_ value: FileInfo) -> RustBuffer {
|
|
return FfiConverterTypeFileInfo.lower(value)
|
|
}
|
|
|
|
|
|
public struct FileMessageContent {
|
|
public var body: String
|
|
public var formatted: FormattedBody?
|
|
public var filename: String?
|
|
public var source: MediaSource
|
|
public var info: FileInfo?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(body: String, formatted: FormattedBody?, filename: String?, source: MediaSource, info: FileInfo?) {
|
|
self.body = body
|
|
self.formatted = formatted
|
|
self.filename = filename
|
|
self.source = source
|
|
self.info = info
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeFileMessageContent: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FileMessageContent {
|
|
return
|
|
try FileMessageContent(
|
|
body: FfiConverterString.read(from: &buf),
|
|
formatted: FfiConverterOptionTypeFormattedBody.read(from: &buf),
|
|
filename: FfiConverterOptionString.read(from: &buf),
|
|
source: FfiConverterTypeMediaSource.read(from: &buf),
|
|
info: FfiConverterOptionTypeFileInfo.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: FileMessageContent, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.body, into: &buf)
|
|
FfiConverterOptionTypeFormattedBody.write(value.formatted, into: &buf)
|
|
FfiConverterOptionString.write(value.filename, into: &buf)
|
|
FfiConverterTypeMediaSource.write(value.source, into: &buf)
|
|
FfiConverterOptionTypeFileInfo.write(value.info, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeFileMessageContent_lift(_ buf: RustBuffer) throws -> FileMessageContent {
|
|
return try FfiConverterTypeFileMessageContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeFileMessageContent_lower(_ value: FileMessageContent) -> RustBuffer {
|
|
return FfiConverterTypeFileMessageContent.lower(value)
|
|
}
|
|
|
|
|
|
public struct FormattedBody {
|
|
public var format: MessageFormat
|
|
public var body: String
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(format: MessageFormat, body: String) {
|
|
self.format = format
|
|
self.body = body
|
|
}
|
|
}
|
|
|
|
|
|
extension FormattedBody: Equatable, Hashable {
|
|
public static func ==(lhs: FormattedBody, rhs: FormattedBody) -> Bool {
|
|
if lhs.format != rhs.format {
|
|
return false
|
|
}
|
|
if lhs.body != rhs.body {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(format)
|
|
hasher.combine(body)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeFormattedBody: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FormattedBody {
|
|
return
|
|
try FormattedBody(
|
|
format: FfiConverterTypeMessageFormat.read(from: &buf),
|
|
body: FfiConverterString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: FormattedBody, into buf: inout [UInt8]) {
|
|
FfiConverterTypeMessageFormat.write(value.format, into: &buf)
|
|
FfiConverterString.write(value.body, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeFormattedBody_lift(_ buf: RustBuffer) throws -> FormattedBody {
|
|
return try FfiConverterTypeFormattedBody.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeFormattedBody_lower(_ value: FormattedBody) -> RustBuffer {
|
|
return FfiConverterTypeFormattedBody.lower(value)
|
|
}
|
|
|
|
|
|
public struct HttpPusherData {
|
|
public var url: String
|
|
public var format: PushFormat?
|
|
public var defaultPayload: String?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(url: String, format: PushFormat?, defaultPayload: String?) {
|
|
self.url = url
|
|
self.format = format
|
|
self.defaultPayload = defaultPayload
|
|
}
|
|
}
|
|
|
|
|
|
extension HttpPusherData: Equatable, Hashable {
|
|
public static func ==(lhs: HttpPusherData, rhs: HttpPusherData) -> Bool {
|
|
if lhs.url != rhs.url {
|
|
return false
|
|
}
|
|
if lhs.format != rhs.format {
|
|
return false
|
|
}
|
|
if lhs.defaultPayload != rhs.defaultPayload {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(url)
|
|
hasher.combine(format)
|
|
hasher.combine(defaultPayload)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeHttpPusherData: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> HttpPusherData {
|
|
return
|
|
try HttpPusherData(
|
|
url: FfiConverterString.read(from: &buf),
|
|
format: FfiConverterOptionTypePushFormat.read(from: &buf),
|
|
defaultPayload: FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: HttpPusherData, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.url, into: &buf)
|
|
FfiConverterOptionTypePushFormat.write(value.format, into: &buf)
|
|
FfiConverterOptionString.write(value.defaultPayload, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeHttpPusherData_lift(_ buf: RustBuffer) throws -> HttpPusherData {
|
|
return try FfiConverterTypeHttpPusherData.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeHttpPusherData_lower(_ value: HttpPusherData) -> RustBuffer {
|
|
return FfiConverterTypeHttpPusherData.lower(value)
|
|
}
|
|
|
|
|
|
public struct ImageInfo {
|
|
public var height: UInt64?
|
|
public var width: UInt64?
|
|
public var mimetype: String?
|
|
public var size: UInt64?
|
|
public var thumbnailInfo: ThumbnailInfo?
|
|
public var thumbnailSource: MediaSource?
|
|
public var blurhash: String?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(height: UInt64?, width: UInt64?, mimetype: String?, size: UInt64?, thumbnailInfo: ThumbnailInfo?, thumbnailSource: MediaSource?, blurhash: String?) {
|
|
self.height = height
|
|
self.width = width
|
|
self.mimetype = mimetype
|
|
self.size = size
|
|
self.thumbnailInfo = thumbnailInfo
|
|
self.thumbnailSource = thumbnailSource
|
|
self.blurhash = blurhash
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeImageInfo: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ImageInfo {
|
|
return
|
|
try ImageInfo(
|
|
height: FfiConverterOptionUInt64.read(from: &buf),
|
|
width: FfiConverterOptionUInt64.read(from: &buf),
|
|
mimetype: FfiConverterOptionString.read(from: &buf),
|
|
size: FfiConverterOptionUInt64.read(from: &buf),
|
|
thumbnailInfo: FfiConverterOptionTypeThumbnailInfo.read(from: &buf),
|
|
thumbnailSource: FfiConverterOptionTypeMediaSource.read(from: &buf),
|
|
blurhash: FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: ImageInfo, into buf: inout [UInt8]) {
|
|
FfiConverterOptionUInt64.write(value.height, into: &buf)
|
|
FfiConverterOptionUInt64.write(value.width, into: &buf)
|
|
FfiConverterOptionString.write(value.mimetype, into: &buf)
|
|
FfiConverterOptionUInt64.write(value.size, into: &buf)
|
|
FfiConverterOptionTypeThumbnailInfo.write(value.thumbnailInfo, into: &buf)
|
|
FfiConverterOptionTypeMediaSource.write(value.thumbnailSource, into: &buf)
|
|
FfiConverterOptionString.write(value.blurhash, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeImageInfo_lift(_ buf: RustBuffer) throws -> ImageInfo {
|
|
return try FfiConverterTypeImageInfo.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeImageInfo_lower(_ value: ImageInfo) -> RustBuffer {
|
|
return FfiConverterTypeImageInfo.lower(value)
|
|
}
|
|
|
|
|
|
public struct ImageMessageContent {
|
|
public var body: String
|
|
public var formatted: FormattedBody?
|
|
public var filename: String?
|
|
public var source: MediaSource
|
|
public var info: ImageInfo?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(body: String, formatted: FormattedBody?, filename: String?, source: MediaSource, info: ImageInfo?) {
|
|
self.body = body
|
|
self.formatted = formatted
|
|
self.filename = filename
|
|
self.source = source
|
|
self.info = info
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeImageMessageContent: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ImageMessageContent {
|
|
return
|
|
try ImageMessageContent(
|
|
body: FfiConverterString.read(from: &buf),
|
|
formatted: FfiConverterOptionTypeFormattedBody.read(from: &buf),
|
|
filename: FfiConverterOptionString.read(from: &buf),
|
|
source: FfiConverterTypeMediaSource.read(from: &buf),
|
|
info: FfiConverterOptionTypeImageInfo.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: ImageMessageContent, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.body, into: &buf)
|
|
FfiConverterOptionTypeFormattedBody.write(value.formatted, into: &buf)
|
|
FfiConverterOptionString.write(value.filename, into: &buf)
|
|
FfiConverterTypeMediaSource.write(value.source, into: &buf)
|
|
FfiConverterOptionTypeImageInfo.write(value.info, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeImageMessageContent_lift(_ buf: RustBuffer) throws -> ImageMessageContent {
|
|
return try FfiConverterTypeImageMessageContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeImageMessageContent_lower(_ value: ImageMessageContent) -> RustBuffer {
|
|
return FfiConverterTypeImageMessageContent.lower(value)
|
|
}
|
|
|
|
|
|
public struct InReplyToDetails {
|
|
public var eventId: String
|
|
public var event: RepliedToEventDetails
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(eventId: String, event: RepliedToEventDetails) {
|
|
self.eventId = eventId
|
|
self.event = event
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeInReplyToDetails: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> InReplyToDetails {
|
|
return
|
|
try InReplyToDetails(
|
|
eventId: FfiConverterString.read(from: &buf),
|
|
event: FfiConverterTypeRepliedToEventDetails.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: InReplyToDetails, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.eventId, into: &buf)
|
|
FfiConverterTypeRepliedToEventDetails.write(value.event, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeInReplyToDetails_lift(_ buf: RustBuffer) throws -> InReplyToDetails {
|
|
return try FfiConverterTypeInReplyToDetails.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeInReplyToDetails_lower(_ value: InReplyToDetails) -> RustBuffer {
|
|
return FfiConverterTypeInReplyToDetails.lower(value)
|
|
}
|
|
|
|
|
|
public struct InsertData {
|
|
public var index: UInt32
|
|
public var item: TimelineItem
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(index: UInt32, item: TimelineItem) {
|
|
self.index = index
|
|
self.item = item
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeInsertData: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> InsertData {
|
|
return
|
|
try InsertData(
|
|
index: FfiConverterUInt32.read(from: &buf),
|
|
item: FfiConverterTypeTimelineItem.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: InsertData, into buf: inout [UInt8]) {
|
|
FfiConverterUInt32.write(value.index, into: &buf)
|
|
FfiConverterTypeTimelineItem.write(value.item, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeInsertData_lift(_ buf: RustBuffer) throws -> InsertData {
|
|
return try FfiConverterTypeInsertData.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeInsertData_lower(_ value: InsertData) -> RustBuffer {
|
|
return FfiConverterTypeInsertData.lower(value)
|
|
}
|
|
|
|
|
|
public struct LocationContent {
|
|
public var body: String
|
|
public var geoUri: String
|
|
public var description: String?
|
|
public var zoomLevel: UInt8?
|
|
public var asset: AssetType?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(body: String, geoUri: String, description: String?, zoomLevel: UInt8?, asset: AssetType?) {
|
|
self.body = body
|
|
self.geoUri = geoUri
|
|
self.description = description
|
|
self.zoomLevel = zoomLevel
|
|
self.asset = asset
|
|
}
|
|
}
|
|
|
|
|
|
extension LocationContent: Equatable, Hashable {
|
|
public static func ==(lhs: LocationContent, rhs: LocationContent) -> Bool {
|
|
if lhs.body != rhs.body {
|
|
return false
|
|
}
|
|
if lhs.geoUri != rhs.geoUri {
|
|
return false
|
|
}
|
|
if lhs.description != rhs.description {
|
|
return false
|
|
}
|
|
if lhs.zoomLevel != rhs.zoomLevel {
|
|
return false
|
|
}
|
|
if lhs.asset != rhs.asset {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(body)
|
|
hasher.combine(geoUri)
|
|
hasher.combine(description)
|
|
hasher.combine(zoomLevel)
|
|
hasher.combine(asset)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeLocationContent: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LocationContent {
|
|
return
|
|
try LocationContent(
|
|
body: FfiConverterString.read(from: &buf),
|
|
geoUri: FfiConverterString.read(from: &buf),
|
|
description: FfiConverterOptionString.read(from: &buf),
|
|
zoomLevel: FfiConverterOptionUInt8.read(from: &buf),
|
|
asset: FfiConverterOptionTypeAssetType.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: LocationContent, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.body, into: &buf)
|
|
FfiConverterString.write(value.geoUri, into: &buf)
|
|
FfiConverterOptionString.write(value.description, into: &buf)
|
|
FfiConverterOptionUInt8.write(value.zoomLevel, into: &buf)
|
|
FfiConverterOptionTypeAssetType.write(value.asset, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeLocationContent_lift(_ buf: RustBuffer) throws -> LocationContent {
|
|
return try FfiConverterTypeLocationContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeLocationContent_lower(_ value: LocationContent) -> RustBuffer {
|
|
return FfiConverterTypeLocationContent.lower(value)
|
|
}
|
|
|
|
|
|
/**
|
|
* A Matrix entity that can be a room, room alias, user, or event, and a list
|
|
* of via servers.
|
|
*/
|
|
public struct MatrixEntity {
|
|
public var id: MatrixId
|
|
public var via: [String]
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(id: MatrixId, via: [String]) {
|
|
self.id = id
|
|
self.via = via
|
|
}
|
|
}
|
|
|
|
|
|
extension MatrixEntity: Equatable, Hashable {
|
|
public static func ==(lhs: MatrixEntity, rhs: MatrixEntity) -> Bool {
|
|
if lhs.id != rhs.id {
|
|
return false
|
|
}
|
|
if lhs.via != rhs.via {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(id)
|
|
hasher.combine(via)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeMatrixEntity: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MatrixEntity {
|
|
return
|
|
try MatrixEntity(
|
|
id: FfiConverterTypeMatrixId.read(from: &buf),
|
|
via: FfiConverterSequenceString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: MatrixEntity, into buf: inout [UInt8]) {
|
|
FfiConverterTypeMatrixId.write(value.id, into: &buf)
|
|
FfiConverterSequenceString.write(value.via, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeMatrixEntity_lift(_ buf: RustBuffer) throws -> MatrixEntity {
|
|
return try FfiConverterTypeMatrixEntity.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeMatrixEntity_lower(_ value: MatrixEntity) -> RustBuffer {
|
|
return FfiConverterTypeMatrixEntity.lower(value)
|
|
}
|
|
|
|
|
|
public struct Mentions {
|
|
public var userIds: [String]
|
|
public var room: Bool
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(userIds: [String], room: Bool) {
|
|
self.userIds = userIds
|
|
self.room = room
|
|
}
|
|
}
|
|
|
|
|
|
extension Mentions: Equatable, Hashable {
|
|
public static func ==(lhs: Mentions, rhs: Mentions) -> Bool {
|
|
if lhs.userIds != rhs.userIds {
|
|
return false
|
|
}
|
|
if lhs.room != rhs.room {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(userIds)
|
|
hasher.combine(room)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeMentions: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Mentions {
|
|
return
|
|
try Mentions(
|
|
userIds: FfiConverterSequenceString.read(from: &buf),
|
|
room: FfiConverterBool.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: Mentions, into buf: inout [UInt8]) {
|
|
FfiConverterSequenceString.write(value.userIds, into: &buf)
|
|
FfiConverterBool.write(value.room, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeMentions_lift(_ buf: RustBuffer) throws -> Mentions {
|
|
return try FfiConverterTypeMentions.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeMentions_lower(_ value: Mentions) -> RustBuffer {
|
|
return FfiConverterTypeMentions.lower(value)
|
|
}
|
|
|
|
|
|
public struct NoticeMessageContent {
|
|
public var body: String
|
|
public var formatted: FormattedBody?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(body: String, formatted: FormattedBody?) {
|
|
self.body = body
|
|
self.formatted = formatted
|
|
}
|
|
}
|
|
|
|
|
|
extension NoticeMessageContent: Equatable, Hashable {
|
|
public static func ==(lhs: NoticeMessageContent, rhs: NoticeMessageContent) -> Bool {
|
|
if lhs.body != rhs.body {
|
|
return false
|
|
}
|
|
if lhs.formatted != rhs.formatted {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(body)
|
|
hasher.combine(formatted)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeNoticeMessageContent: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NoticeMessageContent {
|
|
return
|
|
try NoticeMessageContent(
|
|
body: FfiConverterString.read(from: &buf),
|
|
formatted: FfiConverterOptionTypeFormattedBody.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: NoticeMessageContent, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.body, into: &buf)
|
|
FfiConverterOptionTypeFormattedBody.write(value.formatted, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeNoticeMessageContent_lift(_ buf: RustBuffer) throws -> NoticeMessageContent {
|
|
return try FfiConverterTypeNoticeMessageContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeNoticeMessageContent_lower(_ value: NoticeMessageContent) -> RustBuffer {
|
|
return FfiConverterTypeNoticeMessageContent.lower(value)
|
|
}
|
|
|
|
|
|
public struct NotificationItem {
|
|
public var event: NotificationEvent
|
|
public var senderInfo: NotificationSenderInfo
|
|
public var roomInfo: NotificationRoomInfo
|
|
/**
|
|
* Is the notification supposed to be at the "noisy" level?
|
|
* Can be `None` if we couldn't determine this, because we lacked
|
|
* information to create a push context.
|
|
*/
|
|
public var isNoisy: Bool?
|
|
public var hasMention: Bool?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(event: NotificationEvent, senderInfo: NotificationSenderInfo, roomInfo: NotificationRoomInfo,
|
|
/**
|
|
* Is the notification supposed to be at the "noisy" level?
|
|
* Can be `None` if we couldn't determine this, because we lacked
|
|
* information to create a push context.
|
|
*/isNoisy: Bool?, hasMention: Bool?) {
|
|
self.event = event
|
|
self.senderInfo = senderInfo
|
|
self.roomInfo = roomInfo
|
|
self.isNoisy = isNoisy
|
|
self.hasMention = hasMention
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeNotificationItem: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationItem {
|
|
return
|
|
try NotificationItem(
|
|
event: FfiConverterTypeNotificationEvent.read(from: &buf),
|
|
senderInfo: FfiConverterTypeNotificationSenderInfo.read(from: &buf),
|
|
roomInfo: FfiConverterTypeNotificationRoomInfo.read(from: &buf),
|
|
isNoisy: FfiConverterOptionBool.read(from: &buf),
|
|
hasMention: FfiConverterOptionBool.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: NotificationItem, into buf: inout [UInt8]) {
|
|
FfiConverterTypeNotificationEvent.write(value.event, into: &buf)
|
|
FfiConverterTypeNotificationSenderInfo.write(value.senderInfo, into: &buf)
|
|
FfiConverterTypeNotificationRoomInfo.write(value.roomInfo, into: &buf)
|
|
FfiConverterOptionBool.write(value.isNoisy, into: &buf)
|
|
FfiConverterOptionBool.write(value.hasMention, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeNotificationItem_lift(_ buf: RustBuffer) throws -> NotificationItem {
|
|
return try FfiConverterTypeNotificationItem.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeNotificationItem_lower(_ value: NotificationItem) -> RustBuffer {
|
|
return FfiConverterTypeNotificationItem.lower(value)
|
|
}
|
|
|
|
|
|
public struct NotificationPowerLevels {
|
|
public var room: Int32
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(room: Int32) {
|
|
self.room = room
|
|
}
|
|
}
|
|
|
|
|
|
extension NotificationPowerLevels: Equatable, Hashable {
|
|
public static func ==(lhs: NotificationPowerLevels, rhs: NotificationPowerLevels) -> Bool {
|
|
if lhs.room != rhs.room {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(room)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeNotificationPowerLevels: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationPowerLevels {
|
|
return
|
|
try NotificationPowerLevels(
|
|
room: FfiConverterInt32.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: NotificationPowerLevels, into buf: inout [UInt8]) {
|
|
FfiConverterInt32.write(value.room, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeNotificationPowerLevels_lift(_ buf: RustBuffer) throws -> NotificationPowerLevels {
|
|
return try FfiConverterTypeNotificationPowerLevels.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeNotificationPowerLevels_lower(_ value: NotificationPowerLevels) -> RustBuffer {
|
|
return FfiConverterTypeNotificationPowerLevels.lower(value)
|
|
}
|
|
|
|
|
|
public struct NotificationRoomInfo {
|
|
public var displayName: String
|
|
public var avatarUrl: String?
|
|
public var canonicalAlias: String?
|
|
public var joinedMembersCount: UInt64
|
|
public var isEncrypted: Bool?
|
|
public var isDirect: Bool
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(displayName: String, avatarUrl: String?, canonicalAlias: String?, joinedMembersCount: UInt64, isEncrypted: Bool?, isDirect: Bool) {
|
|
self.displayName = displayName
|
|
self.avatarUrl = avatarUrl
|
|
self.canonicalAlias = canonicalAlias
|
|
self.joinedMembersCount = joinedMembersCount
|
|
self.isEncrypted = isEncrypted
|
|
self.isDirect = isDirect
|
|
}
|
|
}
|
|
|
|
|
|
extension NotificationRoomInfo: Equatable, Hashable {
|
|
public static func ==(lhs: NotificationRoomInfo, rhs: NotificationRoomInfo) -> Bool {
|
|
if lhs.displayName != rhs.displayName {
|
|
return false
|
|
}
|
|
if lhs.avatarUrl != rhs.avatarUrl {
|
|
return false
|
|
}
|
|
if lhs.canonicalAlias != rhs.canonicalAlias {
|
|
return false
|
|
}
|
|
if lhs.joinedMembersCount != rhs.joinedMembersCount {
|
|
return false
|
|
}
|
|
if lhs.isEncrypted != rhs.isEncrypted {
|
|
return false
|
|
}
|
|
if lhs.isDirect != rhs.isDirect {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(displayName)
|
|
hasher.combine(avatarUrl)
|
|
hasher.combine(canonicalAlias)
|
|
hasher.combine(joinedMembersCount)
|
|
hasher.combine(isEncrypted)
|
|
hasher.combine(isDirect)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeNotificationRoomInfo: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationRoomInfo {
|
|
return
|
|
try NotificationRoomInfo(
|
|
displayName: FfiConverterString.read(from: &buf),
|
|
avatarUrl: FfiConverterOptionString.read(from: &buf),
|
|
canonicalAlias: FfiConverterOptionString.read(from: &buf),
|
|
joinedMembersCount: FfiConverterUInt64.read(from: &buf),
|
|
isEncrypted: FfiConverterOptionBool.read(from: &buf),
|
|
isDirect: FfiConverterBool.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: NotificationRoomInfo, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.displayName, into: &buf)
|
|
FfiConverterOptionString.write(value.avatarUrl, into: &buf)
|
|
FfiConverterOptionString.write(value.canonicalAlias, into: &buf)
|
|
FfiConverterUInt64.write(value.joinedMembersCount, into: &buf)
|
|
FfiConverterOptionBool.write(value.isEncrypted, into: &buf)
|
|
FfiConverterBool.write(value.isDirect, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeNotificationRoomInfo_lift(_ buf: RustBuffer) throws -> NotificationRoomInfo {
|
|
return try FfiConverterTypeNotificationRoomInfo.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeNotificationRoomInfo_lower(_ value: NotificationRoomInfo) -> RustBuffer {
|
|
return FfiConverterTypeNotificationRoomInfo.lower(value)
|
|
}
|
|
|
|
|
|
public struct NotificationSenderInfo {
|
|
public var displayName: String?
|
|
public var avatarUrl: String?
|
|
public var isNameAmbiguous: Bool
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(displayName: String?, avatarUrl: String?, isNameAmbiguous: Bool) {
|
|
self.displayName = displayName
|
|
self.avatarUrl = avatarUrl
|
|
self.isNameAmbiguous = isNameAmbiguous
|
|
}
|
|
}
|
|
|
|
|
|
extension NotificationSenderInfo: Equatable, Hashable {
|
|
public static func ==(lhs: NotificationSenderInfo, rhs: NotificationSenderInfo) -> Bool {
|
|
if lhs.displayName != rhs.displayName {
|
|
return false
|
|
}
|
|
if lhs.avatarUrl != rhs.avatarUrl {
|
|
return false
|
|
}
|
|
if lhs.isNameAmbiguous != rhs.isNameAmbiguous {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(displayName)
|
|
hasher.combine(avatarUrl)
|
|
hasher.combine(isNameAmbiguous)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeNotificationSenderInfo: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationSenderInfo {
|
|
return
|
|
try NotificationSenderInfo(
|
|
displayName: FfiConverterOptionString.read(from: &buf),
|
|
avatarUrl: FfiConverterOptionString.read(from: &buf),
|
|
isNameAmbiguous: FfiConverterBool.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: NotificationSenderInfo, into buf: inout [UInt8]) {
|
|
FfiConverterOptionString.write(value.displayName, into: &buf)
|
|
FfiConverterOptionString.write(value.avatarUrl, into: &buf)
|
|
FfiConverterBool.write(value.isNameAmbiguous, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeNotificationSenderInfo_lift(_ buf: RustBuffer) throws -> NotificationSenderInfo {
|
|
return try FfiConverterTypeNotificationSenderInfo.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeNotificationSenderInfo_lower(_ value: NotificationSenderInfo) -> RustBuffer {
|
|
return FfiConverterTypeNotificationSenderInfo.lower(value)
|
|
}
|
|
|
|
|
|
/**
|
|
* The configuration to use when authenticating with OIDC.
|
|
*/
|
|
public struct OidcConfiguration {
|
|
/**
|
|
* The name of the client that will be shown during OIDC authentication.
|
|
*/
|
|
public var clientName: String?
|
|
/**
|
|
* The redirect URI that will be used when OIDC authentication is
|
|
* successful.
|
|
*/
|
|
public var redirectUri: String
|
|
/**
|
|
* A URI that contains information about the client.
|
|
*/
|
|
public var clientUri: String?
|
|
/**
|
|
* A URI that contains the client's logo.
|
|
*/
|
|
public var logoUri: String?
|
|
/**
|
|
* A URI that contains the client's terms of service.
|
|
*/
|
|
public var tosUri: String?
|
|
/**
|
|
* A URI that contains the client's privacy policy.
|
|
*/
|
|
public var policyUri: String?
|
|
/**
|
|
* An array of e-mail addresses of people responsible for this client.
|
|
*/
|
|
public var contacts: [String]?
|
|
/**
|
|
* Pre-configured registrations for use with issuers that don't support
|
|
* dynamic client registration.
|
|
*/
|
|
public var staticRegistrations: [String: String]
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(
|
|
/**
|
|
* The name of the client that will be shown during OIDC authentication.
|
|
*/clientName: String?,
|
|
/**
|
|
* The redirect URI that will be used when OIDC authentication is
|
|
* successful.
|
|
*/redirectUri: String,
|
|
/**
|
|
* A URI that contains information about the client.
|
|
*/clientUri: String?,
|
|
/**
|
|
* A URI that contains the client's logo.
|
|
*/logoUri: String?,
|
|
/**
|
|
* A URI that contains the client's terms of service.
|
|
*/tosUri: String?,
|
|
/**
|
|
* A URI that contains the client's privacy policy.
|
|
*/policyUri: String?,
|
|
/**
|
|
* An array of e-mail addresses of people responsible for this client.
|
|
*/contacts: [String]?,
|
|
/**
|
|
* Pre-configured registrations for use with issuers that don't support
|
|
* dynamic client registration.
|
|
*/staticRegistrations: [String: String]) {
|
|
self.clientName = clientName
|
|
self.redirectUri = redirectUri
|
|
self.clientUri = clientUri
|
|
self.logoUri = logoUri
|
|
self.tosUri = tosUri
|
|
self.policyUri = policyUri
|
|
self.contacts = contacts
|
|
self.staticRegistrations = staticRegistrations
|
|
}
|
|
}
|
|
|
|
|
|
extension OidcConfiguration: Equatable, Hashable {
|
|
public static func ==(lhs: OidcConfiguration, rhs: OidcConfiguration) -> Bool {
|
|
if lhs.clientName != rhs.clientName {
|
|
return false
|
|
}
|
|
if lhs.redirectUri != rhs.redirectUri {
|
|
return false
|
|
}
|
|
if lhs.clientUri != rhs.clientUri {
|
|
return false
|
|
}
|
|
if lhs.logoUri != rhs.logoUri {
|
|
return false
|
|
}
|
|
if lhs.tosUri != rhs.tosUri {
|
|
return false
|
|
}
|
|
if lhs.policyUri != rhs.policyUri {
|
|
return false
|
|
}
|
|
if lhs.contacts != rhs.contacts {
|
|
return false
|
|
}
|
|
if lhs.staticRegistrations != rhs.staticRegistrations {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(clientName)
|
|
hasher.combine(redirectUri)
|
|
hasher.combine(clientUri)
|
|
hasher.combine(logoUri)
|
|
hasher.combine(tosUri)
|
|
hasher.combine(policyUri)
|
|
hasher.combine(contacts)
|
|
hasher.combine(staticRegistrations)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeOidcConfiguration: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OidcConfiguration {
|
|
return
|
|
try OidcConfiguration(
|
|
clientName: FfiConverterOptionString.read(from: &buf),
|
|
redirectUri: FfiConverterString.read(from: &buf),
|
|
clientUri: FfiConverterOptionString.read(from: &buf),
|
|
logoUri: FfiConverterOptionString.read(from: &buf),
|
|
tosUri: FfiConverterOptionString.read(from: &buf),
|
|
policyUri: FfiConverterOptionString.read(from: &buf),
|
|
contacts: FfiConverterOptionSequenceString.read(from: &buf),
|
|
staticRegistrations: FfiConverterDictionaryStringString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: OidcConfiguration, into buf: inout [UInt8]) {
|
|
FfiConverterOptionString.write(value.clientName, into: &buf)
|
|
FfiConverterString.write(value.redirectUri, into: &buf)
|
|
FfiConverterOptionString.write(value.clientUri, into: &buf)
|
|
FfiConverterOptionString.write(value.logoUri, into: &buf)
|
|
FfiConverterOptionString.write(value.tosUri, into: &buf)
|
|
FfiConverterOptionString.write(value.policyUri, into: &buf)
|
|
FfiConverterOptionSequenceString.write(value.contacts, into: &buf)
|
|
FfiConverterDictionaryStringString.write(value.staticRegistrations, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeOidcConfiguration_lift(_ buf: RustBuffer) throws -> OidcConfiguration {
|
|
return try FfiConverterTypeOidcConfiguration.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeOidcConfiguration_lower(_ value: OidcConfiguration) -> RustBuffer {
|
|
return FfiConverterTypeOidcConfiguration.lower(value)
|
|
}
|
|
|
|
|
|
public struct OtlpTracingConfiguration {
|
|
public var clientName: String
|
|
public var user: String
|
|
public var password: String
|
|
public var otlpEndpoint: String
|
|
public var filter: String
|
|
/**
|
|
* Controls whether to print to stdout or, equivalent, the system logs on
|
|
* Android.
|
|
*/
|
|
public var writeToStdoutOrSystem: Bool
|
|
public var writeToFiles: TracingFileConfiguration?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(clientName: String, user: String, password: String, otlpEndpoint: String, filter: String,
|
|
/**
|
|
* Controls whether to print to stdout or, equivalent, the system logs on
|
|
* Android.
|
|
*/writeToStdoutOrSystem: Bool, writeToFiles: TracingFileConfiguration?) {
|
|
self.clientName = clientName
|
|
self.user = user
|
|
self.password = password
|
|
self.otlpEndpoint = otlpEndpoint
|
|
self.filter = filter
|
|
self.writeToStdoutOrSystem = writeToStdoutOrSystem
|
|
self.writeToFiles = writeToFiles
|
|
}
|
|
}
|
|
|
|
|
|
extension OtlpTracingConfiguration: Equatable, Hashable {
|
|
public static func ==(lhs: OtlpTracingConfiguration, rhs: OtlpTracingConfiguration) -> Bool {
|
|
if lhs.clientName != rhs.clientName {
|
|
return false
|
|
}
|
|
if lhs.user != rhs.user {
|
|
return false
|
|
}
|
|
if lhs.password != rhs.password {
|
|
return false
|
|
}
|
|
if lhs.otlpEndpoint != rhs.otlpEndpoint {
|
|
return false
|
|
}
|
|
if lhs.filter != rhs.filter {
|
|
return false
|
|
}
|
|
if lhs.writeToStdoutOrSystem != rhs.writeToStdoutOrSystem {
|
|
return false
|
|
}
|
|
if lhs.writeToFiles != rhs.writeToFiles {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(clientName)
|
|
hasher.combine(user)
|
|
hasher.combine(password)
|
|
hasher.combine(otlpEndpoint)
|
|
hasher.combine(filter)
|
|
hasher.combine(writeToStdoutOrSystem)
|
|
hasher.combine(writeToFiles)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeOtlpTracingConfiguration: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OtlpTracingConfiguration {
|
|
return
|
|
try OtlpTracingConfiguration(
|
|
clientName: FfiConverterString.read(from: &buf),
|
|
user: FfiConverterString.read(from: &buf),
|
|
password: FfiConverterString.read(from: &buf),
|
|
otlpEndpoint: FfiConverterString.read(from: &buf),
|
|
filter: FfiConverterString.read(from: &buf),
|
|
writeToStdoutOrSystem: FfiConverterBool.read(from: &buf),
|
|
writeToFiles: FfiConverterOptionTypeTracingFileConfiguration.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: OtlpTracingConfiguration, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.clientName, into: &buf)
|
|
FfiConverterString.write(value.user, into: &buf)
|
|
FfiConverterString.write(value.password, into: &buf)
|
|
FfiConverterString.write(value.otlpEndpoint, into: &buf)
|
|
FfiConverterString.write(value.filter, into: &buf)
|
|
FfiConverterBool.write(value.writeToStdoutOrSystem, into: &buf)
|
|
FfiConverterOptionTypeTracingFileConfiguration.write(value.writeToFiles, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeOtlpTracingConfiguration_lift(_ buf: RustBuffer) throws -> OtlpTracingConfiguration {
|
|
return try FfiConverterTypeOtlpTracingConfiguration.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeOtlpTracingConfiguration_lower(_ value: OtlpTracingConfiguration) -> RustBuffer {
|
|
return FfiConverterTypeOtlpTracingConfiguration.lower(value)
|
|
}
|
|
|
|
|
|
public struct PollAnswer {
|
|
public var id: String
|
|
public var text: String
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(id: String, text: String) {
|
|
self.id = id
|
|
self.text = text
|
|
}
|
|
}
|
|
|
|
|
|
extension PollAnswer: Equatable, Hashable {
|
|
public static func ==(lhs: PollAnswer, rhs: PollAnswer) -> Bool {
|
|
if lhs.id != rhs.id {
|
|
return false
|
|
}
|
|
if lhs.text != rhs.text {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(id)
|
|
hasher.combine(text)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypePollAnswer: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PollAnswer {
|
|
return
|
|
try PollAnswer(
|
|
id: FfiConverterString.read(from: &buf),
|
|
text: FfiConverterString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: PollAnswer, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.id, into: &buf)
|
|
FfiConverterString.write(value.text, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypePollAnswer_lift(_ buf: RustBuffer) throws -> PollAnswer {
|
|
return try FfiConverterTypePollAnswer.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypePollAnswer_lower(_ value: PollAnswer) -> RustBuffer {
|
|
return FfiConverterTypePollAnswer.lower(value)
|
|
}
|
|
|
|
|
|
public struct PowerLevels {
|
|
public var usersDefault: Int32?
|
|
public var eventsDefault: Int32?
|
|
public var stateDefault: Int32?
|
|
public var ban: Int32?
|
|
public var kick: Int32?
|
|
public var redact: Int32?
|
|
public var invite: Int32?
|
|
public var notifications: NotificationPowerLevels?
|
|
public var users: [String: Int32]
|
|
public var events: [String: Int32]
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(usersDefault: Int32?, eventsDefault: Int32?, stateDefault: Int32?, ban: Int32?, kick: Int32?, redact: Int32?, invite: Int32?, notifications: NotificationPowerLevels?, users: [String: Int32], events: [String: Int32]) {
|
|
self.usersDefault = usersDefault
|
|
self.eventsDefault = eventsDefault
|
|
self.stateDefault = stateDefault
|
|
self.ban = ban
|
|
self.kick = kick
|
|
self.redact = redact
|
|
self.invite = invite
|
|
self.notifications = notifications
|
|
self.users = users
|
|
self.events = events
|
|
}
|
|
}
|
|
|
|
|
|
extension PowerLevels: Equatable, Hashable {
|
|
public static func ==(lhs: PowerLevels, rhs: PowerLevels) -> Bool {
|
|
if lhs.usersDefault != rhs.usersDefault {
|
|
return false
|
|
}
|
|
if lhs.eventsDefault != rhs.eventsDefault {
|
|
return false
|
|
}
|
|
if lhs.stateDefault != rhs.stateDefault {
|
|
return false
|
|
}
|
|
if lhs.ban != rhs.ban {
|
|
return false
|
|
}
|
|
if lhs.kick != rhs.kick {
|
|
return false
|
|
}
|
|
if lhs.redact != rhs.redact {
|
|
return false
|
|
}
|
|
if lhs.invite != rhs.invite {
|
|
return false
|
|
}
|
|
if lhs.notifications != rhs.notifications {
|
|
return false
|
|
}
|
|
if lhs.users != rhs.users {
|
|
return false
|
|
}
|
|
if lhs.events != rhs.events {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(usersDefault)
|
|
hasher.combine(eventsDefault)
|
|
hasher.combine(stateDefault)
|
|
hasher.combine(ban)
|
|
hasher.combine(kick)
|
|
hasher.combine(redact)
|
|
hasher.combine(invite)
|
|
hasher.combine(notifications)
|
|
hasher.combine(users)
|
|
hasher.combine(events)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypePowerLevels: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PowerLevels {
|
|
return
|
|
try PowerLevels(
|
|
usersDefault: FfiConverterOptionInt32.read(from: &buf),
|
|
eventsDefault: FfiConverterOptionInt32.read(from: &buf),
|
|
stateDefault: FfiConverterOptionInt32.read(from: &buf),
|
|
ban: FfiConverterOptionInt32.read(from: &buf),
|
|
kick: FfiConverterOptionInt32.read(from: &buf),
|
|
redact: FfiConverterOptionInt32.read(from: &buf),
|
|
invite: FfiConverterOptionInt32.read(from: &buf),
|
|
notifications: FfiConverterOptionTypeNotificationPowerLevels.read(from: &buf),
|
|
users: FfiConverterDictionaryStringInt32.read(from: &buf),
|
|
events: FfiConverterDictionaryStringInt32.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: PowerLevels, into buf: inout [UInt8]) {
|
|
FfiConverterOptionInt32.write(value.usersDefault, into: &buf)
|
|
FfiConverterOptionInt32.write(value.eventsDefault, into: &buf)
|
|
FfiConverterOptionInt32.write(value.stateDefault, into: &buf)
|
|
FfiConverterOptionInt32.write(value.ban, into: &buf)
|
|
FfiConverterOptionInt32.write(value.kick, into: &buf)
|
|
FfiConverterOptionInt32.write(value.redact, into: &buf)
|
|
FfiConverterOptionInt32.write(value.invite, into: &buf)
|
|
FfiConverterOptionTypeNotificationPowerLevels.write(value.notifications, into: &buf)
|
|
FfiConverterDictionaryStringInt32.write(value.users, into: &buf)
|
|
FfiConverterDictionaryStringInt32.write(value.events, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypePowerLevels_lift(_ buf: RustBuffer) throws -> PowerLevels {
|
|
return try FfiConverterTypePowerLevels.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypePowerLevels_lower(_ value: PowerLevels) -> RustBuffer {
|
|
return FfiConverterTypePowerLevels.lower(value)
|
|
}
|
|
|
|
|
|
public struct PusherIdentifiers {
|
|
public var pushkey: String
|
|
public var appId: String
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(pushkey: String, appId: String) {
|
|
self.pushkey = pushkey
|
|
self.appId = appId
|
|
}
|
|
}
|
|
|
|
|
|
extension PusherIdentifiers: Equatable, Hashable {
|
|
public static func ==(lhs: PusherIdentifiers, rhs: PusherIdentifiers) -> Bool {
|
|
if lhs.pushkey != rhs.pushkey {
|
|
return false
|
|
}
|
|
if lhs.appId != rhs.appId {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(pushkey)
|
|
hasher.combine(appId)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypePusherIdentifiers: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PusherIdentifiers {
|
|
return
|
|
try PusherIdentifiers(
|
|
pushkey: FfiConverterString.read(from: &buf),
|
|
appId: FfiConverterString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: PusherIdentifiers, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.pushkey, into: &buf)
|
|
FfiConverterString.write(value.appId, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypePusherIdentifiers_lift(_ buf: RustBuffer) throws -> PusherIdentifiers {
|
|
return try FfiConverterTypePusherIdentifiers.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypePusherIdentifiers_lower(_ value: PusherIdentifiers) -> RustBuffer {
|
|
return FfiConverterTypePusherIdentifiers.lower(value)
|
|
}
|
|
|
|
|
|
public struct Reaction {
|
|
public var key: String
|
|
public var count: UInt64
|
|
public var senders: [ReactionSenderData]
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(key: String, count: UInt64, senders: [ReactionSenderData]) {
|
|
self.key = key
|
|
self.count = count
|
|
self.senders = senders
|
|
}
|
|
}
|
|
|
|
|
|
extension Reaction: Equatable, Hashable {
|
|
public static func ==(lhs: Reaction, rhs: Reaction) -> Bool {
|
|
if lhs.key != rhs.key {
|
|
return false
|
|
}
|
|
if lhs.count != rhs.count {
|
|
return false
|
|
}
|
|
if lhs.senders != rhs.senders {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(key)
|
|
hasher.combine(count)
|
|
hasher.combine(senders)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeReaction: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Reaction {
|
|
return
|
|
try Reaction(
|
|
key: FfiConverterString.read(from: &buf),
|
|
count: FfiConverterUInt64.read(from: &buf),
|
|
senders: FfiConverterSequenceTypeReactionSenderData.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: Reaction, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.key, into: &buf)
|
|
FfiConverterUInt64.write(value.count, into: &buf)
|
|
FfiConverterSequenceTypeReactionSenderData.write(value.senders, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeReaction_lift(_ buf: RustBuffer) throws -> Reaction {
|
|
return try FfiConverterTypeReaction.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeReaction_lower(_ value: Reaction) -> RustBuffer {
|
|
return FfiConverterTypeReaction.lower(value)
|
|
}
|
|
|
|
|
|
public struct ReactionSenderData {
|
|
public var senderId: String
|
|
public var timestamp: UInt64
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(senderId: String, timestamp: UInt64) {
|
|
self.senderId = senderId
|
|
self.timestamp = timestamp
|
|
}
|
|
}
|
|
|
|
|
|
extension ReactionSenderData: Equatable, Hashable {
|
|
public static func ==(lhs: ReactionSenderData, rhs: ReactionSenderData) -> Bool {
|
|
if lhs.senderId != rhs.senderId {
|
|
return false
|
|
}
|
|
if lhs.timestamp != rhs.timestamp {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(senderId)
|
|
hasher.combine(timestamp)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeReactionSenderData: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ReactionSenderData {
|
|
return
|
|
try ReactionSenderData(
|
|
senderId: FfiConverterString.read(from: &buf),
|
|
timestamp: FfiConverterUInt64.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: ReactionSenderData, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.senderId, into: &buf)
|
|
FfiConverterUInt64.write(value.timestamp, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeReactionSenderData_lift(_ buf: RustBuffer) throws -> ReactionSenderData {
|
|
return try FfiConverterTypeReactionSenderData.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeReactionSenderData_lower(_ value: ReactionSenderData) -> RustBuffer {
|
|
return FfiConverterTypeReactionSenderData.lower(value)
|
|
}
|
|
|
|
|
|
public struct Receipt {
|
|
public var timestamp: UInt64?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(timestamp: UInt64?) {
|
|
self.timestamp = timestamp
|
|
}
|
|
}
|
|
|
|
|
|
extension Receipt: Equatable, Hashable {
|
|
public static func ==(lhs: Receipt, rhs: Receipt) -> Bool {
|
|
if lhs.timestamp != rhs.timestamp {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(timestamp)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeReceipt: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Receipt {
|
|
return
|
|
try Receipt(
|
|
timestamp: FfiConverterOptionUInt64.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: Receipt, into buf: inout [UInt8]) {
|
|
FfiConverterOptionUInt64.write(value.timestamp, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeReceipt_lift(_ buf: RustBuffer) throws -> Receipt {
|
|
return try FfiConverterTypeReceipt.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeReceipt_lower(_ value: Receipt) -> RustBuffer {
|
|
return FfiConverterTypeReceipt.lower(value)
|
|
}
|
|
|
|
|
|
public struct RequiredState {
|
|
public var key: String
|
|
public var value: String
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(key: String, value: String) {
|
|
self.key = key
|
|
self.value = value
|
|
}
|
|
}
|
|
|
|
|
|
extension RequiredState: Equatable, Hashable {
|
|
public static func ==(lhs: RequiredState, rhs: RequiredState) -> Bool {
|
|
if lhs.key != rhs.key {
|
|
return false
|
|
}
|
|
if lhs.value != rhs.value {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(key)
|
|
hasher.combine(value)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRequiredState: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RequiredState {
|
|
return
|
|
try RequiredState(
|
|
key: FfiConverterString.read(from: &buf),
|
|
value: FfiConverterString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RequiredState, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.key, into: &buf)
|
|
FfiConverterString.write(value.value, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRequiredState_lift(_ buf: RustBuffer) throws -> RequiredState {
|
|
return try FfiConverterTypeRequiredState.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRequiredState_lower(_ value: RequiredState) -> RustBuffer {
|
|
return FfiConverterTypeRequiredState.lower(value)
|
|
}
|
|
|
|
|
|
public struct RoomDescription {
|
|
public var roomId: String
|
|
public var name: String?
|
|
public var topic: String?
|
|
public var alias: String?
|
|
public var avatarUrl: String?
|
|
public var joinRule: PublicRoomJoinRule?
|
|
public var isWorldReadable: Bool
|
|
public var joinedMembers: UInt64
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(roomId: String, name: String?, topic: String?, alias: String?, avatarUrl: String?, joinRule: PublicRoomJoinRule?, isWorldReadable: Bool, joinedMembers: UInt64) {
|
|
self.roomId = roomId
|
|
self.name = name
|
|
self.topic = topic
|
|
self.alias = alias
|
|
self.avatarUrl = avatarUrl
|
|
self.joinRule = joinRule
|
|
self.isWorldReadable = isWorldReadable
|
|
self.joinedMembers = joinedMembers
|
|
}
|
|
}
|
|
|
|
|
|
extension RoomDescription: Equatable, Hashable {
|
|
public static func ==(lhs: RoomDescription, rhs: RoomDescription) -> Bool {
|
|
if lhs.roomId != rhs.roomId {
|
|
return false
|
|
}
|
|
if lhs.name != rhs.name {
|
|
return false
|
|
}
|
|
if lhs.topic != rhs.topic {
|
|
return false
|
|
}
|
|
if lhs.alias != rhs.alias {
|
|
return false
|
|
}
|
|
if lhs.avatarUrl != rhs.avatarUrl {
|
|
return false
|
|
}
|
|
if lhs.joinRule != rhs.joinRule {
|
|
return false
|
|
}
|
|
if lhs.isWorldReadable != rhs.isWorldReadable {
|
|
return false
|
|
}
|
|
if lhs.joinedMembers != rhs.joinedMembers {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(roomId)
|
|
hasher.combine(name)
|
|
hasher.combine(topic)
|
|
hasher.combine(alias)
|
|
hasher.combine(avatarUrl)
|
|
hasher.combine(joinRule)
|
|
hasher.combine(isWorldReadable)
|
|
hasher.combine(joinedMembers)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomDescription: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomDescription {
|
|
return
|
|
try RoomDescription(
|
|
roomId: FfiConverterString.read(from: &buf),
|
|
name: FfiConverterOptionString.read(from: &buf),
|
|
topic: FfiConverterOptionString.read(from: &buf),
|
|
alias: FfiConverterOptionString.read(from: &buf),
|
|
avatarUrl: FfiConverterOptionString.read(from: &buf),
|
|
joinRule: FfiConverterOptionTypePublicRoomJoinRule.read(from: &buf),
|
|
isWorldReadable: FfiConverterBool.read(from: &buf),
|
|
joinedMembers: FfiConverterUInt64.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomDescription, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.roomId, into: &buf)
|
|
FfiConverterOptionString.write(value.name, into: &buf)
|
|
FfiConverterOptionString.write(value.topic, into: &buf)
|
|
FfiConverterOptionString.write(value.alias, into: &buf)
|
|
FfiConverterOptionString.write(value.avatarUrl, into: &buf)
|
|
FfiConverterOptionTypePublicRoomJoinRule.write(value.joinRule, into: &buf)
|
|
FfiConverterBool.write(value.isWorldReadable, into: &buf)
|
|
FfiConverterUInt64.write(value.joinedMembers, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomDescription_lift(_ buf: RustBuffer) throws -> RoomDescription {
|
|
return try FfiConverterTypeRoomDescription.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomDescription_lower(_ value: RoomDescription) -> RustBuffer {
|
|
return FfiConverterTypeRoomDescription.lower(value)
|
|
}
|
|
|
|
|
|
public struct RoomDirectorySearchEntriesResult {
|
|
public var entriesStream: TaskHandle
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(entriesStream: TaskHandle) {
|
|
self.entriesStream = entriesStream
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeRoomDirectorySearchEntriesResult: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomDirectorySearchEntriesResult {
|
|
return
|
|
try RoomDirectorySearchEntriesResult(
|
|
entriesStream: FfiConverterTypeTaskHandle.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomDirectorySearchEntriesResult, into buf: inout [UInt8]) {
|
|
FfiConverterTypeTaskHandle.write(value.entriesStream, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomDirectorySearchEntriesResult_lift(_ buf: RustBuffer) throws -> RoomDirectorySearchEntriesResult {
|
|
return try FfiConverterTypeRoomDirectorySearchEntriesResult.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomDirectorySearchEntriesResult_lower(_ value: RoomDirectorySearchEntriesResult) -> RustBuffer {
|
|
return FfiConverterTypeRoomDirectorySearchEntriesResult.lower(value)
|
|
}
|
|
|
|
|
|
public struct RoomInfo {
|
|
public var id: String
|
|
public var name: String?
|
|
public var topic: String?
|
|
public var avatarUrl: String?
|
|
public var isDirect: Bool
|
|
public var isPublic: Bool
|
|
public var isSpace: Bool
|
|
public var isTombstoned: Bool
|
|
public var isFavourite: Bool
|
|
public var canonicalAlias: String?
|
|
public var alternativeAliases: [String]
|
|
public var membership: Membership
|
|
public var latestEvent: EventTimelineItem?
|
|
public var inviter: RoomMember?
|
|
public var activeMembersCount: UInt64
|
|
public var invitedMembersCount: UInt64
|
|
public var joinedMembersCount: UInt64
|
|
public var userPowerLevels: [String: Int64]
|
|
public var highlightCount: UInt64
|
|
public var notificationCount: UInt64
|
|
public var userDefinedNotificationMode: RoomNotificationMode?
|
|
public var hasRoomCall: Bool
|
|
public var activeRoomCallParticipants: [String]
|
|
/**
|
|
* Whether this room has been explicitly marked as unread
|
|
*/
|
|
public var isMarkedUnread: Bool
|
|
/**
|
|
* "Interesting" messages received in that room, independently of the
|
|
* notification settings.
|
|
*/
|
|
public var numUnreadMessages: UInt64
|
|
/**
|
|
* Events that will notify the user, according to their
|
|
* notification settings.
|
|
*/
|
|
public var numUnreadNotifications: UInt64
|
|
/**
|
|
* Events causing mentions/highlights for the user, according to their
|
|
* notification settings.
|
|
*/
|
|
public var numUnreadMentions: UInt64
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(id: String, name: String?, topic: String?, avatarUrl: String?, isDirect: Bool, isPublic: Bool, isSpace: Bool, isTombstoned: Bool, isFavourite: Bool, canonicalAlias: String?, alternativeAliases: [String], membership: Membership, latestEvent: EventTimelineItem?, inviter: RoomMember?, activeMembersCount: UInt64, invitedMembersCount: UInt64, joinedMembersCount: UInt64, userPowerLevels: [String: Int64], highlightCount: UInt64, notificationCount: UInt64, userDefinedNotificationMode: RoomNotificationMode?, hasRoomCall: Bool, activeRoomCallParticipants: [String],
|
|
/**
|
|
* Whether this room has been explicitly marked as unread
|
|
*/isMarkedUnread: Bool,
|
|
/**
|
|
* "Interesting" messages received in that room, independently of the
|
|
* notification settings.
|
|
*/numUnreadMessages: UInt64,
|
|
/**
|
|
* Events that will notify the user, according to their
|
|
* notification settings.
|
|
*/numUnreadNotifications: UInt64,
|
|
/**
|
|
* Events causing mentions/highlights for the user, according to their
|
|
* notification settings.
|
|
*/numUnreadMentions: UInt64) {
|
|
self.id = id
|
|
self.name = name
|
|
self.topic = topic
|
|
self.avatarUrl = avatarUrl
|
|
self.isDirect = isDirect
|
|
self.isPublic = isPublic
|
|
self.isSpace = isSpace
|
|
self.isTombstoned = isTombstoned
|
|
self.isFavourite = isFavourite
|
|
self.canonicalAlias = canonicalAlias
|
|
self.alternativeAliases = alternativeAliases
|
|
self.membership = membership
|
|
self.latestEvent = latestEvent
|
|
self.inviter = inviter
|
|
self.activeMembersCount = activeMembersCount
|
|
self.invitedMembersCount = invitedMembersCount
|
|
self.joinedMembersCount = joinedMembersCount
|
|
self.userPowerLevels = userPowerLevels
|
|
self.highlightCount = highlightCount
|
|
self.notificationCount = notificationCount
|
|
self.userDefinedNotificationMode = userDefinedNotificationMode
|
|
self.hasRoomCall = hasRoomCall
|
|
self.activeRoomCallParticipants = activeRoomCallParticipants
|
|
self.isMarkedUnread = isMarkedUnread
|
|
self.numUnreadMessages = numUnreadMessages
|
|
self.numUnreadNotifications = numUnreadNotifications
|
|
self.numUnreadMentions = numUnreadMentions
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeRoomInfo: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomInfo {
|
|
return
|
|
try RoomInfo(
|
|
id: FfiConverterString.read(from: &buf),
|
|
name: FfiConverterOptionString.read(from: &buf),
|
|
topic: FfiConverterOptionString.read(from: &buf),
|
|
avatarUrl: FfiConverterOptionString.read(from: &buf),
|
|
isDirect: FfiConverterBool.read(from: &buf),
|
|
isPublic: FfiConverterBool.read(from: &buf),
|
|
isSpace: FfiConverterBool.read(from: &buf),
|
|
isTombstoned: FfiConverterBool.read(from: &buf),
|
|
isFavourite: FfiConverterBool.read(from: &buf),
|
|
canonicalAlias: FfiConverterOptionString.read(from: &buf),
|
|
alternativeAliases: FfiConverterSequenceString.read(from: &buf),
|
|
membership: FfiConverterTypeMembership.read(from: &buf),
|
|
latestEvent: FfiConverterOptionTypeEventTimelineItem.read(from: &buf),
|
|
inviter: FfiConverterOptionTypeRoomMember.read(from: &buf),
|
|
activeMembersCount: FfiConverterUInt64.read(from: &buf),
|
|
invitedMembersCount: FfiConverterUInt64.read(from: &buf),
|
|
joinedMembersCount: FfiConverterUInt64.read(from: &buf),
|
|
userPowerLevels: FfiConverterDictionaryStringInt64.read(from: &buf),
|
|
highlightCount: FfiConverterUInt64.read(from: &buf),
|
|
notificationCount: FfiConverterUInt64.read(from: &buf),
|
|
userDefinedNotificationMode: FfiConverterOptionTypeRoomNotificationMode.read(from: &buf),
|
|
hasRoomCall: FfiConverterBool.read(from: &buf),
|
|
activeRoomCallParticipants: FfiConverterSequenceString.read(from: &buf),
|
|
isMarkedUnread: FfiConverterBool.read(from: &buf),
|
|
numUnreadMessages: FfiConverterUInt64.read(from: &buf),
|
|
numUnreadNotifications: FfiConverterUInt64.read(from: &buf),
|
|
numUnreadMentions: FfiConverterUInt64.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomInfo, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.id, into: &buf)
|
|
FfiConverterOptionString.write(value.name, into: &buf)
|
|
FfiConverterOptionString.write(value.topic, into: &buf)
|
|
FfiConverterOptionString.write(value.avatarUrl, into: &buf)
|
|
FfiConverterBool.write(value.isDirect, into: &buf)
|
|
FfiConverterBool.write(value.isPublic, into: &buf)
|
|
FfiConverterBool.write(value.isSpace, into: &buf)
|
|
FfiConverterBool.write(value.isTombstoned, into: &buf)
|
|
FfiConverterBool.write(value.isFavourite, into: &buf)
|
|
FfiConverterOptionString.write(value.canonicalAlias, into: &buf)
|
|
FfiConverterSequenceString.write(value.alternativeAliases, into: &buf)
|
|
FfiConverterTypeMembership.write(value.membership, into: &buf)
|
|
FfiConverterOptionTypeEventTimelineItem.write(value.latestEvent, into: &buf)
|
|
FfiConverterOptionTypeRoomMember.write(value.inviter, into: &buf)
|
|
FfiConverterUInt64.write(value.activeMembersCount, into: &buf)
|
|
FfiConverterUInt64.write(value.invitedMembersCount, into: &buf)
|
|
FfiConverterUInt64.write(value.joinedMembersCount, into: &buf)
|
|
FfiConverterDictionaryStringInt64.write(value.userPowerLevels, into: &buf)
|
|
FfiConverterUInt64.write(value.highlightCount, into: &buf)
|
|
FfiConverterUInt64.write(value.notificationCount, into: &buf)
|
|
FfiConverterOptionTypeRoomNotificationMode.write(value.userDefinedNotificationMode, into: &buf)
|
|
FfiConverterBool.write(value.hasRoomCall, into: &buf)
|
|
FfiConverterSequenceString.write(value.activeRoomCallParticipants, into: &buf)
|
|
FfiConverterBool.write(value.isMarkedUnread, into: &buf)
|
|
FfiConverterUInt64.write(value.numUnreadMessages, into: &buf)
|
|
FfiConverterUInt64.write(value.numUnreadNotifications, into: &buf)
|
|
FfiConverterUInt64.write(value.numUnreadMentions, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomInfo_lift(_ buf: RustBuffer) throws -> RoomInfo {
|
|
return try FfiConverterTypeRoomInfo.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomInfo_lower(_ value: RoomInfo) -> RustBuffer {
|
|
return FfiConverterTypeRoomInfo.lower(value)
|
|
}
|
|
|
|
|
|
public struct RoomListEntriesResult {
|
|
public var entries: [RoomListEntry]
|
|
public var entriesStream: TaskHandle
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(entries: [RoomListEntry], entriesStream: TaskHandle) {
|
|
self.entries = entries
|
|
self.entriesStream = entriesStream
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeRoomListEntriesResult: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListEntriesResult {
|
|
return
|
|
try RoomListEntriesResult(
|
|
entries: FfiConverterSequenceTypeRoomListEntry.read(from: &buf),
|
|
entriesStream: FfiConverterTypeTaskHandle.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomListEntriesResult, into buf: inout [UInt8]) {
|
|
FfiConverterSequenceTypeRoomListEntry.write(value.entries, into: &buf)
|
|
FfiConverterTypeTaskHandle.write(value.entriesStream, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListEntriesResult_lift(_ buf: RustBuffer) throws -> RoomListEntriesResult {
|
|
return try FfiConverterTypeRoomListEntriesResult.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListEntriesResult_lower(_ value: RoomListEntriesResult) -> RustBuffer {
|
|
return FfiConverterTypeRoomListEntriesResult.lower(value)
|
|
}
|
|
|
|
|
|
public struct RoomListEntriesWithDynamicAdaptersResult {
|
|
public var controller: RoomListDynamicEntriesController
|
|
public var entriesStream: TaskHandle
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(controller: RoomListDynamicEntriesController, entriesStream: TaskHandle) {
|
|
self.controller = controller
|
|
self.entriesStream = entriesStream
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeRoomListEntriesWithDynamicAdaptersResult: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListEntriesWithDynamicAdaptersResult {
|
|
return
|
|
try RoomListEntriesWithDynamicAdaptersResult(
|
|
controller: FfiConverterTypeRoomListDynamicEntriesController.read(from: &buf),
|
|
entriesStream: FfiConverterTypeTaskHandle.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomListEntriesWithDynamicAdaptersResult, into buf: inout [UInt8]) {
|
|
FfiConverterTypeRoomListDynamicEntriesController.write(value.controller, into: &buf)
|
|
FfiConverterTypeTaskHandle.write(value.entriesStream, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListEntriesWithDynamicAdaptersResult_lift(_ buf: RustBuffer) throws -> RoomListEntriesWithDynamicAdaptersResult {
|
|
return try FfiConverterTypeRoomListEntriesWithDynamicAdaptersResult.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListEntriesWithDynamicAdaptersResult_lower(_ value: RoomListEntriesWithDynamicAdaptersResult) -> RustBuffer {
|
|
return FfiConverterTypeRoomListEntriesWithDynamicAdaptersResult.lower(value)
|
|
}
|
|
|
|
|
|
public struct RoomListLoadingStateResult {
|
|
public var state: RoomListLoadingState
|
|
public var stateStream: TaskHandle
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(state: RoomListLoadingState, stateStream: TaskHandle) {
|
|
self.state = state
|
|
self.stateStream = stateStream
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeRoomListLoadingStateResult: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListLoadingStateResult {
|
|
return
|
|
try RoomListLoadingStateResult(
|
|
state: FfiConverterTypeRoomListLoadingState.read(from: &buf),
|
|
stateStream: FfiConverterTypeTaskHandle.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomListLoadingStateResult, into buf: inout [UInt8]) {
|
|
FfiConverterTypeRoomListLoadingState.write(value.state, into: &buf)
|
|
FfiConverterTypeTaskHandle.write(value.stateStream, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListLoadingStateResult_lift(_ buf: RustBuffer) throws -> RoomListLoadingStateResult {
|
|
return try FfiConverterTypeRoomListLoadingStateResult.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListLoadingStateResult_lower(_ value: RoomListLoadingStateResult) -> RustBuffer {
|
|
return FfiConverterTypeRoomListLoadingStateResult.lower(value)
|
|
}
|
|
|
|
|
|
public struct RoomListRange {
|
|
public var start: UInt32
|
|
public var endInclusive: UInt32
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(start: UInt32, endInclusive: UInt32) {
|
|
self.start = start
|
|
self.endInclusive = endInclusive
|
|
}
|
|
}
|
|
|
|
|
|
extension RoomListRange: Equatable, Hashable {
|
|
public static func ==(lhs: RoomListRange, rhs: RoomListRange) -> Bool {
|
|
if lhs.start != rhs.start {
|
|
return false
|
|
}
|
|
if lhs.endInclusive != rhs.endInclusive {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(start)
|
|
hasher.combine(endInclusive)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomListRange: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListRange {
|
|
return
|
|
try RoomListRange(
|
|
start: FfiConverterUInt32.read(from: &buf),
|
|
endInclusive: FfiConverterUInt32.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomListRange, into buf: inout [UInt8]) {
|
|
FfiConverterUInt32.write(value.start, into: &buf)
|
|
FfiConverterUInt32.write(value.endInclusive, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListRange_lift(_ buf: RustBuffer) throws -> RoomListRange {
|
|
return try FfiConverterTypeRoomListRange.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListRange_lower(_ value: RoomListRange) -> RustBuffer {
|
|
return FfiConverterTypeRoomListRange.lower(value)
|
|
}
|
|
|
|
|
|
public struct RoomMember {
|
|
public var userId: String
|
|
public var displayName: String?
|
|
public var avatarUrl: String?
|
|
public var membership: MembershipState
|
|
public var isNameAmbiguous: Bool
|
|
public var powerLevel: Int64
|
|
public var normalizedPowerLevel: Int64
|
|
public var isIgnored: Bool
|
|
public var suggestedRoleForPowerLevel: RoomMemberRole
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(userId: String, displayName: String?, avatarUrl: String?, membership: MembershipState, isNameAmbiguous: Bool, powerLevel: Int64, normalizedPowerLevel: Int64, isIgnored: Bool, suggestedRoleForPowerLevel: RoomMemberRole) {
|
|
self.userId = userId
|
|
self.displayName = displayName
|
|
self.avatarUrl = avatarUrl
|
|
self.membership = membership
|
|
self.isNameAmbiguous = isNameAmbiguous
|
|
self.powerLevel = powerLevel
|
|
self.normalizedPowerLevel = normalizedPowerLevel
|
|
self.isIgnored = isIgnored
|
|
self.suggestedRoleForPowerLevel = suggestedRoleForPowerLevel
|
|
}
|
|
}
|
|
|
|
|
|
extension RoomMember: Equatable, Hashable {
|
|
public static func ==(lhs: RoomMember, rhs: RoomMember) -> Bool {
|
|
if lhs.userId != rhs.userId {
|
|
return false
|
|
}
|
|
if lhs.displayName != rhs.displayName {
|
|
return false
|
|
}
|
|
if lhs.avatarUrl != rhs.avatarUrl {
|
|
return false
|
|
}
|
|
if lhs.membership != rhs.membership {
|
|
return false
|
|
}
|
|
if lhs.isNameAmbiguous != rhs.isNameAmbiguous {
|
|
return false
|
|
}
|
|
if lhs.powerLevel != rhs.powerLevel {
|
|
return false
|
|
}
|
|
if lhs.normalizedPowerLevel != rhs.normalizedPowerLevel {
|
|
return false
|
|
}
|
|
if lhs.isIgnored != rhs.isIgnored {
|
|
return false
|
|
}
|
|
if lhs.suggestedRoleForPowerLevel != rhs.suggestedRoleForPowerLevel {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(userId)
|
|
hasher.combine(displayName)
|
|
hasher.combine(avatarUrl)
|
|
hasher.combine(membership)
|
|
hasher.combine(isNameAmbiguous)
|
|
hasher.combine(powerLevel)
|
|
hasher.combine(normalizedPowerLevel)
|
|
hasher.combine(isIgnored)
|
|
hasher.combine(suggestedRoleForPowerLevel)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomMember: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomMember {
|
|
return
|
|
try RoomMember(
|
|
userId: FfiConverterString.read(from: &buf),
|
|
displayName: FfiConverterOptionString.read(from: &buf),
|
|
avatarUrl: FfiConverterOptionString.read(from: &buf),
|
|
membership: FfiConverterTypeMembershipState.read(from: &buf),
|
|
isNameAmbiguous: FfiConverterBool.read(from: &buf),
|
|
powerLevel: FfiConverterInt64.read(from: &buf),
|
|
normalizedPowerLevel: FfiConverterInt64.read(from: &buf),
|
|
isIgnored: FfiConverterBool.read(from: &buf),
|
|
suggestedRoleForPowerLevel: FfiConverterTypeRoomMemberRole.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomMember, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.userId, into: &buf)
|
|
FfiConverterOptionString.write(value.displayName, into: &buf)
|
|
FfiConverterOptionString.write(value.avatarUrl, into: &buf)
|
|
FfiConverterTypeMembershipState.write(value.membership, into: &buf)
|
|
FfiConverterBool.write(value.isNameAmbiguous, into: &buf)
|
|
FfiConverterInt64.write(value.powerLevel, into: &buf)
|
|
FfiConverterInt64.write(value.normalizedPowerLevel, into: &buf)
|
|
FfiConverterBool.write(value.isIgnored, into: &buf)
|
|
FfiConverterTypeRoomMemberRole.write(value.suggestedRoleForPowerLevel, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomMember_lift(_ buf: RustBuffer) throws -> RoomMember {
|
|
return try FfiConverterTypeRoomMember.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomMember_lower(_ value: RoomMember) -> RustBuffer {
|
|
return FfiConverterTypeRoomMember.lower(value)
|
|
}
|
|
|
|
|
|
/**
|
|
* `RoomNotificationSettings` represents the current settings for a `Room`
|
|
*/
|
|
public struct RoomNotificationSettings {
|
|
/**
|
|
* The room notification mode
|
|
*/
|
|
public var mode: RoomNotificationMode
|
|
/**
|
|
* Whether the mode is the default one
|
|
*/
|
|
public var isDefault: Bool
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(
|
|
/**
|
|
* The room notification mode
|
|
*/mode: RoomNotificationMode,
|
|
/**
|
|
* Whether the mode is the default one
|
|
*/isDefault: Bool) {
|
|
self.mode = mode
|
|
self.isDefault = isDefault
|
|
}
|
|
}
|
|
|
|
|
|
extension RoomNotificationSettings: Equatable, Hashable {
|
|
public static func ==(lhs: RoomNotificationSettings, rhs: RoomNotificationSettings) -> Bool {
|
|
if lhs.mode != rhs.mode {
|
|
return false
|
|
}
|
|
if lhs.isDefault != rhs.isDefault {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(mode)
|
|
hasher.combine(isDefault)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomNotificationSettings: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomNotificationSettings {
|
|
return
|
|
try RoomNotificationSettings(
|
|
mode: FfiConverterTypeRoomNotificationMode.read(from: &buf),
|
|
isDefault: FfiConverterBool.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomNotificationSettings, into buf: inout [UInt8]) {
|
|
FfiConverterTypeRoomNotificationMode.write(value.mode, into: &buf)
|
|
FfiConverterBool.write(value.isDefault, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomNotificationSettings_lift(_ buf: RustBuffer) throws -> RoomNotificationSettings {
|
|
return try FfiConverterTypeRoomNotificationSettings.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomNotificationSettings_lower(_ value: RoomNotificationSettings) -> RustBuffer {
|
|
return FfiConverterTypeRoomNotificationSettings.lower(value)
|
|
}
|
|
|
|
|
|
public struct RoomPowerLevels {
|
|
/**
|
|
* The level required to ban a user.
|
|
*/
|
|
public var ban: Int64
|
|
/**
|
|
* The level required to invite a user.
|
|
*/
|
|
public var invite: Int64
|
|
/**
|
|
* The level required to kick a user.
|
|
*/
|
|
public var kick: Int64
|
|
/**
|
|
* The level required to redact an event.
|
|
*/
|
|
public var redact: Int64
|
|
/**
|
|
* The default level required to send message events.
|
|
*/
|
|
public var eventsDefault: Int64
|
|
/**
|
|
* The default level required to send state events.
|
|
*/
|
|
public var stateDefault: Int64
|
|
/**
|
|
* The default power level for every user in the room.
|
|
*/
|
|
public var usersDefault: Int64
|
|
/**
|
|
* The level required to change the room's name.
|
|
*/
|
|
public var roomName: Int64
|
|
/**
|
|
* The level required to change the room's avatar.
|
|
*/
|
|
public var roomAvatar: Int64
|
|
/**
|
|
* The level required to change the room's topic.
|
|
*/
|
|
public var roomTopic: Int64
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(
|
|
/**
|
|
* The level required to ban a user.
|
|
*/ban: Int64,
|
|
/**
|
|
* The level required to invite a user.
|
|
*/invite: Int64,
|
|
/**
|
|
* The level required to kick a user.
|
|
*/kick: Int64,
|
|
/**
|
|
* The level required to redact an event.
|
|
*/redact: Int64,
|
|
/**
|
|
* The default level required to send message events.
|
|
*/eventsDefault: Int64,
|
|
/**
|
|
* The default level required to send state events.
|
|
*/stateDefault: Int64,
|
|
/**
|
|
* The default power level for every user in the room.
|
|
*/usersDefault: Int64,
|
|
/**
|
|
* The level required to change the room's name.
|
|
*/roomName: Int64,
|
|
/**
|
|
* The level required to change the room's avatar.
|
|
*/roomAvatar: Int64,
|
|
/**
|
|
* The level required to change the room's topic.
|
|
*/roomTopic: Int64) {
|
|
self.ban = ban
|
|
self.invite = invite
|
|
self.kick = kick
|
|
self.redact = redact
|
|
self.eventsDefault = eventsDefault
|
|
self.stateDefault = stateDefault
|
|
self.usersDefault = usersDefault
|
|
self.roomName = roomName
|
|
self.roomAvatar = roomAvatar
|
|
self.roomTopic = roomTopic
|
|
}
|
|
}
|
|
|
|
|
|
extension RoomPowerLevels: Equatable, Hashable {
|
|
public static func ==(lhs: RoomPowerLevels, rhs: RoomPowerLevels) -> Bool {
|
|
if lhs.ban != rhs.ban {
|
|
return false
|
|
}
|
|
if lhs.invite != rhs.invite {
|
|
return false
|
|
}
|
|
if lhs.kick != rhs.kick {
|
|
return false
|
|
}
|
|
if lhs.redact != rhs.redact {
|
|
return false
|
|
}
|
|
if lhs.eventsDefault != rhs.eventsDefault {
|
|
return false
|
|
}
|
|
if lhs.stateDefault != rhs.stateDefault {
|
|
return false
|
|
}
|
|
if lhs.usersDefault != rhs.usersDefault {
|
|
return false
|
|
}
|
|
if lhs.roomName != rhs.roomName {
|
|
return false
|
|
}
|
|
if lhs.roomAvatar != rhs.roomAvatar {
|
|
return false
|
|
}
|
|
if lhs.roomTopic != rhs.roomTopic {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(ban)
|
|
hasher.combine(invite)
|
|
hasher.combine(kick)
|
|
hasher.combine(redact)
|
|
hasher.combine(eventsDefault)
|
|
hasher.combine(stateDefault)
|
|
hasher.combine(usersDefault)
|
|
hasher.combine(roomName)
|
|
hasher.combine(roomAvatar)
|
|
hasher.combine(roomTopic)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomPowerLevels: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomPowerLevels {
|
|
return
|
|
try RoomPowerLevels(
|
|
ban: FfiConverterInt64.read(from: &buf),
|
|
invite: FfiConverterInt64.read(from: &buf),
|
|
kick: FfiConverterInt64.read(from: &buf),
|
|
redact: FfiConverterInt64.read(from: &buf),
|
|
eventsDefault: FfiConverterInt64.read(from: &buf),
|
|
stateDefault: FfiConverterInt64.read(from: &buf),
|
|
usersDefault: FfiConverterInt64.read(from: &buf),
|
|
roomName: FfiConverterInt64.read(from: &buf),
|
|
roomAvatar: FfiConverterInt64.read(from: &buf),
|
|
roomTopic: FfiConverterInt64.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomPowerLevels, into buf: inout [UInt8]) {
|
|
FfiConverterInt64.write(value.ban, into: &buf)
|
|
FfiConverterInt64.write(value.invite, into: &buf)
|
|
FfiConverterInt64.write(value.kick, into: &buf)
|
|
FfiConverterInt64.write(value.redact, into: &buf)
|
|
FfiConverterInt64.write(value.eventsDefault, into: &buf)
|
|
FfiConverterInt64.write(value.stateDefault, into: &buf)
|
|
FfiConverterInt64.write(value.usersDefault, into: &buf)
|
|
FfiConverterInt64.write(value.roomName, into: &buf)
|
|
FfiConverterInt64.write(value.roomAvatar, into: &buf)
|
|
FfiConverterInt64.write(value.roomTopic, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomPowerLevels_lift(_ buf: RustBuffer) throws -> RoomPowerLevels {
|
|
return try FfiConverterTypeRoomPowerLevels.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomPowerLevels_lower(_ value: RoomPowerLevels) -> RustBuffer {
|
|
return FfiConverterTypeRoomPowerLevels.lower(value)
|
|
}
|
|
|
|
|
|
/**
|
|
* The preview of a room, be it invited/joined/left, or not.
|
|
*/
|
|
public struct RoomPreview {
|
|
/**
|
|
* The room id for this room.
|
|
*/
|
|
public var roomId: String
|
|
/**
|
|
* The canonical alias for the room.
|
|
*/
|
|
public var canonicalAlias: String?
|
|
/**
|
|
* The room's name, if set.
|
|
*/
|
|
public var name: String?
|
|
/**
|
|
* The room's topic, if set.
|
|
*/
|
|
public var topic: String?
|
|
/**
|
|
* The MXC URI to the room's avatar, if set.
|
|
*/
|
|
public var avatarUrl: String?
|
|
/**
|
|
* The number of joined members.
|
|
*/
|
|
public var numJoinedMembers: UInt64
|
|
/**
|
|
* The room type (space, custom) or nothing, if it's a regular room.
|
|
*/
|
|
public var roomType: String?
|
|
/**
|
|
* Is the history world-readable for this room?
|
|
*/
|
|
public var isHistoryWorldReadable: Bool
|
|
/**
|
|
* Is the room joined by the current user?
|
|
*/
|
|
public var isJoined: Bool
|
|
/**
|
|
* Is the current user invited to this room?
|
|
*/
|
|
public var isInvited: Bool
|
|
/**
|
|
* is the join rule public for this room?
|
|
*/
|
|
public var isPublic: Bool
|
|
/**
|
|
* Can we knock (or restricted-knock) to this room?
|
|
*/
|
|
public var canKnock: Bool
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(
|
|
/**
|
|
* The room id for this room.
|
|
*/roomId: String,
|
|
/**
|
|
* The canonical alias for the room.
|
|
*/canonicalAlias: String?,
|
|
/**
|
|
* The room's name, if set.
|
|
*/name: String?,
|
|
/**
|
|
* The room's topic, if set.
|
|
*/topic: String?,
|
|
/**
|
|
* The MXC URI to the room's avatar, if set.
|
|
*/avatarUrl: String?,
|
|
/**
|
|
* The number of joined members.
|
|
*/numJoinedMembers: UInt64,
|
|
/**
|
|
* The room type (space, custom) or nothing, if it's a regular room.
|
|
*/roomType: String?,
|
|
/**
|
|
* Is the history world-readable for this room?
|
|
*/isHistoryWorldReadable: Bool,
|
|
/**
|
|
* Is the room joined by the current user?
|
|
*/isJoined: Bool,
|
|
/**
|
|
* Is the current user invited to this room?
|
|
*/isInvited: Bool,
|
|
/**
|
|
* is the join rule public for this room?
|
|
*/isPublic: Bool,
|
|
/**
|
|
* Can we knock (or restricted-knock) to this room?
|
|
*/canKnock: Bool) {
|
|
self.roomId = roomId
|
|
self.canonicalAlias = canonicalAlias
|
|
self.name = name
|
|
self.topic = topic
|
|
self.avatarUrl = avatarUrl
|
|
self.numJoinedMembers = numJoinedMembers
|
|
self.roomType = roomType
|
|
self.isHistoryWorldReadable = isHistoryWorldReadable
|
|
self.isJoined = isJoined
|
|
self.isInvited = isInvited
|
|
self.isPublic = isPublic
|
|
self.canKnock = canKnock
|
|
}
|
|
}
|
|
|
|
|
|
extension RoomPreview: Equatable, Hashable {
|
|
public static func ==(lhs: RoomPreview, rhs: RoomPreview) -> Bool {
|
|
if lhs.roomId != rhs.roomId {
|
|
return false
|
|
}
|
|
if lhs.canonicalAlias != rhs.canonicalAlias {
|
|
return false
|
|
}
|
|
if lhs.name != rhs.name {
|
|
return false
|
|
}
|
|
if lhs.topic != rhs.topic {
|
|
return false
|
|
}
|
|
if lhs.avatarUrl != rhs.avatarUrl {
|
|
return false
|
|
}
|
|
if lhs.numJoinedMembers != rhs.numJoinedMembers {
|
|
return false
|
|
}
|
|
if lhs.roomType != rhs.roomType {
|
|
return false
|
|
}
|
|
if lhs.isHistoryWorldReadable != rhs.isHistoryWorldReadable {
|
|
return false
|
|
}
|
|
if lhs.isJoined != rhs.isJoined {
|
|
return false
|
|
}
|
|
if lhs.isInvited != rhs.isInvited {
|
|
return false
|
|
}
|
|
if lhs.isPublic != rhs.isPublic {
|
|
return false
|
|
}
|
|
if lhs.canKnock != rhs.canKnock {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(roomId)
|
|
hasher.combine(canonicalAlias)
|
|
hasher.combine(name)
|
|
hasher.combine(topic)
|
|
hasher.combine(avatarUrl)
|
|
hasher.combine(numJoinedMembers)
|
|
hasher.combine(roomType)
|
|
hasher.combine(isHistoryWorldReadable)
|
|
hasher.combine(isJoined)
|
|
hasher.combine(isInvited)
|
|
hasher.combine(isPublic)
|
|
hasher.combine(canKnock)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomPreview: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomPreview {
|
|
return
|
|
try RoomPreview(
|
|
roomId: FfiConverterString.read(from: &buf),
|
|
canonicalAlias: FfiConverterOptionString.read(from: &buf),
|
|
name: FfiConverterOptionString.read(from: &buf),
|
|
topic: FfiConverterOptionString.read(from: &buf),
|
|
avatarUrl: FfiConverterOptionString.read(from: &buf),
|
|
numJoinedMembers: FfiConverterUInt64.read(from: &buf),
|
|
roomType: FfiConverterOptionString.read(from: &buf),
|
|
isHistoryWorldReadable: FfiConverterBool.read(from: &buf),
|
|
isJoined: FfiConverterBool.read(from: &buf),
|
|
isInvited: FfiConverterBool.read(from: &buf),
|
|
isPublic: FfiConverterBool.read(from: &buf),
|
|
canKnock: FfiConverterBool.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomPreview, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.roomId, into: &buf)
|
|
FfiConverterOptionString.write(value.canonicalAlias, into: &buf)
|
|
FfiConverterOptionString.write(value.name, into: &buf)
|
|
FfiConverterOptionString.write(value.topic, into: &buf)
|
|
FfiConverterOptionString.write(value.avatarUrl, into: &buf)
|
|
FfiConverterUInt64.write(value.numJoinedMembers, into: &buf)
|
|
FfiConverterOptionString.write(value.roomType, into: &buf)
|
|
FfiConverterBool.write(value.isHistoryWorldReadable, into: &buf)
|
|
FfiConverterBool.write(value.isJoined, into: &buf)
|
|
FfiConverterBool.write(value.isInvited, into: &buf)
|
|
FfiConverterBool.write(value.isPublic, into: &buf)
|
|
FfiConverterBool.write(value.canKnock, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomPreview_lift(_ buf: RustBuffer) throws -> RoomPreview {
|
|
return try FfiConverterTypeRoomPreview.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomPreview_lower(_ value: RoomPreview) -> RustBuffer {
|
|
return FfiConverterTypeRoomPreview.lower(value)
|
|
}
|
|
|
|
|
|
public struct RoomSubscription {
|
|
public var requiredState: [RequiredState]?
|
|
public var timelineLimit: UInt32?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(requiredState: [RequiredState]?, timelineLimit: UInt32?) {
|
|
self.requiredState = requiredState
|
|
self.timelineLimit = timelineLimit
|
|
}
|
|
}
|
|
|
|
|
|
extension RoomSubscription: Equatable, Hashable {
|
|
public static func ==(lhs: RoomSubscription, rhs: RoomSubscription) -> Bool {
|
|
if lhs.requiredState != rhs.requiredState {
|
|
return false
|
|
}
|
|
if lhs.timelineLimit != rhs.timelineLimit {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(requiredState)
|
|
hasher.combine(timelineLimit)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomSubscription: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomSubscription {
|
|
return
|
|
try RoomSubscription(
|
|
requiredState: FfiConverterOptionSequenceTypeRequiredState.read(from: &buf),
|
|
timelineLimit: FfiConverterOptionUInt32.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomSubscription, into buf: inout [UInt8]) {
|
|
FfiConverterOptionSequenceTypeRequiredState.write(value.requiredState, into: &buf)
|
|
FfiConverterOptionUInt32.write(value.timelineLimit, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomSubscription_lift(_ buf: RustBuffer) throws -> RoomSubscription {
|
|
return try FfiConverterTypeRoomSubscription.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomSubscription_lower(_ value: RoomSubscription) -> RustBuffer {
|
|
return FfiConverterTypeRoomSubscription.lower(value)
|
|
}
|
|
|
|
|
|
public struct RoomTimelineListenerResult {
|
|
public var items: [TimelineItem]
|
|
public var itemsStream: TaskHandle
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(items: [TimelineItem], itemsStream: TaskHandle) {
|
|
self.items = items
|
|
self.itemsStream = itemsStream
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeRoomTimelineListenerResult: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomTimelineListenerResult {
|
|
return
|
|
try RoomTimelineListenerResult(
|
|
items: FfiConverterSequenceTypeTimelineItem.read(from: &buf),
|
|
itemsStream: FfiConverterTypeTaskHandle.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: RoomTimelineListenerResult, into buf: inout [UInt8]) {
|
|
FfiConverterSequenceTypeTimelineItem.write(value.items, into: &buf)
|
|
FfiConverterTypeTaskHandle.write(value.itemsStream, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomTimelineListenerResult_lift(_ buf: RustBuffer) throws -> RoomTimelineListenerResult {
|
|
return try FfiConverterTypeRoomTimelineListenerResult.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomTimelineListenerResult_lower(_ value: RoomTimelineListenerResult) -> RustBuffer {
|
|
return FfiConverterTypeRoomTimelineListenerResult.lower(value)
|
|
}
|
|
|
|
|
|
public struct SearchUsersResults {
|
|
public var results: [UserProfile]
|
|
public var limited: Bool
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(results: [UserProfile], limited: Bool) {
|
|
self.results = results
|
|
self.limited = limited
|
|
}
|
|
}
|
|
|
|
|
|
extension SearchUsersResults: Equatable, Hashable {
|
|
public static func ==(lhs: SearchUsersResults, rhs: SearchUsersResults) -> Bool {
|
|
if lhs.results != rhs.results {
|
|
return false
|
|
}
|
|
if lhs.limited != rhs.limited {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(results)
|
|
hasher.combine(limited)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeSearchUsersResults: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SearchUsersResults {
|
|
return
|
|
try SearchUsersResults(
|
|
results: FfiConverterSequenceTypeUserProfile.read(from: &buf),
|
|
limited: FfiConverterBool.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: SearchUsersResults, into buf: inout [UInt8]) {
|
|
FfiConverterSequenceTypeUserProfile.write(value.results, into: &buf)
|
|
FfiConverterBool.write(value.limited, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeSearchUsersResults_lift(_ buf: RustBuffer) throws -> SearchUsersResults {
|
|
return try FfiConverterTypeSearchUsersResults.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeSearchUsersResults_lower(_ value: SearchUsersResults) -> RustBuffer {
|
|
return FfiConverterTypeSearchUsersResults.lower(value)
|
|
}
|
|
|
|
|
|
public struct Session {
|
|
/**
|
|
* The access token used for this session.
|
|
*/
|
|
public var accessToken: String
|
|
/**
|
|
* The token used for [refreshing the access token], if any.
|
|
*
|
|
* [refreshing the access token]: https://spec.matrix.org/v1.3/client-server-api/#refreshing-access-tokens
|
|
*/
|
|
public var refreshToken: String?
|
|
/**
|
|
* The user the access token was issued for.
|
|
*/
|
|
public var userId: String
|
|
/**
|
|
* The ID of the client device.
|
|
*/
|
|
public var deviceId: String
|
|
/**
|
|
* The URL for the homeserver used for this session.
|
|
*/
|
|
public var homeserverUrl: String
|
|
/**
|
|
* Additional data for this session if OpenID Connect was used for
|
|
* authentication.
|
|
*/
|
|
public var oidcData: String?
|
|
/**
|
|
* The URL for the sliding sync proxy used for this session.
|
|
*/
|
|
public var slidingSyncProxy: String?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(
|
|
/**
|
|
* The access token used for this session.
|
|
*/accessToken: String,
|
|
/**
|
|
* The token used for [refreshing the access token], if any.
|
|
*
|
|
* [refreshing the access token]: https://spec.matrix.org/v1.3/client-server-api/#refreshing-access-tokens
|
|
*/refreshToken: String?,
|
|
/**
|
|
* The user the access token was issued for.
|
|
*/userId: String,
|
|
/**
|
|
* The ID of the client device.
|
|
*/deviceId: String,
|
|
/**
|
|
* The URL for the homeserver used for this session.
|
|
*/homeserverUrl: String,
|
|
/**
|
|
* Additional data for this session if OpenID Connect was used for
|
|
* authentication.
|
|
*/oidcData: String?,
|
|
/**
|
|
* The URL for the sliding sync proxy used for this session.
|
|
*/slidingSyncProxy: String?) {
|
|
self.accessToken = accessToken
|
|
self.refreshToken = refreshToken
|
|
self.userId = userId
|
|
self.deviceId = deviceId
|
|
self.homeserverUrl = homeserverUrl
|
|
self.oidcData = oidcData
|
|
self.slidingSyncProxy = slidingSyncProxy
|
|
}
|
|
}
|
|
|
|
|
|
extension Session: Equatable, Hashable {
|
|
public static func ==(lhs: Session, rhs: Session) -> Bool {
|
|
if lhs.accessToken != rhs.accessToken {
|
|
return false
|
|
}
|
|
if lhs.refreshToken != rhs.refreshToken {
|
|
return false
|
|
}
|
|
if lhs.userId != rhs.userId {
|
|
return false
|
|
}
|
|
if lhs.deviceId != rhs.deviceId {
|
|
return false
|
|
}
|
|
if lhs.homeserverUrl != rhs.homeserverUrl {
|
|
return false
|
|
}
|
|
if lhs.oidcData != rhs.oidcData {
|
|
return false
|
|
}
|
|
if lhs.slidingSyncProxy != rhs.slidingSyncProxy {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(accessToken)
|
|
hasher.combine(refreshToken)
|
|
hasher.combine(userId)
|
|
hasher.combine(deviceId)
|
|
hasher.combine(homeserverUrl)
|
|
hasher.combine(oidcData)
|
|
hasher.combine(slidingSyncProxy)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeSession: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Session {
|
|
return
|
|
try Session(
|
|
accessToken: FfiConverterString.read(from: &buf),
|
|
refreshToken: FfiConverterOptionString.read(from: &buf),
|
|
userId: FfiConverterString.read(from: &buf),
|
|
deviceId: FfiConverterString.read(from: &buf),
|
|
homeserverUrl: FfiConverterString.read(from: &buf),
|
|
oidcData: FfiConverterOptionString.read(from: &buf),
|
|
slidingSyncProxy: FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: Session, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.accessToken, into: &buf)
|
|
FfiConverterOptionString.write(value.refreshToken, into: &buf)
|
|
FfiConverterString.write(value.userId, into: &buf)
|
|
FfiConverterString.write(value.deviceId, into: &buf)
|
|
FfiConverterString.write(value.homeserverUrl, into: &buf)
|
|
FfiConverterOptionString.write(value.oidcData, into: &buf)
|
|
FfiConverterOptionString.write(value.slidingSyncProxy, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeSession_lift(_ buf: RustBuffer) throws -> Session {
|
|
return try FfiConverterTypeSession.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeSession_lower(_ value: Session) -> RustBuffer {
|
|
return FfiConverterTypeSession.lower(value)
|
|
}
|
|
|
|
|
|
public struct SetData {
|
|
public var index: UInt32
|
|
public var item: TimelineItem
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(index: UInt32, item: TimelineItem) {
|
|
self.index = index
|
|
self.item = item
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeSetData: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SetData {
|
|
return
|
|
try SetData(
|
|
index: FfiConverterUInt32.read(from: &buf),
|
|
item: FfiConverterTypeTimelineItem.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: SetData, into buf: inout [UInt8]) {
|
|
FfiConverterUInt32.write(value.index, into: &buf)
|
|
FfiConverterTypeTimelineItem.write(value.item, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeSetData_lift(_ buf: RustBuffer) throws -> SetData {
|
|
return try FfiConverterTypeSetData.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeSetData_lower(_ value: SetData) -> RustBuffer {
|
|
return FfiConverterTypeSetData.lower(value)
|
|
}
|
|
|
|
|
|
public struct TextMessageContent {
|
|
public var body: String
|
|
public var formatted: FormattedBody?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(body: String, formatted: FormattedBody?) {
|
|
self.body = body
|
|
self.formatted = formatted
|
|
}
|
|
}
|
|
|
|
|
|
extension TextMessageContent: Equatable, Hashable {
|
|
public static func ==(lhs: TextMessageContent, rhs: TextMessageContent) -> Bool {
|
|
if lhs.body != rhs.body {
|
|
return false
|
|
}
|
|
if lhs.formatted != rhs.formatted {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(body)
|
|
hasher.combine(formatted)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeTextMessageContent: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TextMessageContent {
|
|
return
|
|
try TextMessageContent(
|
|
body: FfiConverterString.read(from: &buf),
|
|
formatted: FfiConverterOptionTypeFormattedBody.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: TextMessageContent, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.body, into: &buf)
|
|
FfiConverterOptionTypeFormattedBody.write(value.formatted, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeTextMessageContent_lift(_ buf: RustBuffer) throws -> TextMessageContent {
|
|
return try FfiConverterTypeTextMessageContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeTextMessageContent_lower(_ value: TextMessageContent) -> RustBuffer {
|
|
return FfiConverterTypeTextMessageContent.lower(value)
|
|
}
|
|
|
|
|
|
public struct ThumbnailInfo {
|
|
public var height: UInt64?
|
|
public var width: UInt64?
|
|
public var mimetype: String?
|
|
public var size: UInt64?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(height: UInt64?, width: UInt64?, mimetype: String?, size: UInt64?) {
|
|
self.height = height
|
|
self.width = width
|
|
self.mimetype = mimetype
|
|
self.size = size
|
|
}
|
|
}
|
|
|
|
|
|
extension ThumbnailInfo: Equatable, Hashable {
|
|
public static func ==(lhs: ThumbnailInfo, rhs: ThumbnailInfo) -> Bool {
|
|
if lhs.height != rhs.height {
|
|
return false
|
|
}
|
|
if lhs.width != rhs.width {
|
|
return false
|
|
}
|
|
if lhs.mimetype != rhs.mimetype {
|
|
return false
|
|
}
|
|
if lhs.size != rhs.size {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(height)
|
|
hasher.combine(width)
|
|
hasher.combine(mimetype)
|
|
hasher.combine(size)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeThumbnailInfo: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ThumbnailInfo {
|
|
return
|
|
try ThumbnailInfo(
|
|
height: FfiConverterOptionUInt64.read(from: &buf),
|
|
width: FfiConverterOptionUInt64.read(from: &buf),
|
|
mimetype: FfiConverterOptionString.read(from: &buf),
|
|
size: FfiConverterOptionUInt64.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: ThumbnailInfo, into buf: inout [UInt8]) {
|
|
FfiConverterOptionUInt64.write(value.height, into: &buf)
|
|
FfiConverterOptionUInt64.write(value.width, into: &buf)
|
|
FfiConverterOptionString.write(value.mimetype, into: &buf)
|
|
FfiConverterOptionUInt64.write(value.size, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeThumbnailInfo_lift(_ buf: RustBuffer) throws -> ThumbnailInfo {
|
|
return try FfiConverterTypeThumbnailInfo.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeThumbnailInfo_lower(_ value: ThumbnailInfo) -> RustBuffer {
|
|
return FfiConverterTypeThumbnailInfo.lower(value)
|
|
}
|
|
|
|
|
|
public struct TracingConfiguration {
|
|
public var filter: String
|
|
/**
|
|
* Controls whether to print to stdout or, equivalent, the system logs on
|
|
* Android.
|
|
*/
|
|
public var writeToStdoutOrSystem: Bool
|
|
public var writeToFiles: TracingFileConfiguration?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(filter: String,
|
|
/**
|
|
* Controls whether to print to stdout or, equivalent, the system logs on
|
|
* Android.
|
|
*/writeToStdoutOrSystem: Bool, writeToFiles: TracingFileConfiguration?) {
|
|
self.filter = filter
|
|
self.writeToStdoutOrSystem = writeToStdoutOrSystem
|
|
self.writeToFiles = writeToFiles
|
|
}
|
|
}
|
|
|
|
|
|
extension TracingConfiguration: Equatable, Hashable {
|
|
public static func ==(lhs: TracingConfiguration, rhs: TracingConfiguration) -> Bool {
|
|
if lhs.filter != rhs.filter {
|
|
return false
|
|
}
|
|
if lhs.writeToStdoutOrSystem != rhs.writeToStdoutOrSystem {
|
|
return false
|
|
}
|
|
if lhs.writeToFiles != rhs.writeToFiles {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(filter)
|
|
hasher.combine(writeToStdoutOrSystem)
|
|
hasher.combine(writeToFiles)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeTracingConfiguration: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TracingConfiguration {
|
|
return
|
|
try TracingConfiguration(
|
|
filter: FfiConverterString.read(from: &buf),
|
|
writeToStdoutOrSystem: FfiConverterBool.read(from: &buf),
|
|
writeToFiles: FfiConverterOptionTypeTracingFileConfiguration.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: TracingConfiguration, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.filter, into: &buf)
|
|
FfiConverterBool.write(value.writeToStdoutOrSystem, into: &buf)
|
|
FfiConverterOptionTypeTracingFileConfiguration.write(value.writeToFiles, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeTracingConfiguration_lift(_ buf: RustBuffer) throws -> TracingConfiguration {
|
|
return try FfiConverterTypeTracingConfiguration.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeTracingConfiguration_lower(_ value: TracingConfiguration) -> RustBuffer {
|
|
return FfiConverterTypeTracingConfiguration.lower(value)
|
|
}
|
|
|
|
|
|
public struct TracingFileConfiguration {
|
|
public var path: String
|
|
public var filePrefix: String
|
|
public var fileSuffix: String?
|
|
public var maxFiles: UInt64?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(path: String, filePrefix: String, fileSuffix: String?, maxFiles: UInt64?) {
|
|
self.path = path
|
|
self.filePrefix = filePrefix
|
|
self.fileSuffix = fileSuffix
|
|
self.maxFiles = maxFiles
|
|
}
|
|
}
|
|
|
|
|
|
extension TracingFileConfiguration: Equatable, Hashable {
|
|
public static func ==(lhs: TracingFileConfiguration, rhs: TracingFileConfiguration) -> Bool {
|
|
if lhs.path != rhs.path {
|
|
return false
|
|
}
|
|
if lhs.filePrefix != rhs.filePrefix {
|
|
return false
|
|
}
|
|
if lhs.fileSuffix != rhs.fileSuffix {
|
|
return false
|
|
}
|
|
if lhs.maxFiles != rhs.maxFiles {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(path)
|
|
hasher.combine(filePrefix)
|
|
hasher.combine(fileSuffix)
|
|
hasher.combine(maxFiles)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeTracingFileConfiguration: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TracingFileConfiguration {
|
|
return
|
|
try TracingFileConfiguration(
|
|
path: FfiConverterString.read(from: &buf),
|
|
filePrefix: FfiConverterString.read(from: &buf),
|
|
fileSuffix: FfiConverterOptionString.read(from: &buf),
|
|
maxFiles: FfiConverterOptionUInt64.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: TracingFileConfiguration, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.path, into: &buf)
|
|
FfiConverterString.write(value.filePrefix, into: &buf)
|
|
FfiConverterOptionString.write(value.fileSuffix, into: &buf)
|
|
FfiConverterOptionUInt64.write(value.maxFiles, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeTracingFileConfiguration_lift(_ buf: RustBuffer) throws -> TracingFileConfiguration {
|
|
return try FfiConverterTypeTracingFileConfiguration.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeTracingFileConfiguration_lower(_ value: TracingFileConfiguration) -> RustBuffer {
|
|
return FfiConverterTypeTracingFileConfiguration.lower(value)
|
|
}
|
|
|
|
|
|
public struct TransmissionProgress {
|
|
public var current: UInt64
|
|
public var total: UInt64
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(current: UInt64, total: UInt64) {
|
|
self.current = current
|
|
self.total = total
|
|
}
|
|
}
|
|
|
|
|
|
extension TransmissionProgress: Equatable, Hashable {
|
|
public static func ==(lhs: TransmissionProgress, rhs: TransmissionProgress) -> Bool {
|
|
if lhs.current != rhs.current {
|
|
return false
|
|
}
|
|
if lhs.total != rhs.total {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(current)
|
|
hasher.combine(total)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeTransmissionProgress: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TransmissionProgress {
|
|
return
|
|
try TransmissionProgress(
|
|
current: FfiConverterUInt64.read(from: &buf),
|
|
total: FfiConverterUInt64.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: TransmissionProgress, into buf: inout [UInt8]) {
|
|
FfiConverterUInt64.write(value.current, into: &buf)
|
|
FfiConverterUInt64.write(value.total, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeTransmissionProgress_lift(_ buf: RustBuffer) throws -> TransmissionProgress {
|
|
return try FfiConverterTypeTransmissionProgress.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeTransmissionProgress_lower(_ value: TransmissionProgress) -> RustBuffer {
|
|
return FfiConverterTypeTransmissionProgress.lower(value)
|
|
}
|
|
|
|
|
|
public struct UnableToDecryptInfo {
|
|
/**
|
|
* The identifier of the event that couldn't get decrypted.
|
|
*/
|
|
public var eventId: String
|
|
/**
|
|
* If the event could be decrypted late (that is, the event was encrypted
|
|
* at first, but could be decrypted later on), then this indicates the
|
|
* time it took to decrypt the event. If it is not set, this is
|
|
* considered a definite UTD.
|
|
*
|
|
* If set, this is in milliseconds.
|
|
*/
|
|
public var timeToDecryptMs: UInt64?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(
|
|
/**
|
|
* The identifier of the event that couldn't get decrypted.
|
|
*/eventId: String,
|
|
/**
|
|
* If the event could be decrypted late (that is, the event was encrypted
|
|
* at first, but could be decrypted later on), then this indicates the
|
|
* time it took to decrypt the event. If it is not set, this is
|
|
* considered a definite UTD.
|
|
*
|
|
* If set, this is in milliseconds.
|
|
*/timeToDecryptMs: UInt64?) {
|
|
self.eventId = eventId
|
|
self.timeToDecryptMs = timeToDecryptMs
|
|
}
|
|
}
|
|
|
|
|
|
extension UnableToDecryptInfo: Equatable, Hashable {
|
|
public static func ==(lhs: UnableToDecryptInfo, rhs: UnableToDecryptInfo) -> Bool {
|
|
if lhs.eventId != rhs.eventId {
|
|
return false
|
|
}
|
|
if lhs.timeToDecryptMs != rhs.timeToDecryptMs {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(eventId)
|
|
hasher.combine(timeToDecryptMs)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeUnableToDecryptInfo: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UnableToDecryptInfo {
|
|
return
|
|
try UnableToDecryptInfo(
|
|
eventId: FfiConverterString.read(from: &buf),
|
|
timeToDecryptMs: FfiConverterOptionUInt64.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: UnableToDecryptInfo, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.eventId, into: &buf)
|
|
FfiConverterOptionUInt64.write(value.timeToDecryptMs, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeUnableToDecryptInfo_lift(_ buf: RustBuffer) throws -> UnableToDecryptInfo {
|
|
return try FfiConverterTypeUnableToDecryptInfo.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeUnableToDecryptInfo_lower(_ value: UnableToDecryptInfo) -> RustBuffer {
|
|
return FfiConverterTypeUnableToDecryptInfo.lower(value)
|
|
}
|
|
|
|
|
|
public struct UnstableAudioDetailsContent {
|
|
public var duration: TimeInterval
|
|
public var waveform: [UInt16]
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(duration: TimeInterval, waveform: [UInt16]) {
|
|
self.duration = duration
|
|
self.waveform = waveform
|
|
}
|
|
}
|
|
|
|
|
|
extension UnstableAudioDetailsContent: Equatable, Hashable {
|
|
public static func ==(lhs: UnstableAudioDetailsContent, rhs: UnstableAudioDetailsContent) -> Bool {
|
|
if lhs.duration != rhs.duration {
|
|
return false
|
|
}
|
|
if lhs.waveform != rhs.waveform {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(duration)
|
|
hasher.combine(waveform)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeUnstableAudioDetailsContent: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UnstableAudioDetailsContent {
|
|
return
|
|
try UnstableAudioDetailsContent(
|
|
duration: FfiConverterDuration.read(from: &buf),
|
|
waveform: FfiConverterSequenceUInt16.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: UnstableAudioDetailsContent, into buf: inout [UInt8]) {
|
|
FfiConverterDuration.write(value.duration, into: &buf)
|
|
FfiConverterSequenceUInt16.write(value.waveform, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeUnstableAudioDetailsContent_lift(_ buf: RustBuffer) throws -> UnstableAudioDetailsContent {
|
|
return try FfiConverterTypeUnstableAudioDetailsContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeUnstableAudioDetailsContent_lower(_ value: UnstableAudioDetailsContent) -> RustBuffer {
|
|
return FfiConverterTypeUnstableAudioDetailsContent.lower(value)
|
|
}
|
|
|
|
|
|
public struct UnstableVoiceContent {
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init() {
|
|
}
|
|
}
|
|
|
|
|
|
extension UnstableVoiceContent: Equatable, Hashable {
|
|
public static func ==(lhs: UnstableVoiceContent, rhs: UnstableVoiceContent) -> Bool {
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeUnstableVoiceContent: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UnstableVoiceContent {
|
|
return
|
|
UnstableVoiceContent()
|
|
}
|
|
|
|
public static func write(_ value: UnstableVoiceContent, into buf: inout [UInt8]) {
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeUnstableVoiceContent_lift(_ buf: RustBuffer) throws -> UnstableVoiceContent {
|
|
return try FfiConverterTypeUnstableVoiceContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeUnstableVoiceContent_lower(_ value: UnstableVoiceContent) -> RustBuffer {
|
|
return FfiConverterTypeUnstableVoiceContent.lower(value)
|
|
}
|
|
|
|
|
|
/**
|
|
* An update for a particular user's power level within the room.
|
|
*/
|
|
public struct UserPowerLevelUpdate {
|
|
/**
|
|
* The user ID of the user to update.
|
|
*/
|
|
public var userId: String
|
|
/**
|
|
* The power level to assign to the user.
|
|
*/
|
|
public var powerLevel: Int64
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(
|
|
/**
|
|
* The user ID of the user to update.
|
|
*/userId: String,
|
|
/**
|
|
* The power level to assign to the user.
|
|
*/powerLevel: Int64) {
|
|
self.userId = userId
|
|
self.powerLevel = powerLevel
|
|
}
|
|
}
|
|
|
|
|
|
extension UserPowerLevelUpdate: Equatable, Hashable {
|
|
public static func ==(lhs: UserPowerLevelUpdate, rhs: UserPowerLevelUpdate) -> Bool {
|
|
if lhs.userId != rhs.userId {
|
|
return false
|
|
}
|
|
if lhs.powerLevel != rhs.powerLevel {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(userId)
|
|
hasher.combine(powerLevel)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeUserPowerLevelUpdate: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UserPowerLevelUpdate {
|
|
return
|
|
try UserPowerLevelUpdate(
|
|
userId: FfiConverterString.read(from: &buf),
|
|
powerLevel: FfiConverterInt64.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: UserPowerLevelUpdate, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.userId, into: &buf)
|
|
FfiConverterInt64.write(value.powerLevel, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeUserPowerLevelUpdate_lift(_ buf: RustBuffer) throws -> UserPowerLevelUpdate {
|
|
return try FfiConverterTypeUserPowerLevelUpdate.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeUserPowerLevelUpdate_lower(_ value: UserPowerLevelUpdate) -> RustBuffer {
|
|
return FfiConverterTypeUserPowerLevelUpdate.lower(value)
|
|
}
|
|
|
|
|
|
public struct UserProfile {
|
|
public var userId: String
|
|
public var displayName: String?
|
|
public var avatarUrl: String?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(userId: String, displayName: String?, avatarUrl: String?) {
|
|
self.userId = userId
|
|
self.displayName = displayName
|
|
self.avatarUrl = avatarUrl
|
|
}
|
|
}
|
|
|
|
|
|
extension UserProfile: Equatable, Hashable {
|
|
public static func ==(lhs: UserProfile, rhs: UserProfile) -> Bool {
|
|
if lhs.userId != rhs.userId {
|
|
return false
|
|
}
|
|
if lhs.displayName != rhs.displayName {
|
|
return false
|
|
}
|
|
if lhs.avatarUrl != rhs.avatarUrl {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(userId)
|
|
hasher.combine(displayName)
|
|
hasher.combine(avatarUrl)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeUserProfile: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UserProfile {
|
|
return
|
|
try UserProfile(
|
|
userId: FfiConverterString.read(from: &buf),
|
|
displayName: FfiConverterOptionString.read(from: &buf),
|
|
avatarUrl: FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: UserProfile, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.userId, into: &buf)
|
|
FfiConverterOptionString.write(value.displayName, into: &buf)
|
|
FfiConverterOptionString.write(value.avatarUrl, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeUserProfile_lift(_ buf: RustBuffer) throws -> UserProfile {
|
|
return try FfiConverterTypeUserProfile.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeUserProfile_lower(_ value: UserProfile) -> RustBuffer {
|
|
return FfiConverterTypeUserProfile.lower(value)
|
|
}
|
|
|
|
|
|
public struct VideoInfo {
|
|
public var duration: TimeInterval?
|
|
public var height: UInt64?
|
|
public var width: UInt64?
|
|
public var mimetype: String?
|
|
public var size: UInt64?
|
|
public var thumbnailInfo: ThumbnailInfo?
|
|
public var thumbnailSource: MediaSource?
|
|
public var blurhash: String?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(duration: TimeInterval?, height: UInt64?, width: UInt64?, mimetype: String?, size: UInt64?, thumbnailInfo: ThumbnailInfo?, thumbnailSource: MediaSource?, blurhash: String?) {
|
|
self.duration = duration
|
|
self.height = height
|
|
self.width = width
|
|
self.mimetype = mimetype
|
|
self.size = size
|
|
self.thumbnailInfo = thumbnailInfo
|
|
self.thumbnailSource = thumbnailSource
|
|
self.blurhash = blurhash
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeVideoInfo: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VideoInfo {
|
|
return
|
|
try VideoInfo(
|
|
duration: FfiConverterOptionDuration.read(from: &buf),
|
|
height: FfiConverterOptionUInt64.read(from: &buf),
|
|
width: FfiConverterOptionUInt64.read(from: &buf),
|
|
mimetype: FfiConverterOptionString.read(from: &buf),
|
|
size: FfiConverterOptionUInt64.read(from: &buf),
|
|
thumbnailInfo: FfiConverterOptionTypeThumbnailInfo.read(from: &buf),
|
|
thumbnailSource: FfiConverterOptionTypeMediaSource.read(from: &buf),
|
|
blurhash: FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: VideoInfo, into buf: inout [UInt8]) {
|
|
FfiConverterOptionDuration.write(value.duration, into: &buf)
|
|
FfiConverterOptionUInt64.write(value.height, into: &buf)
|
|
FfiConverterOptionUInt64.write(value.width, into: &buf)
|
|
FfiConverterOptionString.write(value.mimetype, into: &buf)
|
|
FfiConverterOptionUInt64.write(value.size, into: &buf)
|
|
FfiConverterOptionTypeThumbnailInfo.write(value.thumbnailInfo, into: &buf)
|
|
FfiConverterOptionTypeMediaSource.write(value.thumbnailSource, into: &buf)
|
|
FfiConverterOptionString.write(value.blurhash, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeVideoInfo_lift(_ buf: RustBuffer) throws -> VideoInfo {
|
|
return try FfiConverterTypeVideoInfo.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeVideoInfo_lower(_ value: VideoInfo) -> RustBuffer {
|
|
return FfiConverterTypeVideoInfo.lower(value)
|
|
}
|
|
|
|
|
|
public struct VideoMessageContent {
|
|
public var body: String
|
|
public var formatted: FormattedBody?
|
|
public var filename: String?
|
|
public var source: MediaSource
|
|
public var info: VideoInfo?
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(body: String, formatted: FormattedBody?, filename: String?, source: MediaSource, info: VideoInfo?) {
|
|
self.body = body
|
|
self.formatted = formatted
|
|
self.filename = filename
|
|
self.source = source
|
|
self.info = info
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeVideoMessageContent: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VideoMessageContent {
|
|
return
|
|
try VideoMessageContent(
|
|
body: FfiConverterString.read(from: &buf),
|
|
formatted: FfiConverterOptionTypeFormattedBody.read(from: &buf),
|
|
filename: FfiConverterOptionString.read(from: &buf),
|
|
source: FfiConverterTypeMediaSource.read(from: &buf),
|
|
info: FfiConverterOptionTypeVideoInfo.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: VideoMessageContent, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.body, into: &buf)
|
|
FfiConverterOptionTypeFormattedBody.write(value.formatted, into: &buf)
|
|
FfiConverterOptionString.write(value.filename, into: &buf)
|
|
FfiConverterTypeMediaSource.write(value.source, into: &buf)
|
|
FfiConverterOptionTypeVideoInfo.write(value.info, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeVideoMessageContent_lift(_ buf: RustBuffer) throws -> VideoMessageContent {
|
|
return try FfiConverterTypeVideoMessageContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeVideoMessageContent_lower(_ value: VideoMessageContent) -> RustBuffer {
|
|
return FfiConverterTypeVideoMessageContent.lower(value)
|
|
}
|
|
|
|
|
|
/**
|
|
* Properties to create a new virtual Element Call widget.
|
|
*/
|
|
public struct VirtualElementCallWidgetOptions {
|
|
/**
|
|
* The url to the app.
|
|
*
|
|
* E.g. <https://call.element.io>, <https://call.element.dev>
|
|
*/
|
|
public var elementCallUrl: String
|
|
/**
|
|
* The widget id.
|
|
*/
|
|
public var widgetId: String
|
|
/**
|
|
* The url that is used as the target for the PostMessages sent
|
|
* by the widget (to the client).
|
|
*
|
|
* For a web app client this is the client url. In case of using other
|
|
* platforms the client most likely is setup up to listen to
|
|
* postmessages in the same webview the widget is hosted. In this case
|
|
* the `parent_url` is set to the url of the webview with the widget. Be
|
|
* aware that this means that the widget will receive its own postmessage
|
|
* messages. The `matrix-widget-api` (js) ignores those so this works but
|
|
* it might break custom implementations.
|
|
*
|
|
* Defaults to `element_call_url` for the non-iframe (dedicated webview)
|
|
* usecase.
|
|
*/
|
|
public var parentUrl: String?
|
|
/**
|
|
* Whether the branding header of Element call should be hidden.
|
|
*
|
|
* Default: `true`
|
|
*/
|
|
public var hideHeader: Bool?
|
|
/**
|
|
* If set, the lobby will be skipped and the widget will join the
|
|
* call on the `io.element.join` action.
|
|
*
|
|
* Default: `false`
|
|
*/
|
|
public var preload: Bool?
|
|
/**
|
|
* The font scale which will be used inside element call.
|
|
*
|
|
* Default: `1`
|
|
*/
|
|
public var fontScale: Double?
|
|
/**
|
|
* Whether element call should prompt the user to open in the browser or
|
|
* the app.
|
|
*
|
|
* Default: `false`
|
|
*/
|
|
public var appPrompt: Bool?
|
|
/**
|
|
* Don't show the lobby and join the call immediately.
|
|
*
|
|
* Default: `false`
|
|
*/
|
|
public var skipLobby: Bool?
|
|
/**
|
|
* Make it not possible to get to the calls list in the webview.
|
|
*
|
|
* Default: `true`
|
|
*/
|
|
public var confineToRoom: Bool?
|
|
/**
|
|
* The font to use, to adapt to the system font.
|
|
*/
|
|
public var font: String?
|
|
/**
|
|
* Can be used to pass a PostHog id to element call.
|
|
*/
|
|
public var analyticsId: String?
|
|
/**
|
|
* The encryption system to use.
|
|
*
|
|
* Use `EncryptionSystem::Unencrypted` to disable encryption.
|
|
*/
|
|
public var encryption: EncryptionSystem
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(
|
|
/**
|
|
* The url to the app.
|
|
*
|
|
* E.g. <https://call.element.io>, <https://call.element.dev>
|
|
*/elementCallUrl: String,
|
|
/**
|
|
* The widget id.
|
|
*/widgetId: String,
|
|
/**
|
|
* The url that is used as the target for the PostMessages sent
|
|
* by the widget (to the client).
|
|
*
|
|
* For a web app client this is the client url. In case of using other
|
|
* platforms the client most likely is setup up to listen to
|
|
* postmessages in the same webview the widget is hosted. In this case
|
|
* the `parent_url` is set to the url of the webview with the widget. Be
|
|
* aware that this means that the widget will receive its own postmessage
|
|
* messages. The `matrix-widget-api` (js) ignores those so this works but
|
|
* it might break custom implementations.
|
|
*
|
|
* Defaults to `element_call_url` for the non-iframe (dedicated webview)
|
|
* usecase.
|
|
*/parentUrl: String?,
|
|
/**
|
|
* Whether the branding header of Element call should be hidden.
|
|
*
|
|
* Default: `true`
|
|
*/hideHeader: Bool?,
|
|
/**
|
|
* If set, the lobby will be skipped and the widget will join the
|
|
* call on the `io.element.join` action.
|
|
*
|
|
* Default: `false`
|
|
*/preload: Bool?,
|
|
/**
|
|
* The font scale which will be used inside element call.
|
|
*
|
|
* Default: `1`
|
|
*/fontScale: Double?,
|
|
/**
|
|
* Whether element call should prompt the user to open in the browser or
|
|
* the app.
|
|
*
|
|
* Default: `false`
|
|
*/appPrompt: Bool?,
|
|
/**
|
|
* Don't show the lobby and join the call immediately.
|
|
*
|
|
* Default: `false`
|
|
*/skipLobby: Bool?,
|
|
/**
|
|
* Make it not possible to get to the calls list in the webview.
|
|
*
|
|
* Default: `true`
|
|
*/confineToRoom: Bool?,
|
|
/**
|
|
* The font to use, to adapt to the system font.
|
|
*/font: String?,
|
|
/**
|
|
* Can be used to pass a PostHog id to element call.
|
|
*/analyticsId: String?,
|
|
/**
|
|
* The encryption system to use.
|
|
*
|
|
* Use `EncryptionSystem::Unencrypted` to disable encryption.
|
|
*/encryption: EncryptionSystem) {
|
|
self.elementCallUrl = elementCallUrl
|
|
self.widgetId = widgetId
|
|
self.parentUrl = parentUrl
|
|
self.hideHeader = hideHeader
|
|
self.preload = preload
|
|
self.fontScale = fontScale
|
|
self.appPrompt = appPrompt
|
|
self.skipLobby = skipLobby
|
|
self.confineToRoom = confineToRoom
|
|
self.font = font
|
|
self.analyticsId = analyticsId
|
|
self.encryption = encryption
|
|
}
|
|
}
|
|
|
|
|
|
extension VirtualElementCallWidgetOptions: Equatable, Hashable {
|
|
public static func ==(lhs: VirtualElementCallWidgetOptions, rhs: VirtualElementCallWidgetOptions) -> Bool {
|
|
if lhs.elementCallUrl != rhs.elementCallUrl {
|
|
return false
|
|
}
|
|
if lhs.widgetId != rhs.widgetId {
|
|
return false
|
|
}
|
|
if lhs.parentUrl != rhs.parentUrl {
|
|
return false
|
|
}
|
|
if lhs.hideHeader != rhs.hideHeader {
|
|
return false
|
|
}
|
|
if lhs.preload != rhs.preload {
|
|
return false
|
|
}
|
|
if lhs.fontScale != rhs.fontScale {
|
|
return false
|
|
}
|
|
if lhs.appPrompt != rhs.appPrompt {
|
|
return false
|
|
}
|
|
if lhs.skipLobby != rhs.skipLobby {
|
|
return false
|
|
}
|
|
if lhs.confineToRoom != rhs.confineToRoom {
|
|
return false
|
|
}
|
|
if lhs.font != rhs.font {
|
|
return false
|
|
}
|
|
if lhs.analyticsId != rhs.analyticsId {
|
|
return false
|
|
}
|
|
if lhs.encryption != rhs.encryption {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(elementCallUrl)
|
|
hasher.combine(widgetId)
|
|
hasher.combine(parentUrl)
|
|
hasher.combine(hideHeader)
|
|
hasher.combine(preload)
|
|
hasher.combine(fontScale)
|
|
hasher.combine(appPrompt)
|
|
hasher.combine(skipLobby)
|
|
hasher.combine(confineToRoom)
|
|
hasher.combine(font)
|
|
hasher.combine(analyticsId)
|
|
hasher.combine(encryption)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeVirtualElementCallWidgetOptions: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VirtualElementCallWidgetOptions {
|
|
return
|
|
try VirtualElementCallWidgetOptions(
|
|
elementCallUrl: FfiConverterString.read(from: &buf),
|
|
widgetId: FfiConverterString.read(from: &buf),
|
|
parentUrl: FfiConverterOptionString.read(from: &buf),
|
|
hideHeader: FfiConverterOptionBool.read(from: &buf),
|
|
preload: FfiConverterOptionBool.read(from: &buf),
|
|
fontScale: FfiConverterOptionDouble.read(from: &buf),
|
|
appPrompt: FfiConverterOptionBool.read(from: &buf),
|
|
skipLobby: FfiConverterOptionBool.read(from: &buf),
|
|
confineToRoom: FfiConverterOptionBool.read(from: &buf),
|
|
font: FfiConverterOptionString.read(from: &buf),
|
|
analyticsId: FfiConverterOptionString.read(from: &buf),
|
|
encryption: FfiConverterTypeEncryptionSystem.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: VirtualElementCallWidgetOptions, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.elementCallUrl, into: &buf)
|
|
FfiConverterString.write(value.widgetId, into: &buf)
|
|
FfiConverterOptionString.write(value.parentUrl, into: &buf)
|
|
FfiConverterOptionBool.write(value.hideHeader, into: &buf)
|
|
FfiConverterOptionBool.write(value.preload, into: &buf)
|
|
FfiConverterOptionDouble.write(value.fontScale, into: &buf)
|
|
FfiConverterOptionBool.write(value.appPrompt, into: &buf)
|
|
FfiConverterOptionBool.write(value.skipLobby, into: &buf)
|
|
FfiConverterOptionBool.write(value.confineToRoom, into: &buf)
|
|
FfiConverterOptionString.write(value.font, into: &buf)
|
|
FfiConverterOptionString.write(value.analyticsId, into: &buf)
|
|
FfiConverterTypeEncryptionSystem.write(value.encryption, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeVirtualElementCallWidgetOptions_lift(_ buf: RustBuffer) throws -> VirtualElementCallWidgetOptions {
|
|
return try FfiConverterTypeVirtualElementCallWidgetOptions.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeVirtualElementCallWidgetOptions_lower(_ value: VirtualElementCallWidgetOptions) -> RustBuffer {
|
|
return FfiConverterTypeVirtualElementCallWidgetOptions.lower(value)
|
|
}
|
|
|
|
|
|
/**
|
|
* Capabilities that a widget can request from a client.
|
|
*/
|
|
public struct WidgetCapabilities {
|
|
/**
|
|
* Types of the messages that a widget wants to be able to fetch.
|
|
*/
|
|
public var read: [WidgetEventFilter]
|
|
/**
|
|
* Types of the messages that a widget wants to be able to send.
|
|
*/
|
|
public var send: [WidgetEventFilter]
|
|
/**
|
|
* If this capability is requested by the widget, it can not operate
|
|
* separately from the matrix client.
|
|
*
|
|
* This means clients should not offer to open the widget in a separate
|
|
* browser/tab/webview that is not connected to the postmessage widget-api.
|
|
*/
|
|
public var requiresClient: Bool
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(
|
|
/**
|
|
* Types of the messages that a widget wants to be able to fetch.
|
|
*/read: [WidgetEventFilter],
|
|
/**
|
|
* Types of the messages that a widget wants to be able to send.
|
|
*/send: [WidgetEventFilter],
|
|
/**
|
|
* If this capability is requested by the widget, it can not operate
|
|
* separately from the matrix client.
|
|
*
|
|
* This means clients should not offer to open the widget in a separate
|
|
* browser/tab/webview that is not connected to the postmessage widget-api.
|
|
*/requiresClient: Bool) {
|
|
self.read = read
|
|
self.send = send
|
|
self.requiresClient = requiresClient
|
|
}
|
|
}
|
|
|
|
|
|
extension WidgetCapabilities: Equatable, Hashable {
|
|
public static func ==(lhs: WidgetCapabilities, rhs: WidgetCapabilities) -> Bool {
|
|
if lhs.read != rhs.read {
|
|
return false
|
|
}
|
|
if lhs.send != rhs.send {
|
|
return false
|
|
}
|
|
if lhs.requiresClient != rhs.requiresClient {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(read)
|
|
hasher.combine(send)
|
|
hasher.combine(requiresClient)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeWidgetCapabilities: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WidgetCapabilities {
|
|
return
|
|
try WidgetCapabilities(
|
|
read: FfiConverterSequenceTypeWidgetEventFilter.read(from: &buf),
|
|
send: FfiConverterSequenceTypeWidgetEventFilter.read(from: &buf),
|
|
requiresClient: FfiConverterBool.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: WidgetCapabilities, into buf: inout [UInt8]) {
|
|
FfiConverterSequenceTypeWidgetEventFilter.write(value.read, into: &buf)
|
|
FfiConverterSequenceTypeWidgetEventFilter.write(value.send, into: &buf)
|
|
FfiConverterBool.write(value.requiresClient, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeWidgetCapabilities_lift(_ buf: RustBuffer) throws -> WidgetCapabilities {
|
|
return try FfiConverterTypeWidgetCapabilities.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeWidgetCapabilities_lower(_ value: WidgetCapabilities) -> RustBuffer {
|
|
return FfiConverterTypeWidgetCapabilities.lower(value)
|
|
}
|
|
|
|
|
|
public struct WidgetDriverAndHandle {
|
|
public var driver: WidgetDriver
|
|
public var handle: WidgetDriverHandle
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(driver: WidgetDriver, handle: WidgetDriverHandle) {
|
|
self.driver = driver
|
|
self.handle = handle
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public struct FfiConverterTypeWidgetDriverAndHandle: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WidgetDriverAndHandle {
|
|
return
|
|
try WidgetDriverAndHandle(
|
|
driver: FfiConverterTypeWidgetDriver.read(from: &buf),
|
|
handle: FfiConverterTypeWidgetDriverHandle.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: WidgetDriverAndHandle, into buf: inout [UInt8]) {
|
|
FfiConverterTypeWidgetDriver.write(value.driver, into: &buf)
|
|
FfiConverterTypeWidgetDriverHandle.write(value.handle, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeWidgetDriverAndHandle_lift(_ buf: RustBuffer) throws -> WidgetDriverAndHandle {
|
|
return try FfiConverterTypeWidgetDriverAndHandle.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeWidgetDriverAndHandle_lower(_ value: WidgetDriverAndHandle) -> RustBuffer {
|
|
return FfiConverterTypeWidgetDriverAndHandle.lower(value)
|
|
}
|
|
|
|
|
|
/**
|
|
* Information about a widget.
|
|
*/
|
|
public struct WidgetSettings {
|
|
/**
|
|
* Widget's unique identifier.
|
|
*/
|
|
public var widgetId: String
|
|
/**
|
|
* Whether or not the widget should be initialized on load message
|
|
* (`ContentLoad` message), or upon creation/attaching of the widget to
|
|
* the SDK's state machine that drives the API.
|
|
*/
|
|
public var initAfterContentLoad: Bool
|
|
/**
|
|
* This contains the url from the widget state event.
|
|
* In this url placeholders can be used to pass information from the client
|
|
* to the widget. Possible values are: `$widgetId`, `$parentUrl`,
|
|
* `$userId`, `$lang`, `$fontScale`, `$analyticsID`.
|
|
*
|
|
* # Examples
|
|
*
|
|
* e.g `http://widget.domain?username=$userId`
|
|
* will become: `http://widget.domain?username=@user_matrix_id:server.domain`.
|
|
*/
|
|
public var rawUrl: String
|
|
|
|
// Default memberwise initializers are never public by default, so we
|
|
// declare one manually.
|
|
public init(
|
|
/**
|
|
* Widget's unique identifier.
|
|
*/widgetId: String,
|
|
/**
|
|
* Whether or not the widget should be initialized on load message
|
|
* (`ContentLoad` message), or upon creation/attaching of the widget to
|
|
* the SDK's state machine that drives the API.
|
|
*/initAfterContentLoad: Bool,
|
|
/**
|
|
* This contains the url from the widget state event.
|
|
* In this url placeholders can be used to pass information from the client
|
|
* to the widget. Possible values are: `$widgetId`, `$parentUrl`,
|
|
* `$userId`, `$lang`, `$fontScale`, `$analyticsID`.
|
|
*
|
|
* # Examples
|
|
*
|
|
* e.g `http://widget.domain?username=$userId`
|
|
* will become: `http://widget.domain?username=@user_matrix_id:server.domain`.
|
|
*/rawUrl: String) {
|
|
self.widgetId = widgetId
|
|
self.initAfterContentLoad = initAfterContentLoad
|
|
self.rawUrl = rawUrl
|
|
}
|
|
}
|
|
|
|
|
|
extension WidgetSettings: Equatable, Hashable {
|
|
public static func ==(lhs: WidgetSettings, rhs: WidgetSettings) -> Bool {
|
|
if lhs.widgetId != rhs.widgetId {
|
|
return false
|
|
}
|
|
if lhs.initAfterContentLoad != rhs.initAfterContentLoad {
|
|
return false
|
|
}
|
|
if lhs.rawUrl != rhs.rawUrl {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(widgetId)
|
|
hasher.combine(initAfterContentLoad)
|
|
hasher.combine(rawUrl)
|
|
}
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeWidgetSettings: FfiConverterRustBuffer {
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WidgetSettings {
|
|
return
|
|
try WidgetSettings(
|
|
widgetId: FfiConverterString.read(from: &buf),
|
|
initAfterContentLoad: FfiConverterBool.read(from: &buf),
|
|
rawUrl: FfiConverterString.read(from: &buf)
|
|
)
|
|
}
|
|
|
|
public static func write(_ value: WidgetSettings, into buf: inout [UInt8]) {
|
|
FfiConverterString.write(value.widgetId, into: &buf)
|
|
FfiConverterBool.write(value.initAfterContentLoad, into: &buf)
|
|
FfiConverterString.write(value.rawUrl, into: &buf)
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeWidgetSettings_lift(_ buf: RustBuffer) throws -> WidgetSettings {
|
|
return try FfiConverterTypeWidgetSettings.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeWidgetSettings_lower(_ value: WidgetSettings) -> RustBuffer {
|
|
return FfiConverterTypeWidgetSettings.lower(value)
|
|
}
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum AccountManagementAction {
|
|
|
|
case profile
|
|
case sessionsList
|
|
case sessionView(deviceId: String
|
|
)
|
|
case sessionEnd(deviceId: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeAccountManagementAction: FfiConverterRustBuffer {
|
|
typealias SwiftType = AccountManagementAction
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AccountManagementAction {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .profile
|
|
|
|
case 2: return .sessionsList
|
|
|
|
case 3: return .sessionView(deviceId: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .sessionEnd(deviceId: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: AccountManagementAction, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .profile:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .sessionsList:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case let .sessionView(deviceId):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterString.write(deviceId, into: &buf)
|
|
|
|
|
|
case let .sessionEnd(deviceId):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterString.write(deviceId, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeAccountManagementAction_lift(_ buf: RustBuffer) throws -> AccountManagementAction {
|
|
return try FfiConverterTypeAccountManagementAction.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeAccountManagementAction_lower(_ value: AccountManagementAction) -> RustBuffer {
|
|
return FfiConverterTypeAccountManagementAction.lower(value)
|
|
}
|
|
|
|
|
|
extension AccountManagementAction: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum AssetType {
|
|
|
|
case sender
|
|
case pin
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeAssetType: FfiConverterRustBuffer {
|
|
typealias SwiftType = AssetType
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AssetType {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .sender
|
|
|
|
case 2: return .pin
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: AssetType, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .sender:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .pin:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeAssetType_lift(_ buf: RustBuffer) throws -> AssetType {
|
|
return try FfiConverterTypeAssetType.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeAssetType_lower(_ value: AssetType) -> RustBuffer {
|
|
return FfiConverterTypeAssetType.lower(value)
|
|
}
|
|
|
|
|
|
extension AssetType: Equatable, Hashable {}
|
|
|
|
|
|
|
|
|
|
public enum AuthenticationError {
|
|
|
|
|
|
|
|
case ClientMissing(message: String)
|
|
|
|
case InvalidServerName(message: String)
|
|
|
|
case ServerUnreachable(message: String)
|
|
|
|
case WellKnownLookupFailed(message: String)
|
|
|
|
case WellKnownDeserializationError(message: String)
|
|
|
|
case SlidingSyncNotAvailable(message: String)
|
|
|
|
case SessionMissing(message: String)
|
|
|
|
case InvalidBasePath(message: String)
|
|
|
|
case OidcNotSupported(message: String)
|
|
|
|
case OidcMetadataMissing(message: String)
|
|
|
|
case OidcMetadataInvalid(message: String)
|
|
|
|
case OidcCallbackUrlInvalid(message: String)
|
|
|
|
case OidcCancelled(message: String)
|
|
|
|
case OidcError(message: String)
|
|
|
|
case Generic(message: String)
|
|
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeAuthenticationError: FfiConverterRustBuffer {
|
|
typealias SwiftType = AuthenticationError
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AuthenticationError {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
|
|
|
|
|
|
case 1: return .ClientMissing(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .InvalidServerName(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .ServerUnreachable(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .WellKnownLookupFailed(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 5: return .WellKnownDeserializationError(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 6: return .SlidingSyncNotAvailable(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 7: return .SessionMissing(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 8: return .InvalidBasePath(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 9: return .OidcNotSupported(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 10: return .OidcMetadataMissing(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 11: return .OidcMetadataInvalid(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 12: return .OidcCallbackUrlInvalid(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 13: return .OidcCancelled(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 14: return .OidcError(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 15: return .Generic(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: AuthenticationError, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
|
|
|
|
case .ClientMissing(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(1))
|
|
case .InvalidServerName(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(2))
|
|
case .ServerUnreachable(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(3))
|
|
case .WellKnownLookupFailed(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(4))
|
|
case .WellKnownDeserializationError(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(5))
|
|
case .SlidingSyncNotAvailable(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(6))
|
|
case .SessionMissing(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(7))
|
|
case .InvalidBasePath(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(8))
|
|
case .OidcNotSupported(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(9))
|
|
case .OidcMetadataMissing(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(10))
|
|
case .OidcMetadataInvalid(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(11))
|
|
case .OidcCallbackUrlInvalid(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(12))
|
|
case .OidcCancelled(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(13))
|
|
case .OidcError(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(14))
|
|
case .Generic(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(15))
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
extension AuthenticationError: Equatable, Hashable {}
|
|
|
|
extension AuthenticationError: Error { }
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum BackupState {
|
|
|
|
case unknown
|
|
case creating
|
|
case enabling
|
|
case resuming
|
|
case enabled
|
|
case downloading
|
|
case disabling
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeBackupState: FfiConverterRustBuffer {
|
|
typealias SwiftType = BackupState
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BackupState {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .unknown
|
|
|
|
case 2: return .creating
|
|
|
|
case 3: return .enabling
|
|
|
|
case 4: return .resuming
|
|
|
|
case 5: return .enabled
|
|
|
|
case 6: return .downloading
|
|
|
|
case 7: return .disabling
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: BackupState, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .unknown:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .creating:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .enabling:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .resuming:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case .enabled:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .downloading:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case .disabling:
|
|
writeInt(&buf, Int32(7))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeBackupState_lift(_ buf: RustBuffer) throws -> BackupState {
|
|
return try FfiConverterTypeBackupState.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeBackupState_lower(_ value: BackupState) -> RustBuffer {
|
|
return FfiConverterTypeBackupState.lower(value)
|
|
}
|
|
|
|
|
|
extension BackupState: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum BackupUploadState {
|
|
|
|
case waiting
|
|
case uploading(backedUpCount: UInt32, totalCount: UInt32
|
|
)
|
|
case error
|
|
case done
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeBackupUploadState: FfiConverterRustBuffer {
|
|
typealias SwiftType = BackupUploadState
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BackupUploadState {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .waiting
|
|
|
|
case 2: return .uploading(backedUpCount: try FfiConverterUInt32.read(from: &buf), totalCount: try FfiConverterUInt32.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .error
|
|
|
|
case 4: return .done
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: BackupUploadState, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .waiting:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case let .uploading(backedUpCount,totalCount):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterUInt32.write(backedUpCount, into: &buf)
|
|
FfiConverterUInt32.write(totalCount, into: &buf)
|
|
|
|
|
|
case .error:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .done:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeBackupUploadState_lift(_ buf: RustBuffer) throws -> BackupUploadState {
|
|
return try FfiConverterTypeBackupUploadState.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeBackupUploadState_lower(_ value: BackupUploadState) -> RustBuffer {
|
|
return FfiConverterTypeBackupUploadState.lower(value)
|
|
}
|
|
|
|
|
|
extension BackupUploadState: Equatable, Hashable {}
|
|
|
|
|
|
|
|
|
|
public enum ClientBuildError {
|
|
|
|
|
|
|
|
case Sdk(message: String)
|
|
|
|
case Generic(message: String)
|
|
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeClientBuildError: FfiConverterRustBuffer {
|
|
typealias SwiftType = ClientBuildError
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ClientBuildError {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
|
|
|
|
|
|
case 1: return .Sdk(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .Generic(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: ClientBuildError, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
|
|
|
|
case .Sdk(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(1))
|
|
case .Generic(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
extension ClientBuildError: Equatable, Hashable {}
|
|
|
|
extension ClientBuildError: Error { }
|
|
|
|
|
|
public enum ClientError {
|
|
|
|
|
|
|
|
case Generic(msg: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeClientError: FfiConverterRustBuffer {
|
|
typealias SwiftType = ClientError
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ClientError {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
|
|
|
|
|
|
case 1: return .Generic(
|
|
msg: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: ClientError, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
|
|
|
|
|
|
case let .Generic(msg):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterString.write(msg, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
extension ClientError: Equatable, Hashable {}
|
|
|
|
extension ClientError: Error { }
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum EnableRecoveryProgress {
|
|
|
|
case starting
|
|
case creatingBackup
|
|
case creatingRecoveryKey
|
|
case backingUp(backedUpCount: UInt32, totalCount: UInt32
|
|
)
|
|
case roomKeyUploadError
|
|
case done(recoveryKey: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeEnableRecoveryProgress: FfiConverterRustBuffer {
|
|
typealias SwiftType = EnableRecoveryProgress
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EnableRecoveryProgress {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .starting
|
|
|
|
case 2: return .creatingBackup
|
|
|
|
case 3: return .creatingRecoveryKey
|
|
|
|
case 4: return .backingUp(backedUpCount: try FfiConverterUInt32.read(from: &buf), totalCount: try FfiConverterUInt32.read(from: &buf)
|
|
)
|
|
|
|
case 5: return .roomKeyUploadError
|
|
|
|
case 6: return .done(recoveryKey: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: EnableRecoveryProgress, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .starting:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .creatingBackup:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .creatingRecoveryKey:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case let .backingUp(backedUpCount,totalCount):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterUInt32.write(backedUpCount, into: &buf)
|
|
FfiConverterUInt32.write(totalCount, into: &buf)
|
|
|
|
|
|
case .roomKeyUploadError:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case let .done(recoveryKey):
|
|
writeInt(&buf, Int32(6))
|
|
FfiConverterString.write(recoveryKey, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeEnableRecoveryProgress_lift(_ buf: RustBuffer) throws -> EnableRecoveryProgress {
|
|
return try FfiConverterTypeEnableRecoveryProgress.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeEnableRecoveryProgress_lower(_ value: EnableRecoveryProgress) -> RustBuffer {
|
|
return FfiConverterTypeEnableRecoveryProgress.lower(value)
|
|
}
|
|
|
|
|
|
extension EnableRecoveryProgress: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum EncryptedMessage {
|
|
|
|
case olmV1Curve25519AesSha2(
|
|
/**
|
|
* The Curve25519 key of the sender.
|
|
*/senderKey: String
|
|
)
|
|
case megolmV1AesSha2(
|
|
/**
|
|
* The ID of the session used to encrypt the message.
|
|
*/sessionId: String
|
|
)
|
|
case unknown
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeEncryptedMessage: FfiConverterRustBuffer {
|
|
typealias SwiftType = EncryptedMessage
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EncryptedMessage {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .olmV1Curve25519AesSha2(senderKey: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .megolmV1AesSha2(sessionId: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .unknown
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: EncryptedMessage, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .olmV1Curve25519AesSha2(senderKey):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterString.write(senderKey, into: &buf)
|
|
|
|
|
|
case let .megolmV1AesSha2(sessionId):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterString.write(sessionId, into: &buf)
|
|
|
|
|
|
case .unknown:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeEncryptedMessage_lift(_ buf: RustBuffer) throws -> EncryptedMessage {
|
|
return try FfiConverterTypeEncryptedMessage.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeEncryptedMessage_lower(_ value: EncryptedMessage) -> RustBuffer {
|
|
return FfiConverterTypeEncryptedMessage.lower(value)
|
|
}
|
|
|
|
|
|
extension EncryptedMessage: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
/**
|
|
* Defines if a call is encrypted and which encryption system should be used.
|
|
*
|
|
* This controls the url parameters: `perParticipantE2EE`, `password`.
|
|
*/
|
|
|
|
public enum EncryptionSystem {
|
|
|
|
/**
|
|
* Equivalent to the element call url parameter: `enableE2EE=false`
|
|
*/
|
|
case unencrypted
|
|
/**
|
|
* Equivalent to the element call url parameter:
|
|
* `perParticipantE2EE=true`
|
|
*/
|
|
case perParticipantKeys
|
|
/**
|
|
* Equivalent to the element call url parameter:
|
|
* `password={secret}`
|
|
*/
|
|
case sharedSecret(
|
|
/**
|
|
* The secret/password which is used in the url.
|
|
*/secret: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeEncryptionSystem: FfiConverterRustBuffer {
|
|
typealias SwiftType = EncryptionSystem
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EncryptionSystem {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .unencrypted
|
|
|
|
case 2: return .perParticipantKeys
|
|
|
|
case 3: return .sharedSecret(secret: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: EncryptionSystem, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .unencrypted:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .perParticipantKeys:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case let .sharedSecret(secret):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterString.write(secret, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeEncryptionSystem_lift(_ buf: RustBuffer) throws -> EncryptionSystem {
|
|
return try FfiConverterTypeEncryptionSystem.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeEncryptionSystem_lower(_ value: EncryptionSystem) -> RustBuffer {
|
|
return FfiConverterTypeEncryptionSystem.lower(value)
|
|
}
|
|
|
|
|
|
extension EncryptionSystem: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
/**
|
|
* This type represents the “send state” of a local event timeline item.
|
|
*/
|
|
|
|
public enum EventSendState {
|
|
|
|
/**
|
|
* The local event has not been sent yet.
|
|
*/
|
|
case notSentYet
|
|
/**
|
|
* The local event has been sent to the server, but unsuccessfully: The
|
|
* sending has failed.
|
|
*/
|
|
case sendingFailed(error: String
|
|
)
|
|
/**
|
|
* Sending has been cancelled because an earlier event in the
|
|
* message-sending queue failed.
|
|
*/
|
|
case cancelled
|
|
/**
|
|
* The local event has been sent successfully to the server.
|
|
*/
|
|
case sent(eventId: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeEventSendState: FfiConverterRustBuffer {
|
|
typealias SwiftType = EventSendState
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EventSendState {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .notSentYet
|
|
|
|
case 2: return .sendingFailed(error: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .cancelled
|
|
|
|
case 4: return .sent(eventId: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: EventSendState, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .notSentYet:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case let .sendingFailed(error):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterString.write(error, into: &buf)
|
|
|
|
|
|
case .cancelled:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case let .sent(eventId):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterString.write(eventId, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeEventSendState_lift(_ buf: RustBuffer) throws -> EventSendState {
|
|
return try FfiConverterTypeEventSendState.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeEventSendState_lower(_ value: EventSendState) -> RustBuffer {
|
|
return FfiConverterTypeEventSendState.lower(value)
|
|
}
|
|
|
|
|
|
extension EventSendState: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum FilterTimelineEventType {
|
|
|
|
case messageLike(eventType: MessageLikeEventType
|
|
)
|
|
case state(eventType: StateEventType
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeFilterTimelineEventType: FfiConverterRustBuffer {
|
|
typealias SwiftType = FilterTimelineEventType
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FilterTimelineEventType {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .messageLike(eventType: try FfiConverterTypeMessageLikeEventType.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .state(eventType: try FfiConverterTypeStateEventType.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: FilterTimelineEventType, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .messageLike(eventType):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterTypeMessageLikeEventType.write(eventType, into: &buf)
|
|
|
|
|
|
case let .state(eventType):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterTypeStateEventType.write(eventType, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeFilterTimelineEventType_lift(_ buf: RustBuffer) throws -> FilterTimelineEventType {
|
|
return try FfiConverterTypeFilterTimelineEventType.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeFilterTimelineEventType_lower(_ value: FilterTimelineEventType) -> RustBuffer {
|
|
return FfiConverterTypeFilterTimelineEventType.lower(value)
|
|
}
|
|
|
|
|
|
extension FilterTimelineEventType: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum LogLevel {
|
|
|
|
case error
|
|
case warn
|
|
case info
|
|
case debug
|
|
case trace
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeLogLevel: FfiConverterRustBuffer {
|
|
typealias SwiftType = LogLevel
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LogLevel {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .error
|
|
|
|
case 2: return .warn
|
|
|
|
case 3: return .info
|
|
|
|
case 4: return .debug
|
|
|
|
case 5: return .trace
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: LogLevel, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .error:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .warn:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .info:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .debug:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case .trace:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeLogLevel_lift(_ buf: RustBuffer) throws -> LogLevel {
|
|
return try FfiConverterTypeLogLevel.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeLogLevel_lower(_ value: LogLevel) -> RustBuffer {
|
|
return FfiConverterTypeLogLevel.lower(value)
|
|
}
|
|
|
|
|
|
extension LogLevel: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
/**
|
|
* A Matrix ID that can be a room, room alias, user, or event.
|
|
*/
|
|
|
|
public enum MatrixId {
|
|
|
|
case room(id: String
|
|
)
|
|
case roomAlias(alias: String
|
|
)
|
|
case user(id: String
|
|
)
|
|
case eventOnRoomId(roomId: String, eventId: String
|
|
)
|
|
case eventOnRoomAlias(alias: String, eventId: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeMatrixId: FfiConverterRustBuffer {
|
|
typealias SwiftType = MatrixId
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MatrixId {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .room(id: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .roomAlias(alias: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .user(id: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .eventOnRoomId(roomId: try FfiConverterString.read(from: &buf), eventId: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 5: return .eventOnRoomAlias(alias: try FfiConverterString.read(from: &buf), eventId: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: MatrixId, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .room(id):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterString.write(id, into: &buf)
|
|
|
|
|
|
case let .roomAlias(alias):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterString.write(alias, into: &buf)
|
|
|
|
|
|
case let .user(id):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterString.write(id, into: &buf)
|
|
|
|
|
|
case let .eventOnRoomId(roomId,eventId):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterString.write(roomId, into: &buf)
|
|
FfiConverterString.write(eventId, into: &buf)
|
|
|
|
|
|
case let .eventOnRoomAlias(alias,eventId):
|
|
writeInt(&buf, Int32(5))
|
|
FfiConverterString.write(alias, into: &buf)
|
|
FfiConverterString.write(eventId, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeMatrixId_lift(_ buf: RustBuffer) throws -> MatrixId {
|
|
return try FfiConverterTypeMatrixId.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeMatrixId_lower(_ value: MatrixId) -> RustBuffer {
|
|
return FfiConverterTypeMatrixId.lower(value)
|
|
}
|
|
|
|
|
|
extension MatrixId: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum MediaInfoError {
|
|
|
|
case missingField
|
|
case invalidField
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeMediaInfoError: FfiConverterRustBuffer {
|
|
typealias SwiftType = MediaInfoError
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MediaInfoError {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .missingField
|
|
|
|
case 2: return .invalidField
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: MediaInfoError, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .missingField:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .invalidField:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeMediaInfoError_lift(_ buf: RustBuffer) throws -> MediaInfoError {
|
|
return try FfiConverterTypeMediaInfoError.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeMediaInfoError_lower(_ value: MediaInfoError) -> RustBuffer {
|
|
return FfiConverterTypeMediaInfoError.lower(value)
|
|
}
|
|
|
|
|
|
extension MediaInfoError: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum Membership {
|
|
|
|
case invited
|
|
case joined
|
|
case left
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeMembership: FfiConverterRustBuffer {
|
|
typealias SwiftType = Membership
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Membership {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .invited
|
|
|
|
case 2: return .joined
|
|
|
|
case 3: return .left
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: Membership, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .invited:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .joined:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .left:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeMembership_lift(_ buf: RustBuffer) throws -> Membership {
|
|
return try FfiConverterTypeMembership.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeMembership_lower(_ value: Membership) -> RustBuffer {
|
|
return FfiConverterTypeMembership.lower(value)
|
|
}
|
|
|
|
|
|
extension Membership: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum MembershipChange {
|
|
|
|
case none
|
|
case error
|
|
case joined
|
|
case left
|
|
case banned
|
|
case unbanned
|
|
case kicked
|
|
case invited
|
|
case kickedAndBanned
|
|
case invitationAccepted
|
|
case invitationRejected
|
|
case invitationRevoked
|
|
case knocked
|
|
case knockAccepted
|
|
case knockRetracted
|
|
case knockDenied
|
|
case notImplemented
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeMembershipChange: FfiConverterRustBuffer {
|
|
typealias SwiftType = MembershipChange
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MembershipChange {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .none
|
|
|
|
case 2: return .error
|
|
|
|
case 3: return .joined
|
|
|
|
case 4: return .left
|
|
|
|
case 5: return .banned
|
|
|
|
case 6: return .unbanned
|
|
|
|
case 7: return .kicked
|
|
|
|
case 8: return .invited
|
|
|
|
case 9: return .kickedAndBanned
|
|
|
|
case 10: return .invitationAccepted
|
|
|
|
case 11: return .invitationRejected
|
|
|
|
case 12: return .invitationRevoked
|
|
|
|
case 13: return .knocked
|
|
|
|
case 14: return .knockAccepted
|
|
|
|
case 15: return .knockRetracted
|
|
|
|
case 16: return .knockDenied
|
|
|
|
case 17: return .notImplemented
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: MembershipChange, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .none:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .error:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .joined:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .left:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case .banned:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .unbanned:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case .kicked:
|
|
writeInt(&buf, Int32(7))
|
|
|
|
|
|
case .invited:
|
|
writeInt(&buf, Int32(8))
|
|
|
|
|
|
case .kickedAndBanned:
|
|
writeInt(&buf, Int32(9))
|
|
|
|
|
|
case .invitationAccepted:
|
|
writeInt(&buf, Int32(10))
|
|
|
|
|
|
case .invitationRejected:
|
|
writeInt(&buf, Int32(11))
|
|
|
|
|
|
case .invitationRevoked:
|
|
writeInt(&buf, Int32(12))
|
|
|
|
|
|
case .knocked:
|
|
writeInt(&buf, Int32(13))
|
|
|
|
|
|
case .knockAccepted:
|
|
writeInt(&buf, Int32(14))
|
|
|
|
|
|
case .knockRetracted:
|
|
writeInt(&buf, Int32(15))
|
|
|
|
|
|
case .knockDenied:
|
|
writeInt(&buf, Int32(16))
|
|
|
|
|
|
case .notImplemented:
|
|
writeInt(&buf, Int32(17))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeMembershipChange_lift(_ buf: RustBuffer) throws -> MembershipChange {
|
|
return try FfiConverterTypeMembershipChange.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeMembershipChange_lower(_ value: MembershipChange) -> RustBuffer {
|
|
return FfiConverterTypeMembershipChange.lower(value)
|
|
}
|
|
|
|
|
|
extension MembershipChange: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum MembershipState {
|
|
|
|
/**
|
|
* The user is banned.
|
|
*/
|
|
case ban
|
|
/**
|
|
* The user has been invited.
|
|
*/
|
|
case invite
|
|
/**
|
|
* The user has joined.
|
|
*/
|
|
case join
|
|
/**
|
|
* The user has requested to join.
|
|
*/
|
|
case knock
|
|
/**
|
|
* The user has left.
|
|
*/
|
|
case leave
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeMembershipState: FfiConverterRustBuffer {
|
|
typealias SwiftType = MembershipState
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MembershipState {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .ban
|
|
|
|
case 2: return .invite
|
|
|
|
case 3: return .join
|
|
|
|
case 4: return .knock
|
|
|
|
case 5: return .leave
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: MembershipState, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .ban:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .invite:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .join:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .knock:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case .leave:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeMembershipState_lift(_ buf: RustBuffer) throws -> MembershipState {
|
|
return try FfiConverterTypeMembershipState.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeMembershipState_lower(_ value: MembershipState) -> RustBuffer {
|
|
return FfiConverterTypeMembershipState.lower(value)
|
|
}
|
|
|
|
|
|
extension MembershipState: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum MessageFormat {
|
|
|
|
case html
|
|
case unknown(format: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeMessageFormat: FfiConverterRustBuffer {
|
|
typealias SwiftType = MessageFormat
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MessageFormat {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .html
|
|
|
|
case 2: return .unknown(format: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: MessageFormat, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .html:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case let .unknown(format):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterString.write(format, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeMessageFormat_lift(_ buf: RustBuffer) throws -> MessageFormat {
|
|
return try FfiConverterTypeMessageFormat.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeMessageFormat_lower(_ value: MessageFormat) -> RustBuffer {
|
|
return FfiConverterTypeMessageFormat.lower(value)
|
|
}
|
|
|
|
|
|
extension MessageFormat: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum MessageLikeEventContent {
|
|
|
|
case callAnswer
|
|
case callInvite
|
|
case callHangup
|
|
case callCandidates
|
|
case keyVerificationReady
|
|
case keyVerificationStart
|
|
case keyVerificationCancel
|
|
case keyVerificationAccept
|
|
case keyVerificationKey
|
|
case keyVerificationMac
|
|
case keyVerificationDone
|
|
case poll(question: String
|
|
)
|
|
case reactionContent(relatedEventId: String
|
|
)
|
|
case roomEncrypted
|
|
case roomMessage(messageType: MessageType, inReplyToEventId: String?
|
|
)
|
|
case roomRedaction
|
|
case sticker
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeMessageLikeEventContent: FfiConverterRustBuffer {
|
|
typealias SwiftType = MessageLikeEventContent
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MessageLikeEventContent {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .callAnswer
|
|
|
|
case 2: return .callInvite
|
|
|
|
case 3: return .callHangup
|
|
|
|
case 4: return .callCandidates
|
|
|
|
case 5: return .keyVerificationReady
|
|
|
|
case 6: return .keyVerificationStart
|
|
|
|
case 7: return .keyVerificationCancel
|
|
|
|
case 8: return .keyVerificationAccept
|
|
|
|
case 9: return .keyVerificationKey
|
|
|
|
case 10: return .keyVerificationMac
|
|
|
|
case 11: return .keyVerificationDone
|
|
|
|
case 12: return .poll(question: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 13: return .reactionContent(relatedEventId: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 14: return .roomEncrypted
|
|
|
|
case 15: return .roomMessage(messageType: try FfiConverterTypeMessageType.read(from: &buf), inReplyToEventId: try FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
|
|
case 16: return .roomRedaction
|
|
|
|
case 17: return .sticker
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: MessageLikeEventContent, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .callAnswer:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .callInvite:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .callHangup:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .callCandidates:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case .keyVerificationReady:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .keyVerificationStart:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case .keyVerificationCancel:
|
|
writeInt(&buf, Int32(7))
|
|
|
|
|
|
case .keyVerificationAccept:
|
|
writeInt(&buf, Int32(8))
|
|
|
|
|
|
case .keyVerificationKey:
|
|
writeInt(&buf, Int32(9))
|
|
|
|
|
|
case .keyVerificationMac:
|
|
writeInt(&buf, Int32(10))
|
|
|
|
|
|
case .keyVerificationDone:
|
|
writeInt(&buf, Int32(11))
|
|
|
|
|
|
case let .poll(question):
|
|
writeInt(&buf, Int32(12))
|
|
FfiConverterString.write(question, into: &buf)
|
|
|
|
|
|
case let .reactionContent(relatedEventId):
|
|
writeInt(&buf, Int32(13))
|
|
FfiConverterString.write(relatedEventId, into: &buf)
|
|
|
|
|
|
case .roomEncrypted:
|
|
writeInt(&buf, Int32(14))
|
|
|
|
|
|
case let .roomMessage(messageType,inReplyToEventId):
|
|
writeInt(&buf, Int32(15))
|
|
FfiConverterTypeMessageType.write(messageType, into: &buf)
|
|
FfiConverterOptionString.write(inReplyToEventId, into: &buf)
|
|
|
|
|
|
case .roomRedaction:
|
|
writeInt(&buf, Int32(16))
|
|
|
|
|
|
case .sticker:
|
|
writeInt(&buf, Int32(17))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeMessageLikeEventContent_lift(_ buf: RustBuffer) throws -> MessageLikeEventContent {
|
|
return try FfiConverterTypeMessageLikeEventContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeMessageLikeEventContent_lower(_ value: MessageLikeEventContent) -> RustBuffer {
|
|
return FfiConverterTypeMessageLikeEventContent.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum MessageLikeEventType {
|
|
|
|
case callAnswer
|
|
case callCandidates
|
|
case callHangup
|
|
case callInvite
|
|
case keyVerificationAccept
|
|
case keyVerificationCancel
|
|
case keyVerificationDone
|
|
case keyVerificationKey
|
|
case keyVerificationMac
|
|
case keyVerificationReady
|
|
case keyVerificationStart
|
|
case pollEnd
|
|
case pollResponse
|
|
case pollStart
|
|
case reaction
|
|
case roomEncrypted
|
|
case roomMessage
|
|
case roomRedaction
|
|
case sticker
|
|
case unstablePollEnd
|
|
case unstablePollResponse
|
|
case unstablePollStart
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeMessageLikeEventType: FfiConverterRustBuffer {
|
|
typealias SwiftType = MessageLikeEventType
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MessageLikeEventType {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .callAnswer
|
|
|
|
case 2: return .callCandidates
|
|
|
|
case 3: return .callHangup
|
|
|
|
case 4: return .callInvite
|
|
|
|
case 5: return .keyVerificationAccept
|
|
|
|
case 6: return .keyVerificationCancel
|
|
|
|
case 7: return .keyVerificationDone
|
|
|
|
case 8: return .keyVerificationKey
|
|
|
|
case 9: return .keyVerificationMac
|
|
|
|
case 10: return .keyVerificationReady
|
|
|
|
case 11: return .keyVerificationStart
|
|
|
|
case 12: return .pollEnd
|
|
|
|
case 13: return .pollResponse
|
|
|
|
case 14: return .pollStart
|
|
|
|
case 15: return .reaction
|
|
|
|
case 16: return .roomEncrypted
|
|
|
|
case 17: return .roomMessage
|
|
|
|
case 18: return .roomRedaction
|
|
|
|
case 19: return .sticker
|
|
|
|
case 20: return .unstablePollEnd
|
|
|
|
case 21: return .unstablePollResponse
|
|
|
|
case 22: return .unstablePollStart
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: MessageLikeEventType, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .callAnswer:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .callCandidates:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .callHangup:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .callInvite:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case .keyVerificationAccept:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .keyVerificationCancel:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case .keyVerificationDone:
|
|
writeInt(&buf, Int32(7))
|
|
|
|
|
|
case .keyVerificationKey:
|
|
writeInt(&buf, Int32(8))
|
|
|
|
|
|
case .keyVerificationMac:
|
|
writeInt(&buf, Int32(9))
|
|
|
|
|
|
case .keyVerificationReady:
|
|
writeInt(&buf, Int32(10))
|
|
|
|
|
|
case .keyVerificationStart:
|
|
writeInt(&buf, Int32(11))
|
|
|
|
|
|
case .pollEnd:
|
|
writeInt(&buf, Int32(12))
|
|
|
|
|
|
case .pollResponse:
|
|
writeInt(&buf, Int32(13))
|
|
|
|
|
|
case .pollStart:
|
|
writeInt(&buf, Int32(14))
|
|
|
|
|
|
case .reaction:
|
|
writeInt(&buf, Int32(15))
|
|
|
|
|
|
case .roomEncrypted:
|
|
writeInt(&buf, Int32(16))
|
|
|
|
|
|
case .roomMessage:
|
|
writeInt(&buf, Int32(17))
|
|
|
|
|
|
case .roomRedaction:
|
|
writeInt(&buf, Int32(18))
|
|
|
|
|
|
case .sticker:
|
|
writeInt(&buf, Int32(19))
|
|
|
|
|
|
case .unstablePollEnd:
|
|
writeInt(&buf, Int32(20))
|
|
|
|
|
|
case .unstablePollResponse:
|
|
writeInt(&buf, Int32(21))
|
|
|
|
|
|
case .unstablePollStart:
|
|
writeInt(&buf, Int32(22))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeMessageLikeEventType_lift(_ buf: RustBuffer) throws -> MessageLikeEventType {
|
|
return try FfiConverterTypeMessageLikeEventType.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeMessageLikeEventType_lower(_ value: MessageLikeEventType) -> RustBuffer {
|
|
return FfiConverterTypeMessageLikeEventType.lower(value)
|
|
}
|
|
|
|
|
|
extension MessageLikeEventType: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum MessageType {
|
|
|
|
case emote(content: EmoteMessageContent
|
|
)
|
|
case image(content: ImageMessageContent
|
|
)
|
|
case audio(content: AudioMessageContent
|
|
)
|
|
case video(content: VideoMessageContent
|
|
)
|
|
case file(content: FileMessageContent
|
|
)
|
|
case notice(content: NoticeMessageContent
|
|
)
|
|
case text(content: TextMessageContent
|
|
)
|
|
case location(content: LocationContent
|
|
)
|
|
case other(msgtype: String, body: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeMessageType: FfiConverterRustBuffer {
|
|
typealias SwiftType = MessageType
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MessageType {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .emote(content: try FfiConverterTypeEmoteMessageContent.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .image(content: try FfiConverterTypeImageMessageContent.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .audio(content: try FfiConverterTypeAudioMessageContent.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .video(content: try FfiConverterTypeVideoMessageContent.read(from: &buf)
|
|
)
|
|
|
|
case 5: return .file(content: try FfiConverterTypeFileMessageContent.read(from: &buf)
|
|
)
|
|
|
|
case 6: return .notice(content: try FfiConverterTypeNoticeMessageContent.read(from: &buf)
|
|
)
|
|
|
|
case 7: return .text(content: try FfiConverterTypeTextMessageContent.read(from: &buf)
|
|
)
|
|
|
|
case 8: return .location(content: try FfiConverterTypeLocationContent.read(from: &buf)
|
|
)
|
|
|
|
case 9: return .other(msgtype: try FfiConverterString.read(from: &buf), body: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: MessageType, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .emote(content):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterTypeEmoteMessageContent.write(content, into: &buf)
|
|
|
|
|
|
case let .image(content):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterTypeImageMessageContent.write(content, into: &buf)
|
|
|
|
|
|
case let .audio(content):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterTypeAudioMessageContent.write(content, into: &buf)
|
|
|
|
|
|
case let .video(content):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterTypeVideoMessageContent.write(content, into: &buf)
|
|
|
|
|
|
case let .file(content):
|
|
writeInt(&buf, Int32(5))
|
|
FfiConverterTypeFileMessageContent.write(content, into: &buf)
|
|
|
|
|
|
case let .notice(content):
|
|
writeInt(&buf, Int32(6))
|
|
FfiConverterTypeNoticeMessageContent.write(content, into: &buf)
|
|
|
|
|
|
case let .text(content):
|
|
writeInt(&buf, Int32(7))
|
|
FfiConverterTypeTextMessageContent.write(content, into: &buf)
|
|
|
|
|
|
case let .location(content):
|
|
writeInt(&buf, Int32(8))
|
|
FfiConverterTypeLocationContent.write(content, into: &buf)
|
|
|
|
|
|
case let .other(msgtype,body):
|
|
writeInt(&buf, Int32(9))
|
|
FfiConverterString.write(msgtype, into: &buf)
|
|
FfiConverterString.write(body, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeMessageType_lift(_ buf: RustBuffer) throws -> MessageType {
|
|
return try FfiConverterTypeMessageType.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeMessageType_lower(_ value: MessageType) -> RustBuffer {
|
|
return FfiConverterTypeMessageType.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum NotificationEvent {
|
|
|
|
case timeline(event: TimelineEvent
|
|
)
|
|
case invite(sender: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeNotificationEvent: FfiConverterRustBuffer {
|
|
typealias SwiftType = NotificationEvent
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationEvent {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .timeline(event: try FfiConverterTypeTimelineEvent.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .invite(sender: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: NotificationEvent, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .timeline(event):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterTypeTimelineEvent.write(event, into: &buf)
|
|
|
|
|
|
case let .invite(sender):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterString.write(sender, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeNotificationEvent_lift(_ buf: RustBuffer) throws -> NotificationEvent {
|
|
return try FfiConverterTypeNotificationEvent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeNotificationEvent_lower(_ value: NotificationEvent) -> RustBuffer {
|
|
return FfiConverterTypeNotificationEvent.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum NotificationProcessSetup {
|
|
|
|
case multipleProcesses
|
|
case singleProcess(syncService: SyncService
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeNotificationProcessSetup: FfiConverterRustBuffer {
|
|
typealias SwiftType = NotificationProcessSetup
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationProcessSetup {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .multipleProcesses
|
|
|
|
case 2: return .singleProcess(syncService: try FfiConverterTypeSyncService.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: NotificationProcessSetup, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .multipleProcesses:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case let .singleProcess(syncService):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterTypeSyncService.write(syncService, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeNotificationProcessSetup_lift(_ buf: RustBuffer) throws -> NotificationProcessSetup {
|
|
return try FfiConverterTypeNotificationProcessSetup.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeNotificationProcessSetup_lower(_ value: NotificationProcessSetup) -> RustBuffer {
|
|
return FfiConverterTypeNotificationProcessSetup.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public enum NotificationSettingsError {
|
|
|
|
|
|
|
|
case Generic(msg: String
|
|
)
|
|
/**
|
|
* Invalid parameter.
|
|
*/
|
|
case InvalidParameter(msg: String
|
|
)
|
|
/**
|
|
* Invalid room id.
|
|
*/
|
|
case InvalidRoomId(roomId: String
|
|
)
|
|
/**
|
|
* Rule not found
|
|
*/
|
|
case RuleNotFound(ruleId: String
|
|
)
|
|
/**
|
|
* Unable to add push rule.
|
|
*/
|
|
case UnableToAddPushRule
|
|
/**
|
|
* Unable to remove push rule.
|
|
*/
|
|
case UnableToRemovePushRule
|
|
/**
|
|
* Unable to save the push rules
|
|
*/
|
|
case UnableToSavePushRules
|
|
/**
|
|
* Unable to update push rule.
|
|
*/
|
|
case UnableToUpdatePushRule
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeNotificationSettingsError: FfiConverterRustBuffer {
|
|
typealias SwiftType = NotificationSettingsError
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationSettingsError {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
|
|
|
|
|
|
case 1: return .Generic(
|
|
msg: try FfiConverterString.read(from: &buf)
|
|
)
|
|
case 2: return .InvalidParameter(
|
|
msg: try FfiConverterString.read(from: &buf)
|
|
)
|
|
case 3: return .InvalidRoomId(
|
|
roomId: try FfiConverterString.read(from: &buf)
|
|
)
|
|
case 4: return .RuleNotFound(
|
|
ruleId: try FfiConverterString.read(from: &buf)
|
|
)
|
|
case 5: return .UnableToAddPushRule
|
|
case 6: return .UnableToRemovePushRule
|
|
case 7: return .UnableToSavePushRules
|
|
case 8: return .UnableToUpdatePushRule
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: NotificationSettingsError, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
|
|
|
|
|
|
case let .Generic(msg):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterString.write(msg, into: &buf)
|
|
|
|
|
|
case let .InvalidParameter(msg):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterString.write(msg, into: &buf)
|
|
|
|
|
|
case let .InvalidRoomId(roomId):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterString.write(roomId, into: &buf)
|
|
|
|
|
|
case let .RuleNotFound(ruleId):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterString.write(ruleId, into: &buf)
|
|
|
|
|
|
case .UnableToAddPushRule:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .UnableToRemovePushRule:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case .UnableToSavePushRules:
|
|
writeInt(&buf, Int32(7))
|
|
|
|
|
|
case .UnableToUpdatePushRule:
|
|
writeInt(&buf, Int32(8))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
extension NotificationSettingsError: Equatable, Hashable {}
|
|
|
|
extension NotificationSettingsError: Error { }
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum OtherState {
|
|
|
|
case policyRuleRoom
|
|
case policyRuleServer
|
|
case policyRuleUser
|
|
case roomAliases
|
|
case roomAvatar(url: String?
|
|
)
|
|
case roomCanonicalAlias
|
|
case roomCreate
|
|
case roomEncryption
|
|
case roomGuestAccess
|
|
case roomHistoryVisibility
|
|
case roomJoinRules
|
|
case roomName(name: String?
|
|
)
|
|
case roomPinnedEvents
|
|
case roomPowerLevels(users: [String: Int64], previous: [String: Int64]?
|
|
)
|
|
case roomServerAcl
|
|
case roomThirdPartyInvite(displayName: String?
|
|
)
|
|
case roomTombstone
|
|
case roomTopic(topic: String?
|
|
)
|
|
case spaceChild
|
|
case spaceParent
|
|
case custom(eventType: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeOtherState: FfiConverterRustBuffer {
|
|
typealias SwiftType = OtherState
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> OtherState {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .policyRuleRoom
|
|
|
|
case 2: return .policyRuleServer
|
|
|
|
case 3: return .policyRuleUser
|
|
|
|
case 4: return .roomAliases
|
|
|
|
case 5: return .roomAvatar(url: try FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
|
|
case 6: return .roomCanonicalAlias
|
|
|
|
case 7: return .roomCreate
|
|
|
|
case 8: return .roomEncryption
|
|
|
|
case 9: return .roomGuestAccess
|
|
|
|
case 10: return .roomHistoryVisibility
|
|
|
|
case 11: return .roomJoinRules
|
|
|
|
case 12: return .roomName(name: try FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
|
|
case 13: return .roomPinnedEvents
|
|
|
|
case 14: return .roomPowerLevels(users: try FfiConverterDictionaryStringInt64.read(from: &buf), previous: try FfiConverterOptionDictionaryStringInt64.read(from: &buf)
|
|
)
|
|
|
|
case 15: return .roomServerAcl
|
|
|
|
case 16: return .roomThirdPartyInvite(displayName: try FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
|
|
case 17: return .roomTombstone
|
|
|
|
case 18: return .roomTopic(topic: try FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
|
|
case 19: return .spaceChild
|
|
|
|
case 20: return .spaceParent
|
|
|
|
case 21: return .custom(eventType: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: OtherState, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .policyRuleRoom:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .policyRuleServer:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .policyRuleUser:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .roomAliases:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case let .roomAvatar(url):
|
|
writeInt(&buf, Int32(5))
|
|
FfiConverterOptionString.write(url, into: &buf)
|
|
|
|
|
|
case .roomCanonicalAlias:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case .roomCreate:
|
|
writeInt(&buf, Int32(7))
|
|
|
|
|
|
case .roomEncryption:
|
|
writeInt(&buf, Int32(8))
|
|
|
|
|
|
case .roomGuestAccess:
|
|
writeInt(&buf, Int32(9))
|
|
|
|
|
|
case .roomHistoryVisibility:
|
|
writeInt(&buf, Int32(10))
|
|
|
|
|
|
case .roomJoinRules:
|
|
writeInt(&buf, Int32(11))
|
|
|
|
|
|
case let .roomName(name):
|
|
writeInt(&buf, Int32(12))
|
|
FfiConverterOptionString.write(name, into: &buf)
|
|
|
|
|
|
case .roomPinnedEvents:
|
|
writeInt(&buf, Int32(13))
|
|
|
|
|
|
case let .roomPowerLevels(users,previous):
|
|
writeInt(&buf, Int32(14))
|
|
FfiConverterDictionaryStringInt64.write(users, into: &buf)
|
|
FfiConverterOptionDictionaryStringInt64.write(previous, into: &buf)
|
|
|
|
|
|
case .roomServerAcl:
|
|
writeInt(&buf, Int32(15))
|
|
|
|
|
|
case let .roomThirdPartyInvite(displayName):
|
|
writeInt(&buf, Int32(16))
|
|
FfiConverterOptionString.write(displayName, into: &buf)
|
|
|
|
|
|
case .roomTombstone:
|
|
writeInt(&buf, Int32(17))
|
|
|
|
|
|
case let .roomTopic(topic):
|
|
writeInt(&buf, Int32(18))
|
|
FfiConverterOptionString.write(topic, into: &buf)
|
|
|
|
|
|
case .spaceChild:
|
|
writeInt(&buf, Int32(19))
|
|
|
|
|
|
case .spaceParent:
|
|
writeInt(&buf, Int32(20))
|
|
|
|
|
|
case let .custom(eventType):
|
|
writeInt(&buf, Int32(21))
|
|
FfiConverterString.write(eventType, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeOtherState_lift(_ buf: RustBuffer) throws -> OtherState {
|
|
return try FfiConverterTypeOtherState.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeOtherState_lower(_ value: OtherState) -> RustBuffer {
|
|
return FfiConverterTypeOtherState.lower(value)
|
|
}
|
|
|
|
|
|
extension OtherState: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum PaginationOptions {
|
|
|
|
case simpleRequest(eventLimit: UInt16, waitForToken: Bool
|
|
)
|
|
case untilNumItems(eventLimit: UInt16, items: UInt16, waitForToken: Bool
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypePaginationOptions: FfiConverterRustBuffer {
|
|
typealias SwiftType = PaginationOptions
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PaginationOptions {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .simpleRequest(eventLimit: try FfiConverterUInt16.read(from: &buf), waitForToken: try FfiConverterBool.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .untilNumItems(eventLimit: try FfiConverterUInt16.read(from: &buf), items: try FfiConverterUInt16.read(from: &buf), waitForToken: try FfiConverterBool.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: PaginationOptions, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .simpleRequest(eventLimit,waitForToken):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterUInt16.write(eventLimit, into: &buf)
|
|
FfiConverterBool.write(waitForToken, into: &buf)
|
|
|
|
|
|
case let .untilNumItems(eventLimit,items,waitForToken):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterUInt16.write(eventLimit, into: &buf)
|
|
FfiConverterUInt16.write(items, into: &buf)
|
|
FfiConverterBool.write(waitForToken, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypePaginationOptions_lift(_ buf: RustBuffer) throws -> PaginationOptions {
|
|
return try FfiConverterTypePaginationOptions.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypePaginationOptions_lower(_ value: PaginationOptions) -> RustBuffer {
|
|
return FfiConverterTypePaginationOptions.lower(value)
|
|
}
|
|
|
|
|
|
extension PaginationOptions: Equatable, Hashable {}
|
|
|
|
|
|
|
|
|
|
public enum ParseError {
|
|
|
|
|
|
|
|
case EmptyHost(message: String)
|
|
|
|
case IdnaError(message: String)
|
|
|
|
case InvalidPort(message: String)
|
|
|
|
case InvalidIpv4Address(message: String)
|
|
|
|
case InvalidIpv6Address(message: String)
|
|
|
|
case InvalidDomainCharacter(message: String)
|
|
|
|
case RelativeUrlWithoutBase(message: String)
|
|
|
|
case RelativeUrlWithCannotBeABaseBase(message: String)
|
|
|
|
case SetHostOnCannotBeABaseUrl(message: String)
|
|
|
|
case Overflow(message: String)
|
|
|
|
case Other(message: String)
|
|
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeParseError: FfiConverterRustBuffer {
|
|
typealias SwiftType = ParseError
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ParseError {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
|
|
|
|
|
|
case 1: return .EmptyHost(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .IdnaError(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .InvalidPort(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .InvalidIpv4Address(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 5: return .InvalidIpv6Address(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 6: return .InvalidDomainCharacter(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 7: return .RelativeUrlWithoutBase(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 8: return .RelativeUrlWithCannotBeABaseBase(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 9: return .SetHostOnCannotBeABaseUrl(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 10: return .Overflow(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 11: return .Other(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: ParseError, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
|
|
|
|
case .EmptyHost(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(1))
|
|
case .IdnaError(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(2))
|
|
case .InvalidPort(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(3))
|
|
case .InvalidIpv4Address(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(4))
|
|
case .InvalidIpv6Address(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(5))
|
|
case .InvalidDomainCharacter(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(6))
|
|
case .RelativeUrlWithoutBase(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(7))
|
|
case .RelativeUrlWithCannotBeABaseBase(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(8))
|
|
case .SetHostOnCannotBeABaseUrl(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(9))
|
|
case .Overflow(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(10))
|
|
case .Other(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(11))
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
extension ParseError: Equatable, Hashable {}
|
|
|
|
extension ParseError: Error { }
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum PollKind {
|
|
|
|
case disclosed
|
|
case undisclosed
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypePollKind: FfiConverterRustBuffer {
|
|
typealias SwiftType = PollKind
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PollKind {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .disclosed
|
|
|
|
case 2: return .undisclosed
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: PollKind, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .disclosed:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .undisclosed:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypePollKind_lift(_ buf: RustBuffer) throws -> PollKind {
|
|
return try FfiConverterTypePollKind.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypePollKind_lower(_ value: PollKind) -> RustBuffer {
|
|
return FfiConverterTypePollKind.lower(value)
|
|
}
|
|
|
|
|
|
extension PollKind: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum ProfileDetails {
|
|
|
|
case unavailable
|
|
case pending
|
|
case ready(displayName: String?, displayNameAmbiguous: Bool, avatarUrl: String?
|
|
)
|
|
case error(message: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeProfileDetails: FfiConverterRustBuffer {
|
|
typealias SwiftType = ProfileDetails
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ProfileDetails {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .unavailable
|
|
|
|
case 2: return .pending
|
|
|
|
case 3: return .ready(displayName: try FfiConverterOptionString.read(from: &buf), displayNameAmbiguous: try FfiConverterBool.read(from: &buf), avatarUrl: try FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .error(message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: ProfileDetails, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .unavailable:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .pending:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case let .ready(displayName,displayNameAmbiguous,avatarUrl):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterOptionString.write(displayName, into: &buf)
|
|
FfiConverterBool.write(displayNameAmbiguous, into: &buf)
|
|
FfiConverterOptionString.write(avatarUrl, into: &buf)
|
|
|
|
|
|
case let .error(message):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterString.write(message, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeProfileDetails_lift(_ buf: RustBuffer) throws -> ProfileDetails {
|
|
return try FfiConverterTypeProfileDetails.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeProfileDetails_lower(_ value: ProfileDetails) -> RustBuffer {
|
|
return FfiConverterTypeProfileDetails.lower(value)
|
|
}
|
|
|
|
|
|
extension ProfileDetails: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum PublicRoomJoinRule {
|
|
|
|
case `public`
|
|
case knock
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypePublicRoomJoinRule: FfiConverterRustBuffer {
|
|
typealias SwiftType = PublicRoomJoinRule
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PublicRoomJoinRule {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .`public`
|
|
|
|
case 2: return .knock
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: PublicRoomJoinRule, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .`public`:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .knock:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypePublicRoomJoinRule_lift(_ buf: RustBuffer) throws -> PublicRoomJoinRule {
|
|
return try FfiConverterTypePublicRoomJoinRule.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypePublicRoomJoinRule_lower(_ value: PublicRoomJoinRule) -> RustBuffer {
|
|
return FfiConverterTypePublicRoomJoinRule.lower(value)
|
|
}
|
|
|
|
|
|
extension PublicRoomJoinRule: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum PushFormat {
|
|
|
|
case eventIdOnly
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypePushFormat: FfiConverterRustBuffer {
|
|
typealias SwiftType = PushFormat
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PushFormat {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .eventIdOnly
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: PushFormat, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .eventIdOnly:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypePushFormat_lift(_ buf: RustBuffer) throws -> PushFormat {
|
|
return try FfiConverterTypePushFormat.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypePushFormat_lower(_ value: PushFormat) -> RustBuffer {
|
|
return FfiConverterTypePushFormat.lower(value)
|
|
}
|
|
|
|
|
|
extension PushFormat: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum PusherKind {
|
|
|
|
case http(data: HttpPusherData
|
|
)
|
|
case email
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypePusherKind: FfiConverterRustBuffer {
|
|
typealias SwiftType = PusherKind
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PusherKind {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .http(data: try FfiConverterTypeHttpPusherData.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .email
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: PusherKind, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .http(data):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterTypeHttpPusherData.write(data, into: &buf)
|
|
|
|
|
|
case .email:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypePusherKind_lift(_ buf: RustBuffer) throws -> PusherKind {
|
|
return try FfiConverterTypePusherKind.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypePusherKind_lower(_ value: PusherKind) -> RustBuffer {
|
|
return FfiConverterTypePusherKind.lower(value)
|
|
}
|
|
|
|
|
|
extension PusherKind: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
/**
|
|
* A [`TimelineItem`](super::TimelineItem) that doesn't correspond to an event.
|
|
*/
|
|
|
|
public enum ReceiptType {
|
|
|
|
case read
|
|
case readPrivate
|
|
case fullyRead
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeReceiptType: FfiConverterRustBuffer {
|
|
typealias SwiftType = ReceiptType
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ReceiptType {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .read
|
|
|
|
case 2: return .readPrivate
|
|
|
|
case 3: return .fullyRead
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: ReceiptType, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .read:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .readPrivate:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .fullyRead:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeReceiptType_lift(_ buf: RustBuffer) throws -> ReceiptType {
|
|
return try FfiConverterTypeReceiptType.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeReceiptType_lower(_ value: ReceiptType) -> RustBuffer {
|
|
return FfiConverterTypeReceiptType.lower(value)
|
|
}
|
|
|
|
|
|
extension ReceiptType: Equatable, Hashable {}
|
|
|
|
|
|
|
|
|
|
public enum RecoveryError {
|
|
|
|
|
|
|
|
/**
|
|
* A backup already exists on the homeserver, the recovery subsystem does
|
|
* not allow backups to be overwritten, disable recovery first.
|
|
*/
|
|
case BackupExistsOnServer
|
|
/**
|
|
* A typical SDK error.
|
|
*/
|
|
case Client(source: ClientError
|
|
)
|
|
/**
|
|
* Error in the secret storage subsystem.
|
|
*/
|
|
case SecretStorage(errorMessage: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRecoveryError: FfiConverterRustBuffer {
|
|
typealias SwiftType = RecoveryError
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RecoveryError {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
|
|
|
|
|
|
case 1: return .BackupExistsOnServer
|
|
case 2: return .Client(
|
|
source: try FfiConverterTypeClientError.read(from: &buf)
|
|
)
|
|
case 3: return .SecretStorage(
|
|
errorMessage: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RecoveryError, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
|
|
|
|
|
|
case .BackupExistsOnServer:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case let .Client(source):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterTypeClientError.write(source, into: &buf)
|
|
|
|
|
|
case let .SecretStorage(errorMessage):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterString.write(errorMessage, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
extension RecoveryError: Equatable, Hashable {}
|
|
|
|
extension RecoveryError: Error { }
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RecoveryState {
|
|
|
|
case unknown
|
|
case enabled
|
|
case disabled
|
|
case incomplete
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRecoveryState: FfiConverterRustBuffer {
|
|
typealias SwiftType = RecoveryState
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RecoveryState {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .unknown
|
|
|
|
case 2: return .enabled
|
|
|
|
case 3: return .disabled
|
|
|
|
case 4: return .incomplete
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RecoveryState, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .unknown:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .enabled:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .disabled:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .incomplete:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRecoveryState_lift(_ buf: RustBuffer) throws -> RecoveryState {
|
|
return try FfiConverterTypeRecoveryState.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRecoveryState_lower(_ value: RecoveryState) -> RustBuffer {
|
|
return FfiConverterTypeRecoveryState.lower(value)
|
|
}
|
|
|
|
|
|
extension RecoveryState: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RepliedToEventDetails {
|
|
|
|
case unavailable
|
|
case pending
|
|
case ready(content: TimelineItemContent, sender: String, senderProfile: ProfileDetails
|
|
)
|
|
case error(message: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRepliedToEventDetails: FfiConverterRustBuffer {
|
|
typealias SwiftType = RepliedToEventDetails
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RepliedToEventDetails {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .unavailable
|
|
|
|
case 2: return .pending
|
|
|
|
case 3: return .ready(content: try FfiConverterTypeTimelineItemContent.read(from: &buf), sender: try FfiConverterString.read(from: &buf), senderProfile: try FfiConverterTypeProfileDetails.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .error(message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RepliedToEventDetails, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .unavailable:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .pending:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case let .ready(content,sender,senderProfile):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterTypeTimelineItemContent.write(content, into: &buf)
|
|
FfiConverterString.write(sender, into: &buf)
|
|
FfiConverterTypeProfileDetails.write(senderProfile, into: &buf)
|
|
|
|
|
|
case let .error(message):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterString.write(message, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRepliedToEventDetails_lift(_ buf: RustBuffer) throws -> RepliedToEventDetails {
|
|
return try FfiConverterTypeRepliedToEventDetails.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRepliedToEventDetails_lower(_ value: RepliedToEventDetails) -> RustBuffer {
|
|
return FfiConverterTypeRepliedToEventDetails.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RoomDirectorySearchEntryUpdate {
|
|
|
|
case append(values: [RoomDescription]
|
|
)
|
|
case clear
|
|
case pushFront(value: RoomDescription
|
|
)
|
|
case pushBack(value: RoomDescription
|
|
)
|
|
case popFront
|
|
case popBack
|
|
case insert(index: UInt32, value: RoomDescription
|
|
)
|
|
case set(index: UInt32, value: RoomDescription
|
|
)
|
|
case remove(index: UInt32
|
|
)
|
|
case truncate(length: UInt32
|
|
)
|
|
case reset(values: [RoomDescription]
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomDirectorySearchEntryUpdate: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomDirectorySearchEntryUpdate
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomDirectorySearchEntryUpdate {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .append(values: try FfiConverterSequenceTypeRoomDescription.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .clear
|
|
|
|
case 3: return .pushFront(value: try FfiConverterTypeRoomDescription.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .pushBack(value: try FfiConverterTypeRoomDescription.read(from: &buf)
|
|
)
|
|
|
|
case 5: return .popFront
|
|
|
|
case 6: return .popBack
|
|
|
|
case 7: return .insert(index: try FfiConverterUInt32.read(from: &buf), value: try FfiConverterTypeRoomDescription.read(from: &buf)
|
|
)
|
|
|
|
case 8: return .set(index: try FfiConverterUInt32.read(from: &buf), value: try FfiConverterTypeRoomDescription.read(from: &buf)
|
|
)
|
|
|
|
case 9: return .remove(index: try FfiConverterUInt32.read(from: &buf)
|
|
)
|
|
|
|
case 10: return .truncate(length: try FfiConverterUInt32.read(from: &buf)
|
|
)
|
|
|
|
case 11: return .reset(values: try FfiConverterSequenceTypeRoomDescription.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomDirectorySearchEntryUpdate, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .append(values):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterSequenceTypeRoomDescription.write(values, into: &buf)
|
|
|
|
|
|
case .clear:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case let .pushFront(value):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterTypeRoomDescription.write(value, into: &buf)
|
|
|
|
|
|
case let .pushBack(value):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterTypeRoomDescription.write(value, into: &buf)
|
|
|
|
|
|
case .popFront:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .popBack:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case let .insert(index,value):
|
|
writeInt(&buf, Int32(7))
|
|
FfiConverterUInt32.write(index, into: &buf)
|
|
FfiConverterTypeRoomDescription.write(value, into: &buf)
|
|
|
|
|
|
case let .set(index,value):
|
|
writeInt(&buf, Int32(8))
|
|
FfiConverterUInt32.write(index, into: &buf)
|
|
FfiConverterTypeRoomDescription.write(value, into: &buf)
|
|
|
|
|
|
case let .remove(index):
|
|
writeInt(&buf, Int32(9))
|
|
FfiConverterUInt32.write(index, into: &buf)
|
|
|
|
|
|
case let .truncate(length):
|
|
writeInt(&buf, Int32(10))
|
|
FfiConverterUInt32.write(length, into: &buf)
|
|
|
|
|
|
case let .reset(values):
|
|
writeInt(&buf, Int32(11))
|
|
FfiConverterSequenceTypeRoomDescription.write(values, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomDirectorySearchEntryUpdate_lift(_ buf: RustBuffer) throws -> RoomDirectorySearchEntryUpdate {
|
|
return try FfiConverterTypeRoomDirectorySearchEntryUpdate.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomDirectorySearchEntryUpdate_lower(_ value: RoomDirectorySearchEntryUpdate) -> RustBuffer {
|
|
return FfiConverterTypeRoomDirectorySearchEntryUpdate.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomDirectorySearchEntryUpdate: Equatable, Hashable {}
|
|
|
|
|
|
|
|
|
|
public enum RoomError {
|
|
|
|
|
|
|
|
case InvalidAttachmentData(message: String)
|
|
|
|
case InvalidAttachmentMimeType(message: String)
|
|
|
|
case InvalidMediaInfo(message: String)
|
|
|
|
case TimelineUnavailable(message: String)
|
|
|
|
case InvalidThumbnailData(message: String)
|
|
|
|
case FailedSendingAttachment(message: String)
|
|
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomError: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomError
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomError {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
|
|
|
|
|
|
case 1: return .InvalidAttachmentData(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .InvalidAttachmentMimeType(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .InvalidMediaInfo(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .TimelineUnavailable(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 5: return .InvalidThumbnailData(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 6: return .FailedSendingAttachment(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomError, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
|
|
|
|
case .InvalidAttachmentData(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(1))
|
|
case .InvalidAttachmentMimeType(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(2))
|
|
case .InvalidMediaInfo(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(3))
|
|
case .TimelineUnavailable(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(4))
|
|
case .InvalidThumbnailData(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(5))
|
|
case .FailedSendingAttachment(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
extension RoomError: Equatable, Hashable {}
|
|
|
|
extension RoomError: Error { }
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RoomListEntriesDynamicFilterKind {
|
|
|
|
case all(filters: [RoomListEntriesDynamicFilterKind]
|
|
)
|
|
case any(filters: [RoomListEntriesDynamicFilterKind]
|
|
)
|
|
case nonLeft
|
|
case unread
|
|
case favourite
|
|
case invite
|
|
case category(expect: RoomListFilterCategory
|
|
)
|
|
case none
|
|
case normalizedMatchRoomName(pattern: String
|
|
)
|
|
case fuzzyMatchRoomName(pattern: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomListEntriesDynamicFilterKind: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomListEntriesDynamicFilterKind
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListEntriesDynamicFilterKind {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .all(filters: try FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .any(filters: try FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .nonLeft
|
|
|
|
case 4: return .unread
|
|
|
|
case 5: return .favourite
|
|
|
|
case 6: return .invite
|
|
|
|
case 7: return .category(expect: try FfiConverterTypeRoomListFilterCategory.read(from: &buf)
|
|
)
|
|
|
|
case 8: return .none
|
|
|
|
case 9: return .normalizedMatchRoomName(pattern: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 10: return .fuzzyMatchRoomName(pattern: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomListEntriesDynamicFilterKind, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .all(filters):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind.write(filters, into: &buf)
|
|
|
|
|
|
case let .any(filters):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind.write(filters, into: &buf)
|
|
|
|
|
|
case .nonLeft:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .unread:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case .favourite:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .invite:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case let .category(expect):
|
|
writeInt(&buf, Int32(7))
|
|
FfiConverterTypeRoomListFilterCategory.write(expect, into: &buf)
|
|
|
|
|
|
case .none:
|
|
writeInt(&buf, Int32(8))
|
|
|
|
|
|
case let .normalizedMatchRoomName(pattern):
|
|
writeInt(&buf, Int32(9))
|
|
FfiConverterString.write(pattern, into: &buf)
|
|
|
|
|
|
case let .fuzzyMatchRoomName(pattern):
|
|
writeInt(&buf, Int32(10))
|
|
FfiConverterString.write(pattern, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListEntriesDynamicFilterKind_lift(_ buf: RustBuffer) throws -> RoomListEntriesDynamicFilterKind {
|
|
return try FfiConverterTypeRoomListEntriesDynamicFilterKind.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListEntriesDynamicFilterKind_lower(_ value: RoomListEntriesDynamicFilterKind) -> RustBuffer {
|
|
return FfiConverterTypeRoomListEntriesDynamicFilterKind.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomListEntriesDynamicFilterKind: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RoomListEntriesUpdate {
|
|
|
|
case append(values: [RoomListEntry]
|
|
)
|
|
case clear
|
|
case pushFront(value: RoomListEntry
|
|
)
|
|
case pushBack(value: RoomListEntry
|
|
)
|
|
case popFront
|
|
case popBack
|
|
case insert(index: UInt32, value: RoomListEntry
|
|
)
|
|
case set(index: UInt32, value: RoomListEntry
|
|
)
|
|
case remove(index: UInt32
|
|
)
|
|
case truncate(length: UInt32
|
|
)
|
|
case reset(values: [RoomListEntry]
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomListEntriesUpdate: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomListEntriesUpdate
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListEntriesUpdate {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .append(values: try FfiConverterSequenceTypeRoomListEntry.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .clear
|
|
|
|
case 3: return .pushFront(value: try FfiConverterTypeRoomListEntry.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .pushBack(value: try FfiConverterTypeRoomListEntry.read(from: &buf)
|
|
)
|
|
|
|
case 5: return .popFront
|
|
|
|
case 6: return .popBack
|
|
|
|
case 7: return .insert(index: try FfiConverterUInt32.read(from: &buf), value: try FfiConverterTypeRoomListEntry.read(from: &buf)
|
|
)
|
|
|
|
case 8: return .set(index: try FfiConverterUInt32.read(from: &buf), value: try FfiConverterTypeRoomListEntry.read(from: &buf)
|
|
)
|
|
|
|
case 9: return .remove(index: try FfiConverterUInt32.read(from: &buf)
|
|
)
|
|
|
|
case 10: return .truncate(length: try FfiConverterUInt32.read(from: &buf)
|
|
)
|
|
|
|
case 11: return .reset(values: try FfiConverterSequenceTypeRoomListEntry.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomListEntriesUpdate, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .append(values):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterSequenceTypeRoomListEntry.write(values, into: &buf)
|
|
|
|
|
|
case .clear:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case let .pushFront(value):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterTypeRoomListEntry.write(value, into: &buf)
|
|
|
|
|
|
case let .pushBack(value):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterTypeRoomListEntry.write(value, into: &buf)
|
|
|
|
|
|
case .popFront:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .popBack:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case let .insert(index,value):
|
|
writeInt(&buf, Int32(7))
|
|
FfiConverterUInt32.write(index, into: &buf)
|
|
FfiConverterTypeRoomListEntry.write(value, into: &buf)
|
|
|
|
|
|
case let .set(index,value):
|
|
writeInt(&buf, Int32(8))
|
|
FfiConverterUInt32.write(index, into: &buf)
|
|
FfiConverterTypeRoomListEntry.write(value, into: &buf)
|
|
|
|
|
|
case let .remove(index):
|
|
writeInt(&buf, Int32(9))
|
|
FfiConverterUInt32.write(index, into: &buf)
|
|
|
|
|
|
case let .truncate(length):
|
|
writeInt(&buf, Int32(10))
|
|
FfiConverterUInt32.write(length, into: &buf)
|
|
|
|
|
|
case let .reset(values):
|
|
writeInt(&buf, Int32(11))
|
|
FfiConverterSequenceTypeRoomListEntry.write(values, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListEntriesUpdate_lift(_ buf: RustBuffer) throws -> RoomListEntriesUpdate {
|
|
return try FfiConverterTypeRoomListEntriesUpdate.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListEntriesUpdate_lower(_ value: RoomListEntriesUpdate) -> RustBuffer {
|
|
return FfiConverterTypeRoomListEntriesUpdate.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomListEntriesUpdate: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RoomListEntry {
|
|
|
|
case empty
|
|
case invalidated(roomId: String
|
|
)
|
|
case filled(roomId: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomListEntry: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomListEntry
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListEntry {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .empty
|
|
|
|
case 2: return .invalidated(roomId: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .filled(roomId: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomListEntry, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .empty:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case let .invalidated(roomId):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterString.write(roomId, into: &buf)
|
|
|
|
|
|
case let .filled(roomId):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterString.write(roomId, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListEntry_lift(_ buf: RustBuffer) throws -> RoomListEntry {
|
|
return try FfiConverterTypeRoomListEntry.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListEntry_lower(_ value: RoomListEntry) -> RustBuffer {
|
|
return FfiConverterTypeRoomListEntry.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomListEntry: Equatable, Hashable {}
|
|
|
|
|
|
|
|
|
|
public enum RoomListError {
|
|
|
|
|
|
|
|
case SlidingSync(error: String
|
|
)
|
|
case UnknownList(listName: String
|
|
)
|
|
case InputCannotBeApplied
|
|
case RoomNotFound(roomName: String
|
|
)
|
|
case InvalidRoomId(error: String
|
|
)
|
|
case TimelineAlreadyExists(roomName: String
|
|
)
|
|
case TimelineNotInitialized(roomName: String
|
|
)
|
|
case InitializingTimeline(error: String
|
|
)
|
|
case EventCache(error: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomListError: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomListError
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListError {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
|
|
|
|
|
|
case 1: return .SlidingSync(
|
|
error: try FfiConverterString.read(from: &buf)
|
|
)
|
|
case 2: return .UnknownList(
|
|
listName: try FfiConverterString.read(from: &buf)
|
|
)
|
|
case 3: return .InputCannotBeApplied
|
|
case 4: return .RoomNotFound(
|
|
roomName: try FfiConverterString.read(from: &buf)
|
|
)
|
|
case 5: return .InvalidRoomId(
|
|
error: try FfiConverterString.read(from: &buf)
|
|
)
|
|
case 6: return .TimelineAlreadyExists(
|
|
roomName: try FfiConverterString.read(from: &buf)
|
|
)
|
|
case 7: return .TimelineNotInitialized(
|
|
roomName: try FfiConverterString.read(from: &buf)
|
|
)
|
|
case 8: return .InitializingTimeline(
|
|
error: try FfiConverterString.read(from: &buf)
|
|
)
|
|
case 9: return .EventCache(
|
|
error: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomListError, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
|
|
|
|
|
|
case let .SlidingSync(error):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterString.write(error, into: &buf)
|
|
|
|
|
|
case let .UnknownList(listName):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterString.write(listName, into: &buf)
|
|
|
|
|
|
case .InputCannotBeApplied:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case let .RoomNotFound(roomName):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterString.write(roomName, into: &buf)
|
|
|
|
|
|
case let .InvalidRoomId(error):
|
|
writeInt(&buf, Int32(5))
|
|
FfiConverterString.write(error, into: &buf)
|
|
|
|
|
|
case let .TimelineAlreadyExists(roomName):
|
|
writeInt(&buf, Int32(6))
|
|
FfiConverterString.write(roomName, into: &buf)
|
|
|
|
|
|
case let .TimelineNotInitialized(roomName):
|
|
writeInt(&buf, Int32(7))
|
|
FfiConverterString.write(roomName, into: &buf)
|
|
|
|
|
|
case let .InitializingTimeline(error):
|
|
writeInt(&buf, Int32(8))
|
|
FfiConverterString.write(error, into: &buf)
|
|
|
|
|
|
case let .EventCache(error):
|
|
writeInt(&buf, Int32(9))
|
|
FfiConverterString.write(error, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
extension RoomListError: Equatable, Hashable {}
|
|
|
|
extension RoomListError: Error { }
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RoomListFilterCategory {
|
|
|
|
case group
|
|
case people
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomListFilterCategory: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomListFilterCategory
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListFilterCategory {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .group
|
|
|
|
case 2: return .people
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomListFilterCategory, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .group:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .people:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListFilterCategory_lift(_ buf: RustBuffer) throws -> RoomListFilterCategory {
|
|
return try FfiConverterTypeRoomListFilterCategory.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListFilterCategory_lower(_ value: RoomListFilterCategory) -> RustBuffer {
|
|
return FfiConverterTypeRoomListFilterCategory.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomListFilterCategory: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RoomListInput {
|
|
|
|
case viewport(ranges: [RoomListRange]
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomListInput: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomListInput
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListInput {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .viewport(ranges: try FfiConverterSequenceTypeRoomListRange.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomListInput, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .viewport(ranges):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterSequenceTypeRoomListRange.write(ranges, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListInput_lift(_ buf: RustBuffer) throws -> RoomListInput {
|
|
return try FfiConverterTypeRoomListInput.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListInput_lower(_ value: RoomListInput) -> RustBuffer {
|
|
return FfiConverterTypeRoomListInput.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomListInput: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RoomListLoadingState {
|
|
|
|
case notLoaded
|
|
case loaded(maximumNumberOfRooms: UInt32?
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomListLoadingState: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomListLoadingState
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListLoadingState {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .notLoaded
|
|
|
|
case 2: return .loaded(maximumNumberOfRooms: try FfiConverterOptionUInt32.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomListLoadingState, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .notLoaded:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case let .loaded(maximumNumberOfRooms):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterOptionUInt32.write(maximumNumberOfRooms, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListLoadingState_lift(_ buf: RustBuffer) throws -> RoomListLoadingState {
|
|
return try FfiConverterTypeRoomListLoadingState.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListLoadingState_lower(_ value: RoomListLoadingState) -> RustBuffer {
|
|
return FfiConverterTypeRoomListLoadingState.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomListLoadingState: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RoomListServiceState {
|
|
|
|
case initial
|
|
case settingUp
|
|
case recovering
|
|
case running
|
|
case error
|
|
case terminated
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomListServiceState: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomListServiceState
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListServiceState {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .initial
|
|
|
|
case 2: return .settingUp
|
|
|
|
case 3: return .recovering
|
|
|
|
case 4: return .running
|
|
|
|
case 5: return .error
|
|
|
|
case 6: return .terminated
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomListServiceState, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .initial:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .settingUp:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .recovering:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .running:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case .error:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .terminated:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListServiceState_lift(_ buf: RustBuffer) throws -> RoomListServiceState {
|
|
return try FfiConverterTypeRoomListServiceState.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListServiceState_lower(_ value: RoomListServiceState) -> RustBuffer {
|
|
return FfiConverterTypeRoomListServiceState.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomListServiceState: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RoomListServiceSyncIndicator {
|
|
|
|
case show
|
|
case hide
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomListServiceSyncIndicator: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomListServiceSyncIndicator
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomListServiceSyncIndicator {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .show
|
|
|
|
case 2: return .hide
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomListServiceSyncIndicator, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .show:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .hide:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomListServiceSyncIndicator_lift(_ buf: RustBuffer) throws -> RoomListServiceSyncIndicator {
|
|
return try FfiConverterTypeRoomListServiceSyncIndicator.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomListServiceSyncIndicator_lower(_ value: RoomListServiceSyncIndicator) -> RustBuffer {
|
|
return FfiConverterTypeRoomListServiceSyncIndicator.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomListServiceSyncIndicator: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
/**
|
|
* Enum representing the push notification modes for a room.
|
|
*/
|
|
|
|
public enum RoomNotificationMode {
|
|
|
|
/**
|
|
* Receive notifications for all messages.
|
|
*/
|
|
case allMessages
|
|
/**
|
|
* Receive notifications for mentions and keywords only.
|
|
*/
|
|
case mentionsAndKeywordsOnly
|
|
/**
|
|
* Do not receive any notifications.
|
|
*/
|
|
case mute
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomNotificationMode: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomNotificationMode
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomNotificationMode {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .allMessages
|
|
|
|
case 2: return .mentionsAndKeywordsOnly
|
|
|
|
case 3: return .mute
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomNotificationMode, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .allMessages:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .mentionsAndKeywordsOnly:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .mute:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomNotificationMode_lift(_ buf: RustBuffer) throws -> RoomNotificationMode {
|
|
return try FfiConverterTypeRoomNotificationMode.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomNotificationMode_lower(_ value: RoomNotificationMode) -> RustBuffer {
|
|
return FfiConverterTypeRoomNotificationMode.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomNotificationMode: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RoomPreset {
|
|
|
|
/**
|
|
* `join_rules` is set to `invite` and `history_visibility` is set to
|
|
* `shared`.
|
|
*/
|
|
case privateChat
|
|
/**
|
|
* `join_rules` is set to `public` and `history_visibility` is set to
|
|
* `shared`.
|
|
*/
|
|
case publicChat
|
|
/**
|
|
* Same as `PrivateChat`, but all initial invitees get the same power level
|
|
* as the creator.
|
|
*/
|
|
case trustedPrivateChat
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomPreset: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomPreset
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomPreset {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .privateChat
|
|
|
|
case 2: return .publicChat
|
|
|
|
case 3: return .trustedPrivateChat
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomPreset, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .privateChat:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .publicChat:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .trustedPrivateChat:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomPreset_lift(_ buf: RustBuffer) throws -> RoomPreset {
|
|
return try FfiConverterTypeRoomPreset.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomPreset_lower(_ value: RoomPreset) -> RustBuffer {
|
|
return FfiConverterTypeRoomPreset.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomPreset: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum RoomVisibility {
|
|
|
|
/**
|
|
* Indicates that the room will be shown in the published room list.
|
|
*/
|
|
case `public`
|
|
/**
|
|
* Indicates that the room will not be shown in the published room list.
|
|
*/
|
|
case `private`
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeRoomVisibility: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomVisibility
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoomVisibility {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .`public`
|
|
|
|
case 2: return .`private`
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: RoomVisibility, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .`public`:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .`private`:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeRoomVisibility_lift(_ buf: RustBuffer) throws -> RoomVisibility {
|
|
return try FfiConverterTypeRoomVisibility.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeRoomVisibility_lower(_ value: RoomVisibility) -> RustBuffer {
|
|
return FfiConverterTypeRoomVisibility.lower(value)
|
|
}
|
|
|
|
|
|
extension RoomVisibility: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum SessionVerificationData {
|
|
|
|
case emojis(emojis: [SessionVerificationEmoji], indices: Data
|
|
)
|
|
case decimals(values: [UInt16]
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeSessionVerificationData: FfiConverterRustBuffer {
|
|
typealias SwiftType = SessionVerificationData
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SessionVerificationData {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .emojis(emojis: try FfiConverterSequenceTypeSessionVerificationEmoji.read(from: &buf), indices: try FfiConverterData.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .decimals(values: try FfiConverterSequenceUInt16.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: SessionVerificationData, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .emojis(emojis,indices):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterSequenceTypeSessionVerificationEmoji.write(emojis, into: &buf)
|
|
FfiConverterData.write(indices, into: &buf)
|
|
|
|
|
|
case let .decimals(values):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterSequenceUInt16.write(values, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeSessionVerificationData_lift(_ buf: RustBuffer) throws -> SessionVerificationData {
|
|
return try FfiConverterTypeSessionVerificationData.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeSessionVerificationData_lower(_ value: SessionVerificationData) -> RustBuffer {
|
|
return FfiConverterTypeSessionVerificationData.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum StateEventContent {
|
|
|
|
case policyRuleRoom
|
|
case policyRuleServer
|
|
case policyRuleUser
|
|
case roomAliases
|
|
case roomAvatar
|
|
case roomCanonicalAlias
|
|
case roomCreate
|
|
case roomEncryption
|
|
case roomGuestAccess
|
|
case roomHistoryVisibility
|
|
case roomJoinRules
|
|
case roomMemberContent(userId: String, membershipState: MembershipState
|
|
)
|
|
case roomName
|
|
case roomPinnedEvents
|
|
case roomPowerLevels
|
|
case roomServerAcl
|
|
case roomThirdPartyInvite
|
|
case roomTombstone
|
|
case roomTopic
|
|
case spaceChild
|
|
case spaceParent
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeStateEventContent: FfiConverterRustBuffer {
|
|
typealias SwiftType = StateEventContent
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> StateEventContent {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .policyRuleRoom
|
|
|
|
case 2: return .policyRuleServer
|
|
|
|
case 3: return .policyRuleUser
|
|
|
|
case 4: return .roomAliases
|
|
|
|
case 5: return .roomAvatar
|
|
|
|
case 6: return .roomCanonicalAlias
|
|
|
|
case 7: return .roomCreate
|
|
|
|
case 8: return .roomEncryption
|
|
|
|
case 9: return .roomGuestAccess
|
|
|
|
case 10: return .roomHistoryVisibility
|
|
|
|
case 11: return .roomJoinRules
|
|
|
|
case 12: return .roomMemberContent(userId: try FfiConverterString.read(from: &buf), membershipState: try FfiConverterTypeMembershipState.read(from: &buf)
|
|
)
|
|
|
|
case 13: return .roomName
|
|
|
|
case 14: return .roomPinnedEvents
|
|
|
|
case 15: return .roomPowerLevels
|
|
|
|
case 16: return .roomServerAcl
|
|
|
|
case 17: return .roomThirdPartyInvite
|
|
|
|
case 18: return .roomTombstone
|
|
|
|
case 19: return .roomTopic
|
|
|
|
case 20: return .spaceChild
|
|
|
|
case 21: return .spaceParent
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: StateEventContent, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .policyRuleRoom:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .policyRuleServer:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .policyRuleUser:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .roomAliases:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case .roomAvatar:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .roomCanonicalAlias:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case .roomCreate:
|
|
writeInt(&buf, Int32(7))
|
|
|
|
|
|
case .roomEncryption:
|
|
writeInt(&buf, Int32(8))
|
|
|
|
|
|
case .roomGuestAccess:
|
|
writeInt(&buf, Int32(9))
|
|
|
|
|
|
case .roomHistoryVisibility:
|
|
writeInt(&buf, Int32(10))
|
|
|
|
|
|
case .roomJoinRules:
|
|
writeInt(&buf, Int32(11))
|
|
|
|
|
|
case let .roomMemberContent(userId,membershipState):
|
|
writeInt(&buf, Int32(12))
|
|
FfiConverterString.write(userId, into: &buf)
|
|
FfiConverterTypeMembershipState.write(membershipState, into: &buf)
|
|
|
|
|
|
case .roomName:
|
|
writeInt(&buf, Int32(13))
|
|
|
|
|
|
case .roomPinnedEvents:
|
|
writeInt(&buf, Int32(14))
|
|
|
|
|
|
case .roomPowerLevels:
|
|
writeInt(&buf, Int32(15))
|
|
|
|
|
|
case .roomServerAcl:
|
|
writeInt(&buf, Int32(16))
|
|
|
|
|
|
case .roomThirdPartyInvite:
|
|
writeInt(&buf, Int32(17))
|
|
|
|
|
|
case .roomTombstone:
|
|
writeInt(&buf, Int32(18))
|
|
|
|
|
|
case .roomTopic:
|
|
writeInt(&buf, Int32(19))
|
|
|
|
|
|
case .spaceChild:
|
|
writeInt(&buf, Int32(20))
|
|
|
|
|
|
case .spaceParent:
|
|
writeInt(&buf, Int32(21))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeStateEventContent_lift(_ buf: RustBuffer) throws -> StateEventContent {
|
|
return try FfiConverterTypeStateEventContent.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeStateEventContent_lower(_ value: StateEventContent) -> RustBuffer {
|
|
return FfiConverterTypeStateEventContent.lower(value)
|
|
}
|
|
|
|
|
|
extension StateEventContent: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum StateEventType {
|
|
|
|
case callMember
|
|
case policyRuleRoom
|
|
case policyRuleServer
|
|
case policyRuleUser
|
|
case roomAliases
|
|
case roomAvatar
|
|
case roomCanonicalAlias
|
|
case roomCreate
|
|
case roomEncryption
|
|
case roomGuestAccess
|
|
case roomHistoryVisibility
|
|
case roomJoinRules
|
|
case roomMemberEvent
|
|
case roomName
|
|
case roomPinnedEvents
|
|
case roomPowerLevels
|
|
case roomServerAcl
|
|
case roomThirdPartyInvite
|
|
case roomTombstone
|
|
case roomTopic
|
|
case spaceChild
|
|
case spaceParent
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeStateEventType: FfiConverterRustBuffer {
|
|
typealias SwiftType = StateEventType
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> StateEventType {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .callMember
|
|
|
|
case 2: return .policyRuleRoom
|
|
|
|
case 3: return .policyRuleServer
|
|
|
|
case 4: return .policyRuleUser
|
|
|
|
case 5: return .roomAliases
|
|
|
|
case 6: return .roomAvatar
|
|
|
|
case 7: return .roomCanonicalAlias
|
|
|
|
case 8: return .roomCreate
|
|
|
|
case 9: return .roomEncryption
|
|
|
|
case 10: return .roomGuestAccess
|
|
|
|
case 11: return .roomHistoryVisibility
|
|
|
|
case 12: return .roomJoinRules
|
|
|
|
case 13: return .roomMemberEvent
|
|
|
|
case 14: return .roomName
|
|
|
|
case 15: return .roomPinnedEvents
|
|
|
|
case 16: return .roomPowerLevels
|
|
|
|
case 17: return .roomServerAcl
|
|
|
|
case 18: return .roomThirdPartyInvite
|
|
|
|
case 19: return .roomTombstone
|
|
|
|
case 20: return .roomTopic
|
|
|
|
case 21: return .spaceChild
|
|
|
|
case 22: return .spaceParent
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: StateEventType, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .callMember:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .policyRuleRoom:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .policyRuleServer:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .policyRuleUser:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case .roomAliases:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .roomAvatar:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case .roomCanonicalAlias:
|
|
writeInt(&buf, Int32(7))
|
|
|
|
|
|
case .roomCreate:
|
|
writeInt(&buf, Int32(8))
|
|
|
|
|
|
case .roomEncryption:
|
|
writeInt(&buf, Int32(9))
|
|
|
|
|
|
case .roomGuestAccess:
|
|
writeInt(&buf, Int32(10))
|
|
|
|
|
|
case .roomHistoryVisibility:
|
|
writeInt(&buf, Int32(11))
|
|
|
|
|
|
case .roomJoinRules:
|
|
writeInt(&buf, Int32(12))
|
|
|
|
|
|
case .roomMemberEvent:
|
|
writeInt(&buf, Int32(13))
|
|
|
|
|
|
case .roomName:
|
|
writeInt(&buf, Int32(14))
|
|
|
|
|
|
case .roomPinnedEvents:
|
|
writeInt(&buf, Int32(15))
|
|
|
|
|
|
case .roomPowerLevels:
|
|
writeInt(&buf, Int32(16))
|
|
|
|
|
|
case .roomServerAcl:
|
|
writeInt(&buf, Int32(17))
|
|
|
|
|
|
case .roomThirdPartyInvite:
|
|
writeInt(&buf, Int32(18))
|
|
|
|
|
|
case .roomTombstone:
|
|
writeInt(&buf, Int32(19))
|
|
|
|
|
|
case .roomTopic:
|
|
writeInt(&buf, Int32(20))
|
|
|
|
|
|
case .spaceChild:
|
|
writeInt(&buf, Int32(21))
|
|
|
|
|
|
case .spaceParent:
|
|
writeInt(&buf, Int32(22))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeStateEventType_lift(_ buf: RustBuffer) throws -> StateEventType {
|
|
return try FfiConverterTypeStateEventType.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeStateEventType_lower(_ value: StateEventType) -> RustBuffer {
|
|
return FfiConverterTypeStateEventType.lower(value)
|
|
}
|
|
|
|
|
|
extension StateEventType: Equatable, Hashable {}
|
|
|
|
|
|
|
|
|
|
public enum SteadyStateError {
|
|
|
|
|
|
|
|
case BackupDisabled(message: String)
|
|
|
|
case Connection(message: String)
|
|
|
|
case Lagged(message: String)
|
|
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeSteadyStateError: FfiConverterRustBuffer {
|
|
typealias SwiftType = SteadyStateError
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SteadyStateError {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
|
|
|
|
|
|
case 1: return .BackupDisabled(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .Connection(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .Lagged(
|
|
message: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: SteadyStateError, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
|
|
|
|
case .BackupDisabled(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(1))
|
|
case .Connection(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(2))
|
|
case .Lagged(_ /* message is ignored*/):
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
extension SteadyStateError: Equatable, Hashable {}
|
|
|
|
extension SteadyStateError: Error { }
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum SyncServiceState {
|
|
|
|
case idle
|
|
case running
|
|
case terminated
|
|
case error
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeSyncServiceState: FfiConverterRustBuffer {
|
|
typealias SwiftType = SyncServiceState
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SyncServiceState {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .idle
|
|
|
|
case 2: return .running
|
|
|
|
case 3: return .terminated
|
|
|
|
case 4: return .error
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: SyncServiceState, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .idle:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .running:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .terminated:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .error:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeSyncServiceState_lift(_ buf: RustBuffer) throws -> SyncServiceState {
|
|
return try FfiConverterTypeSyncServiceState.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeSyncServiceState_lower(_ value: SyncServiceState) -> RustBuffer {
|
|
return FfiConverterTypeSyncServiceState.lower(value)
|
|
}
|
|
|
|
|
|
extension SyncServiceState: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum TimelineChange {
|
|
|
|
case append
|
|
case clear
|
|
case insert
|
|
case set
|
|
case remove
|
|
case pushBack
|
|
case pushFront
|
|
case popBack
|
|
case popFront
|
|
case truncate
|
|
case reset
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeTimelineChange: FfiConverterRustBuffer {
|
|
typealias SwiftType = TimelineChange
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TimelineChange {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .append
|
|
|
|
case 2: return .clear
|
|
|
|
case 3: return .insert
|
|
|
|
case 4: return .set
|
|
|
|
case 5: return .remove
|
|
|
|
case 6: return .pushBack
|
|
|
|
case 7: return .pushFront
|
|
|
|
case 8: return .popBack
|
|
|
|
case 9: return .popFront
|
|
|
|
case 10: return .truncate
|
|
|
|
case 11: return .reset
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: TimelineChange, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .append:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .clear:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .insert:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
|
|
case .set:
|
|
writeInt(&buf, Int32(4))
|
|
|
|
|
|
case .remove:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case .pushBack:
|
|
writeInt(&buf, Int32(6))
|
|
|
|
|
|
case .pushFront:
|
|
writeInt(&buf, Int32(7))
|
|
|
|
|
|
case .popBack:
|
|
writeInt(&buf, Int32(8))
|
|
|
|
|
|
case .popFront:
|
|
writeInt(&buf, Int32(9))
|
|
|
|
|
|
case .truncate:
|
|
writeInt(&buf, Int32(10))
|
|
|
|
|
|
case .reset:
|
|
writeInt(&buf, Int32(11))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeTimelineChange_lift(_ buf: RustBuffer) throws -> TimelineChange {
|
|
return try FfiConverterTypeTimelineChange.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeTimelineChange_lower(_ value: TimelineChange) -> RustBuffer {
|
|
return FfiConverterTypeTimelineChange.lower(value)
|
|
}
|
|
|
|
|
|
extension TimelineChange: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum TimelineEventType {
|
|
|
|
case messageLike(content: MessageLikeEventContent
|
|
)
|
|
case state(content: StateEventContent
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeTimelineEventType: FfiConverterRustBuffer {
|
|
typealias SwiftType = TimelineEventType
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TimelineEventType {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .messageLike(content: try FfiConverterTypeMessageLikeEventContent.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .state(content: try FfiConverterTypeStateEventContent.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: TimelineEventType, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .messageLike(content):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterTypeMessageLikeEventContent.write(content, into: &buf)
|
|
|
|
|
|
case let .state(content):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterTypeStateEventContent.write(content, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeTimelineEventType_lift(_ buf: RustBuffer) throws -> TimelineEventType {
|
|
return try FfiConverterTypeTimelineEventType.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeTimelineEventType_lower(_ value: TimelineEventType) -> RustBuffer {
|
|
return FfiConverterTypeTimelineEventType.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum TimelineItemContentKind {
|
|
|
|
case message
|
|
case redactedMessage
|
|
case sticker(body: String, info: ImageInfo, url: String
|
|
)
|
|
case poll(question: String, kind: PollKind, maxSelections: UInt64, answers: [PollAnswer], votes: [String: [String]], endTime: UInt64?, hasBeenEdited: Bool
|
|
)
|
|
case callInvite
|
|
case unableToDecrypt(msg: EncryptedMessage
|
|
)
|
|
case roomMembership(userId: String, change: MembershipChange?
|
|
)
|
|
case profileChange(displayName: String?, prevDisplayName: String?, avatarUrl: String?, prevAvatarUrl: String?
|
|
)
|
|
case state(stateKey: String, content: OtherState
|
|
)
|
|
case failedToParseMessageLike(eventType: String, error: String
|
|
)
|
|
case failedToParseState(eventType: String, stateKey: String, error: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeTimelineItemContentKind: FfiConverterRustBuffer {
|
|
typealias SwiftType = TimelineItemContentKind
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TimelineItemContentKind {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .message
|
|
|
|
case 2: return .redactedMessage
|
|
|
|
case 3: return .sticker(body: try FfiConverterString.read(from: &buf), info: try FfiConverterTypeImageInfo.read(from: &buf), url: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .poll(question: try FfiConverterString.read(from: &buf), kind: try FfiConverterTypePollKind.read(from: &buf), maxSelections: try FfiConverterUInt64.read(from: &buf), answers: try FfiConverterSequenceTypePollAnswer.read(from: &buf), votes: try FfiConverterDictionaryStringSequenceString.read(from: &buf), endTime: try FfiConverterOptionUInt64.read(from: &buf), hasBeenEdited: try FfiConverterBool.read(from: &buf)
|
|
)
|
|
|
|
case 5: return .callInvite
|
|
|
|
case 6: return .unableToDecrypt(msg: try FfiConverterTypeEncryptedMessage.read(from: &buf)
|
|
)
|
|
|
|
case 7: return .roomMembership(userId: try FfiConverterString.read(from: &buf), change: try FfiConverterOptionTypeMembershipChange.read(from: &buf)
|
|
)
|
|
|
|
case 8: return .profileChange(displayName: try FfiConverterOptionString.read(from: &buf), prevDisplayName: try FfiConverterOptionString.read(from: &buf), avatarUrl: try FfiConverterOptionString.read(from: &buf), prevAvatarUrl: try FfiConverterOptionString.read(from: &buf)
|
|
)
|
|
|
|
case 9: return .state(stateKey: try FfiConverterString.read(from: &buf), content: try FfiConverterTypeOtherState.read(from: &buf)
|
|
)
|
|
|
|
case 10: return .failedToParseMessageLike(eventType: try FfiConverterString.read(from: &buf), error: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 11: return .failedToParseState(eventType: try FfiConverterString.read(from: &buf), stateKey: try FfiConverterString.read(from: &buf), error: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: TimelineItemContentKind, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .message:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .redactedMessage:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case let .sticker(body,info,url):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterString.write(body, into: &buf)
|
|
FfiConverterTypeImageInfo.write(info, into: &buf)
|
|
FfiConverterString.write(url, into: &buf)
|
|
|
|
|
|
case let .poll(question,kind,maxSelections,answers,votes,endTime,hasBeenEdited):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterString.write(question, into: &buf)
|
|
FfiConverterTypePollKind.write(kind, into: &buf)
|
|
FfiConverterUInt64.write(maxSelections, into: &buf)
|
|
FfiConverterSequenceTypePollAnswer.write(answers, into: &buf)
|
|
FfiConverterDictionaryStringSequenceString.write(votes, into: &buf)
|
|
FfiConverterOptionUInt64.write(endTime, into: &buf)
|
|
FfiConverterBool.write(hasBeenEdited, into: &buf)
|
|
|
|
|
|
case .callInvite:
|
|
writeInt(&buf, Int32(5))
|
|
|
|
|
|
case let .unableToDecrypt(msg):
|
|
writeInt(&buf, Int32(6))
|
|
FfiConverterTypeEncryptedMessage.write(msg, into: &buf)
|
|
|
|
|
|
case let .roomMembership(userId,change):
|
|
writeInt(&buf, Int32(7))
|
|
FfiConverterString.write(userId, into: &buf)
|
|
FfiConverterOptionTypeMembershipChange.write(change, into: &buf)
|
|
|
|
|
|
case let .profileChange(displayName,prevDisplayName,avatarUrl,prevAvatarUrl):
|
|
writeInt(&buf, Int32(8))
|
|
FfiConverterOptionString.write(displayName, into: &buf)
|
|
FfiConverterOptionString.write(prevDisplayName, into: &buf)
|
|
FfiConverterOptionString.write(avatarUrl, into: &buf)
|
|
FfiConverterOptionString.write(prevAvatarUrl, into: &buf)
|
|
|
|
|
|
case let .state(stateKey,content):
|
|
writeInt(&buf, Int32(9))
|
|
FfiConverterString.write(stateKey, into: &buf)
|
|
FfiConverterTypeOtherState.write(content, into: &buf)
|
|
|
|
|
|
case let .failedToParseMessageLike(eventType,error):
|
|
writeInt(&buf, Int32(10))
|
|
FfiConverterString.write(eventType, into: &buf)
|
|
FfiConverterString.write(error, into: &buf)
|
|
|
|
|
|
case let .failedToParseState(eventType,stateKey,error):
|
|
writeInt(&buf, Int32(11))
|
|
FfiConverterString.write(eventType, into: &buf)
|
|
FfiConverterString.write(stateKey, into: &buf)
|
|
FfiConverterString.write(error, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeTimelineItemContentKind_lift(_ buf: RustBuffer) throws -> TimelineItemContentKind {
|
|
return try FfiConverterTypeTimelineItemContentKind.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeTimelineItemContentKind_lower(_ value: TimelineItemContentKind) -> RustBuffer {
|
|
return FfiConverterTypeTimelineItemContentKind.lower(value)
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
|
|
public enum VerificationState {
|
|
|
|
case unknown
|
|
case verified
|
|
case unverified
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeVerificationState: FfiConverterRustBuffer {
|
|
typealias SwiftType = VerificationState
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VerificationState {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .unknown
|
|
|
|
case 2: return .verified
|
|
|
|
case 3: return .unverified
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: VerificationState, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case .unknown:
|
|
writeInt(&buf, Int32(1))
|
|
|
|
|
|
case .verified:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
|
|
case .unverified:
|
|
writeInt(&buf, Int32(3))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeVerificationState_lift(_ buf: RustBuffer) throws -> VerificationState {
|
|
return try FfiConverterTypeVerificationState.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeVerificationState_lower(_ value: VerificationState) -> RustBuffer {
|
|
return FfiConverterTypeVerificationState.lower(value)
|
|
}
|
|
|
|
|
|
extension VerificationState: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
/**
|
|
* A [`TimelineItem`](super::TimelineItem) that doesn't correspond to an event.
|
|
*/
|
|
|
|
public enum VirtualTimelineItem {
|
|
|
|
/**
|
|
* A divider between messages of two days.
|
|
*/
|
|
case dayDivider(
|
|
/**
|
|
* A timestamp in milliseconds since Unix Epoch on that day in local
|
|
* time.
|
|
*/ts: UInt64
|
|
)
|
|
/**
|
|
* The user's own read marker.
|
|
*/
|
|
case readMarker
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeVirtualTimelineItem: FfiConverterRustBuffer {
|
|
typealias SwiftType = VirtualTimelineItem
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VirtualTimelineItem {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .dayDivider(ts: try FfiConverterUInt64.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .readMarker
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: VirtualTimelineItem, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .dayDivider(ts):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterUInt64.write(ts, into: &buf)
|
|
|
|
|
|
case .readMarker:
|
|
writeInt(&buf, Int32(2))
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeVirtualTimelineItem_lift(_ buf: RustBuffer) throws -> VirtualTimelineItem {
|
|
return try FfiConverterTypeVirtualTimelineItem.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeVirtualTimelineItem_lower(_ value: VirtualTimelineItem) -> RustBuffer {
|
|
return FfiConverterTypeVirtualTimelineItem.lower(value)
|
|
}
|
|
|
|
|
|
extension VirtualTimelineItem: Equatable, Hashable {}
|
|
|
|
|
|
|
|
// Note that we don't yet support `indirect` for enums.
|
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
/**
|
|
* Different kinds of filters that could be applied to the timeline events.
|
|
*/
|
|
|
|
public enum WidgetEventFilter {
|
|
|
|
/**
|
|
* Matches message-like events with the given `type`.
|
|
*/
|
|
case messageLikeWithType(eventType: String
|
|
)
|
|
/**
|
|
* Matches `m.room.message` events with the given `msgtype`.
|
|
*/
|
|
case roomMessageWithMsgtype(msgtype: String
|
|
)
|
|
/**
|
|
* Matches state events with the given `type`, regardless of `state_key`.
|
|
*/
|
|
case stateWithType(eventType: String
|
|
)
|
|
/**
|
|
* Matches state events with the given `type` and `state_key`.
|
|
*/
|
|
case stateWithTypeAndStateKey(eventType: String, stateKey: String
|
|
)
|
|
}
|
|
|
|
|
|
public struct FfiConverterTypeWidgetEventFilter: FfiConverterRustBuffer {
|
|
typealias SwiftType = WidgetEventFilter
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WidgetEventFilter {
|
|
let variant: Int32 = try readInt(&buf)
|
|
switch variant {
|
|
|
|
case 1: return .messageLikeWithType(eventType: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 2: return .roomMessageWithMsgtype(msgtype: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 3: return .stateWithType(eventType: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
case 4: return .stateWithTypeAndStateKey(eventType: try FfiConverterString.read(from: &buf), stateKey: try FfiConverterString.read(from: &buf)
|
|
)
|
|
|
|
default: throw UniffiInternalError.unexpectedEnumCase
|
|
}
|
|
}
|
|
|
|
public static func write(_ value: WidgetEventFilter, into buf: inout [UInt8]) {
|
|
switch value {
|
|
|
|
|
|
case let .messageLikeWithType(eventType):
|
|
writeInt(&buf, Int32(1))
|
|
FfiConverterString.write(eventType, into: &buf)
|
|
|
|
|
|
case let .roomMessageWithMsgtype(msgtype):
|
|
writeInt(&buf, Int32(2))
|
|
FfiConverterString.write(msgtype, into: &buf)
|
|
|
|
|
|
case let .stateWithType(eventType):
|
|
writeInt(&buf, Int32(3))
|
|
FfiConverterString.write(eventType, into: &buf)
|
|
|
|
|
|
case let .stateWithTypeAndStateKey(eventType,stateKey):
|
|
writeInt(&buf, Int32(4))
|
|
FfiConverterString.write(eventType, into: &buf)
|
|
FfiConverterString.write(stateKey, into: &buf)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public func FfiConverterTypeWidgetEventFilter_lift(_ buf: RustBuffer) throws -> WidgetEventFilter {
|
|
return try FfiConverterTypeWidgetEventFilter.lift(buf)
|
|
}
|
|
|
|
public func FfiConverterTypeWidgetEventFilter_lower(_ value: WidgetEventFilter) -> RustBuffer {
|
|
return FfiConverterTypeWidgetEventFilter.lower(value)
|
|
}
|
|
|
|
|
|
extension WidgetEventFilter: Equatable, Hashable {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public protocol BackPaginationStatusListener : AnyObject {
|
|
|
|
func onUpdate(status: BackPaginationStatus)
|
|
|
|
}
|
|
|
|
// Magic number for the Rust proxy to call using the same mechanism as every other method,
|
|
// to free the callback once it's dropped by Rust.
|
|
private let IDX_CALLBACK_FREE: Int32 = 0
|
|
// Callback return codes
|
|
private let UNIFFI_CALLBACK_SUCCESS: Int32 = 0
|
|
private let UNIFFI_CALLBACK_ERROR: Int32 = 1
|
|
private let UNIFFI_CALLBACK_UNEXPECTED_ERROR: Int32 = 2
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceBackPaginationStatusListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceBackPaginationStatusListener = UniffiVTableCallbackInterfaceBackPaginationStatusListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
status: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: BackPaginationStatusListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceBackPaginationStatusListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
status: try FfiConverterTypeBackPaginationStatus_lift(status)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceBackPaginationStatusListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface BackPaginationStatusListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitBackPaginationStatusListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_backpaginationstatuslistener(&UniffiCallbackInterfaceBackPaginationStatusListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceBackPaginationStatusListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<BackPaginationStatusListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceBackPaginationStatusListener : FfiConverter {
|
|
typealias SwiftType = BackPaginationStatusListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol BackupStateListener : AnyObject {
|
|
|
|
func onUpdate(status: BackupState)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceBackupStateListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceBackupStateListener = UniffiVTableCallbackInterfaceBackupStateListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
status: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: BackupStateListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceBackupStateListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
status: try FfiConverterTypeBackupState.lift(status)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceBackupStateListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface BackupStateListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitBackupStateListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_backupstatelistener(&UniffiCallbackInterfaceBackupStateListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceBackupStateListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<BackupStateListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceBackupStateListener : FfiConverter {
|
|
typealias SwiftType = BackupStateListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol BackupSteadyStateListener : AnyObject {
|
|
|
|
func onUpdate(status: BackupUploadState)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceBackupSteadyStateListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceBackupSteadyStateListener = UniffiVTableCallbackInterfaceBackupSteadyStateListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
status: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: BackupSteadyStateListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceBackupSteadyStateListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
status: try FfiConverterTypeBackupUploadState.lift(status)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceBackupSteadyStateListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface BackupSteadyStateListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitBackupSteadyStateListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_backupsteadystatelistener(&UniffiCallbackInterfaceBackupSteadyStateListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceBackupSteadyStateListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<BackupSteadyStateListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceBackupSteadyStateListener : FfiConverter {
|
|
typealias SwiftType = BackupSteadyStateListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol ClientDelegate : AnyObject {
|
|
|
|
func didReceiveAuthError(isSoftLogout: Bool)
|
|
|
|
func didRefreshTokens()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceClientDelegate {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceClientDelegate = UniffiVTableCallbackInterfaceClientDelegate(
|
|
didReceiveAuthError: { (
|
|
uniffiHandle: UInt64,
|
|
isSoftLogout: Int8,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: ClientDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceClientDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.didReceiveAuthError(
|
|
isSoftLogout: try FfiConverterBool.lift(isSoftLogout)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
didRefreshTokens: { (
|
|
uniffiHandle: UInt64,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: ClientDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceClientDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.didRefreshTokens(
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceClientDelegate.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface ClientDelegate: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitClientDelegate() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_clientdelegate(&UniffiCallbackInterfaceClientDelegate.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceClientDelegate {
|
|
fileprivate static var handleMap = UniffiHandleMap<ClientDelegate>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceClientDelegate : FfiConverter {
|
|
typealias SwiftType = ClientDelegate
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol ClientSessionDelegate : AnyObject {
|
|
|
|
func retrieveSessionFromKeychain(userId: String) throws -> Session
|
|
|
|
func saveSessionInKeychain(session: Session)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceClientSessionDelegate {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceClientSessionDelegate = UniffiVTableCallbackInterfaceClientSessionDelegate(
|
|
retrieveSessionFromKeychain: { (
|
|
uniffiHandle: UInt64,
|
|
userId: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutablePointer<RustBuffer>,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: ClientSessionDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceClientSessionDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { try uniffiObj.retrieveSessionFromKeychain(
|
|
userId: try FfiConverterString.lift(userId)
|
|
) }
|
|
|
|
let writeReturn = { uniffiOutReturn.pointee = FfiConverterTypeSession.lower($0) }
|
|
uniffiTraitInterfaceCallWithError(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn,
|
|
lowerError: FfiConverterTypeClientError.lower
|
|
)
|
|
},
|
|
saveSessionInKeychain: { (
|
|
uniffiHandle: UInt64,
|
|
session: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: ClientSessionDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceClientSessionDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.saveSessionInKeychain(
|
|
session: try FfiConverterTypeSession.lift(session)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceClientSessionDelegate.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface ClientSessionDelegate: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitClientSessionDelegate() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_clientsessiondelegate(&UniffiCallbackInterfaceClientSessionDelegate.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceClientSessionDelegate {
|
|
fileprivate static var handleMap = UniffiHandleMap<ClientSessionDelegate>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceClientSessionDelegate : FfiConverter {
|
|
typealias SwiftType = ClientSessionDelegate
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol EnableRecoveryProgressListener : AnyObject {
|
|
|
|
func onUpdate(status: EnableRecoveryProgress)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceEnableRecoveryProgressListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceEnableRecoveryProgressListener = UniffiVTableCallbackInterfaceEnableRecoveryProgressListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
status: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: EnableRecoveryProgressListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceEnableRecoveryProgressListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
status: try FfiConverterTypeEnableRecoveryProgress.lift(status)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceEnableRecoveryProgressListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface EnableRecoveryProgressListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitEnableRecoveryProgressListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_enablerecoveryprogresslistener(&UniffiCallbackInterfaceEnableRecoveryProgressListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceEnableRecoveryProgressListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<EnableRecoveryProgressListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceEnableRecoveryProgressListener : FfiConverter {
|
|
typealias SwiftType = EnableRecoveryProgressListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol IgnoredUsersListener : AnyObject {
|
|
|
|
func call(ignoredUserIds: [String])
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceIgnoredUsersListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceIgnoredUsersListener = UniffiVTableCallbackInterfaceIgnoredUsersListener(
|
|
call: { (
|
|
uniffiHandle: UInt64,
|
|
ignoredUserIds: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: IgnoredUsersListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceIgnoredUsersListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.call(
|
|
ignoredUserIds: try FfiConverterSequenceString.lift(ignoredUserIds)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceIgnoredUsersListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface IgnoredUsersListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitIgnoredUsersListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_ignoreduserslistener(&UniffiCallbackInterfaceIgnoredUsersListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceIgnoredUsersListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<IgnoredUsersListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceIgnoredUsersListener : FfiConverter {
|
|
typealias SwiftType = IgnoredUsersListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Delegate to notify of changes in push rules
|
|
*/
|
|
public protocol NotificationSettingsDelegate : AnyObject {
|
|
|
|
func settingsDidChange()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceNotificationSettingsDelegate {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceNotificationSettingsDelegate = UniffiVTableCallbackInterfaceNotificationSettingsDelegate(
|
|
settingsDidChange: { (
|
|
uniffiHandle: UInt64,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: NotificationSettingsDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceNotificationSettingsDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.settingsDidChange(
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceNotificationSettingsDelegate.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface NotificationSettingsDelegate: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitNotificationSettingsDelegate() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_notificationsettingsdelegate(&UniffiCallbackInterfaceNotificationSettingsDelegate.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceNotificationSettingsDelegate {
|
|
fileprivate static var handleMap = UniffiHandleMap<NotificationSettingsDelegate>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceNotificationSettingsDelegate : FfiConverter {
|
|
typealias SwiftType = NotificationSettingsDelegate
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol ProgressWatcher : AnyObject {
|
|
|
|
func transmissionProgress(progress: TransmissionProgress)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceProgressWatcher {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceProgressWatcher = UniffiVTableCallbackInterfaceProgressWatcher(
|
|
transmissionProgress: { (
|
|
uniffiHandle: UInt64,
|
|
progress: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: ProgressWatcher
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceProgressWatcher.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.transmissionProgress(
|
|
progress: try FfiConverterTypeTransmissionProgress.lift(progress)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceProgressWatcher.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface ProgressWatcher: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitProgressWatcher() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_progresswatcher(&UniffiCallbackInterfaceProgressWatcher.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceProgressWatcher {
|
|
fileprivate static var handleMap = UniffiHandleMap<ProgressWatcher>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceProgressWatcher : FfiConverter {
|
|
typealias SwiftType = ProgressWatcher
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RecoveryStateListener : AnyObject {
|
|
|
|
func onUpdate(status: RecoveryState)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceRecoveryStateListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceRecoveryStateListener = UniffiVTableCallbackInterfaceRecoveryStateListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
status: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: RecoveryStateListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceRecoveryStateListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
status: try FfiConverterTypeRecoveryState.lift(status)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceRecoveryStateListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface RecoveryStateListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitRecoveryStateListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_recoverystatelistener(&UniffiCallbackInterfaceRecoveryStateListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceRecoveryStateListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<RecoveryStateListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceRecoveryStateListener : FfiConverter {
|
|
typealias SwiftType = RecoveryStateListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomDirectorySearchEntriesListener : AnyObject {
|
|
|
|
func onUpdate(roomEntriesUpdate: [RoomDirectorySearchEntryUpdate])
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceRoomDirectorySearchEntriesListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceRoomDirectorySearchEntriesListener = UniffiVTableCallbackInterfaceRoomDirectorySearchEntriesListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
roomEntriesUpdate: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: RoomDirectorySearchEntriesListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceRoomDirectorySearchEntriesListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
roomEntriesUpdate: try FfiConverterSequenceTypeRoomDirectorySearchEntryUpdate.lift(roomEntriesUpdate)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceRoomDirectorySearchEntriesListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface RoomDirectorySearchEntriesListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitRoomDirectorySearchEntriesListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_roomdirectorysearchentrieslistener(&UniffiCallbackInterfaceRoomDirectorySearchEntriesListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceRoomDirectorySearchEntriesListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<RoomDirectorySearchEntriesListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceRoomDirectorySearchEntriesListener : FfiConverter {
|
|
typealias SwiftType = RoomDirectorySearchEntriesListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomInfoListener : AnyObject {
|
|
|
|
func call(roomInfo: RoomInfo)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceRoomInfoListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceRoomInfoListener = UniffiVTableCallbackInterfaceRoomInfoListener(
|
|
call: { (
|
|
uniffiHandle: UInt64,
|
|
roomInfo: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: RoomInfoListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceRoomInfoListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.call(
|
|
roomInfo: try FfiConverterTypeRoomInfo.lift(roomInfo)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceRoomInfoListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface RoomInfoListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitRoomInfoListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_roominfolistener(&UniffiCallbackInterfaceRoomInfoListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceRoomInfoListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<RoomInfoListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceRoomInfoListener : FfiConverter {
|
|
typealias SwiftType = RoomInfoListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomListEntriesListener : AnyObject {
|
|
|
|
func onUpdate(roomEntriesUpdate: [RoomListEntriesUpdate])
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceRoomListEntriesListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceRoomListEntriesListener = UniffiVTableCallbackInterfaceRoomListEntriesListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
roomEntriesUpdate: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: RoomListEntriesListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceRoomListEntriesListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
roomEntriesUpdate: try FfiConverterSequenceTypeRoomListEntriesUpdate.lift(roomEntriesUpdate)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceRoomListEntriesListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface RoomListEntriesListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitRoomListEntriesListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_roomlistentrieslistener(&UniffiCallbackInterfaceRoomListEntriesListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceRoomListEntriesListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<RoomListEntriesListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceRoomListEntriesListener : FfiConverter {
|
|
typealias SwiftType = RoomListEntriesListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomListLoadingStateListener : AnyObject {
|
|
|
|
func onUpdate(state: RoomListLoadingState)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceRoomListLoadingStateListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceRoomListLoadingStateListener = UniffiVTableCallbackInterfaceRoomListLoadingStateListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
state: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: RoomListLoadingStateListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceRoomListLoadingStateListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
state: try FfiConverterTypeRoomListLoadingState.lift(state)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceRoomListLoadingStateListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface RoomListLoadingStateListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitRoomListLoadingStateListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_roomlistloadingstatelistener(&UniffiCallbackInterfaceRoomListLoadingStateListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceRoomListLoadingStateListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<RoomListLoadingStateListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceRoomListLoadingStateListener : FfiConverter {
|
|
typealias SwiftType = RoomListLoadingStateListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomListServiceStateListener : AnyObject {
|
|
|
|
func onUpdate(state: RoomListServiceState)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceRoomListServiceStateListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceRoomListServiceStateListener = UniffiVTableCallbackInterfaceRoomListServiceStateListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
state: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: RoomListServiceStateListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceRoomListServiceStateListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
state: try FfiConverterTypeRoomListServiceState.lift(state)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceRoomListServiceStateListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface RoomListServiceStateListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitRoomListServiceStateListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_roomlistservicestatelistener(&UniffiCallbackInterfaceRoomListServiceStateListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceRoomListServiceStateListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<RoomListServiceStateListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceRoomListServiceStateListener : FfiConverter {
|
|
typealias SwiftType = RoomListServiceStateListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol RoomListServiceSyncIndicatorListener : AnyObject {
|
|
|
|
func onUpdate(syncIndicator: RoomListServiceSyncIndicator)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceRoomListServiceSyncIndicatorListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceRoomListServiceSyncIndicatorListener = UniffiVTableCallbackInterfaceRoomListServiceSyncIndicatorListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
syncIndicator: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: RoomListServiceSyncIndicatorListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceRoomListServiceSyncIndicatorListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
syncIndicator: try FfiConverterTypeRoomListServiceSyncIndicator.lift(syncIndicator)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceRoomListServiceSyncIndicatorListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface RoomListServiceSyncIndicatorListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitRoomListServiceSyncIndicatorListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_roomlistservicesyncindicatorlistener(&UniffiCallbackInterfaceRoomListServiceSyncIndicatorListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceRoomListServiceSyncIndicatorListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<RoomListServiceSyncIndicatorListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceRoomListServiceSyncIndicatorListener : FfiConverter {
|
|
typealias SwiftType = RoomListServiceSyncIndicatorListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol SessionVerificationControllerDelegate : AnyObject {
|
|
|
|
func didAcceptVerificationRequest()
|
|
|
|
func didStartSasVerification()
|
|
|
|
func didReceiveVerificationData(data: SessionVerificationData)
|
|
|
|
func didFail()
|
|
|
|
func didCancel()
|
|
|
|
func didFinish()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceSessionVerificationControllerDelegate {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceSessionVerificationControllerDelegate = UniffiVTableCallbackInterfaceSessionVerificationControllerDelegate(
|
|
didAcceptVerificationRequest: { (
|
|
uniffiHandle: UInt64,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: SessionVerificationControllerDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceSessionVerificationControllerDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.didAcceptVerificationRequest(
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
didStartSasVerification: { (
|
|
uniffiHandle: UInt64,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: SessionVerificationControllerDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceSessionVerificationControllerDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.didStartSasVerification(
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
didReceiveVerificationData: { (
|
|
uniffiHandle: UInt64,
|
|
data: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: SessionVerificationControllerDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceSessionVerificationControllerDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.didReceiveVerificationData(
|
|
data: try FfiConverterTypeSessionVerificationData.lift(data)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
didFail: { (
|
|
uniffiHandle: UInt64,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: SessionVerificationControllerDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceSessionVerificationControllerDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.didFail(
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
didCancel: { (
|
|
uniffiHandle: UInt64,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: SessionVerificationControllerDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceSessionVerificationControllerDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.didCancel(
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
didFinish: { (
|
|
uniffiHandle: UInt64,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: SessionVerificationControllerDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceSessionVerificationControllerDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.didFinish(
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceSessionVerificationControllerDelegate.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface SessionVerificationControllerDelegate: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitSessionVerificationControllerDelegate() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_sessionverificationcontrollerdelegate(&UniffiCallbackInterfaceSessionVerificationControllerDelegate.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceSessionVerificationControllerDelegate {
|
|
fileprivate static var handleMap = UniffiHandleMap<SessionVerificationControllerDelegate>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceSessionVerificationControllerDelegate : FfiConverter {
|
|
typealias SwiftType = SessionVerificationControllerDelegate
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol SyncServiceStateObserver : AnyObject {
|
|
|
|
func onUpdate(state: SyncServiceState)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceSyncServiceStateObserver {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceSyncServiceStateObserver = UniffiVTableCallbackInterfaceSyncServiceStateObserver(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
state: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: SyncServiceStateObserver
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceSyncServiceStateObserver.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
state: try FfiConverterTypeSyncServiceState.lift(state)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceSyncServiceStateObserver.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface SyncServiceStateObserver: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitSyncServiceStateObserver() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_syncservicestateobserver(&UniffiCallbackInterfaceSyncServiceStateObserver.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceSyncServiceStateObserver {
|
|
fileprivate static var handleMap = UniffiHandleMap<SyncServiceStateObserver>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceSyncServiceStateObserver : FfiConverter {
|
|
typealias SwiftType = SyncServiceStateObserver
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol TimelineListener : AnyObject {
|
|
|
|
func onUpdate(diff: [TimelineDiff])
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceTimelineListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceTimelineListener = UniffiVTableCallbackInterfaceTimelineListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
diff: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: TimelineListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceTimelineListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
diff: try FfiConverterSequenceTypeTimelineDiff.lift(diff)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceTimelineListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface TimelineListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitTimelineListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_timelinelistener(&UniffiCallbackInterfaceTimelineListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceTimelineListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<TimelineListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceTimelineListener : FfiConverter {
|
|
typealias SwiftType = TimelineListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol TypingNotificationsListener : AnyObject {
|
|
|
|
func call(typingUserIds: [String])
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceTypingNotificationsListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceTypingNotificationsListener = UniffiVTableCallbackInterfaceTypingNotificationsListener(
|
|
call: { (
|
|
uniffiHandle: UInt64,
|
|
typingUserIds: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: TypingNotificationsListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceTypingNotificationsListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.call(
|
|
typingUserIds: try FfiConverterSequenceString.lift(typingUserIds)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceTypingNotificationsListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface TypingNotificationsListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitTypingNotificationsListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_typingnotificationslistener(&UniffiCallbackInterfaceTypingNotificationsListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceTypingNotificationsListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<TypingNotificationsListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceTypingNotificationsListener : FfiConverter {
|
|
typealias SwiftType = TypingNotificationsListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol UnableToDecryptDelegate : AnyObject {
|
|
|
|
func onUtd(info: UnableToDecryptInfo)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceUnableToDecryptDelegate {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceUnableToDecryptDelegate = UniffiVTableCallbackInterfaceUnableToDecryptDelegate(
|
|
onUtd: { (
|
|
uniffiHandle: UInt64,
|
|
info: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: UnableToDecryptDelegate
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceUnableToDecryptDelegate.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUtd(
|
|
info: try FfiConverterTypeUnableToDecryptInfo.lift(info)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceUnableToDecryptDelegate.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface UnableToDecryptDelegate: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitUnableToDecryptDelegate() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_unabletodecryptdelegate(&UniffiCallbackInterfaceUnableToDecryptDelegate.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceUnableToDecryptDelegate {
|
|
fileprivate static var handleMap = UniffiHandleMap<UnableToDecryptDelegate>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceUnableToDecryptDelegate : FfiConverter {
|
|
typealias SwiftType = UnableToDecryptDelegate
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol VerificationStateListener : AnyObject {
|
|
|
|
func onUpdate(status: VerificationState)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceVerificationStateListener {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceVerificationStateListener = UniffiVTableCallbackInterfaceVerificationStateListener(
|
|
onUpdate: { (
|
|
uniffiHandle: UInt64,
|
|
status: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutableRawPointer,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: VerificationStateListener
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceVerificationStateListener.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.onUpdate(
|
|
status: try FfiConverterTypeVerificationState.lift(status)
|
|
) }
|
|
|
|
let writeReturn = { () }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceVerificationStateListener.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface VerificationStateListener: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitVerificationStateListener() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_verificationstatelistener(&UniffiCallbackInterfaceVerificationStateListener.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceVerificationStateListener {
|
|
fileprivate static var handleMap = UniffiHandleMap<VerificationStateListener>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceVerificationStateListener : FfiConverter {
|
|
typealias SwiftType = VerificationStateListener
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public protocol WidgetCapabilitiesProvider : AnyObject {
|
|
|
|
func acquireCapabilities(capabilities: WidgetCapabilities) -> WidgetCapabilities
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the implementation in a struct so we don't pollute the top-level namespace
|
|
fileprivate struct UniffiCallbackInterfaceWidgetCapabilitiesProvider {
|
|
|
|
// Create the VTable using a series of closures.
|
|
// Swift automatically converts these into C callback functions.
|
|
static var vtable: UniffiVTableCallbackInterfaceWidgetCapabilitiesProvider = UniffiVTableCallbackInterfaceWidgetCapabilitiesProvider(
|
|
acquireCapabilities: { (
|
|
uniffiHandle: UInt64,
|
|
capabilities: RustBuffer,
|
|
uniffiOutReturn: UnsafeMutablePointer<RustBuffer>,
|
|
uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
|
|
) in
|
|
let uniffiObj: WidgetCapabilitiesProvider
|
|
do {
|
|
try uniffiObj = FfiConverterCallbackInterfaceWidgetCapabilitiesProvider.handleMap.get(handle: uniffiHandle)
|
|
} catch {
|
|
uniffiCallStatus.pointee.code = CALL_UNEXPECTED_ERROR
|
|
uniffiCallStatus.pointee.errorBuf = FfiConverterString.lower("Callback handle map error: \(error)")
|
|
return
|
|
}
|
|
let makeCall = { uniffiObj.acquireCapabilities(
|
|
capabilities: try FfiConverterTypeWidgetCapabilities.lift(capabilities)
|
|
) }
|
|
|
|
let writeReturn = { uniffiOutReturn.pointee = FfiConverterTypeWidgetCapabilities.lower($0) }
|
|
uniffiTraitInterfaceCall(
|
|
callStatus: uniffiCallStatus,
|
|
makeCall: makeCall,
|
|
writeReturn: writeReturn
|
|
)
|
|
},
|
|
uniffiFree: { (uniffiHandle: UInt64) -> () in
|
|
let result = try? FfiConverterCallbackInterfaceWidgetCapabilitiesProvider.handleMap.remove(handle: uniffiHandle)
|
|
if result == nil {
|
|
print("Uniffi callback interface WidgetCapabilitiesProvider: handle missing in uniffiFree")
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
private func uniffiCallbackInitWidgetCapabilitiesProvider() {
|
|
uniffi_matrix_sdk_ffi_fn_init_callback_vtable_widgetcapabilitiesprovider(&UniffiCallbackInterfaceWidgetCapabilitiesProvider.vtable)
|
|
}
|
|
|
|
// FfiConverter protocol for callback interfaces
|
|
fileprivate struct FfiConverterCallbackInterfaceWidgetCapabilitiesProvider {
|
|
fileprivate static var handleMap = UniffiHandleMap<WidgetCapabilitiesProvider>()
|
|
}
|
|
|
|
extension FfiConverterCallbackInterfaceWidgetCapabilitiesProvider : FfiConverter {
|
|
typealias SwiftType = WidgetCapabilitiesProvider
|
|
typealias FfiType = UInt64
|
|
|
|
public static func lift(_ handle: UInt64) throws -> SwiftType {
|
|
try handleMap.get(handle: handle)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
let handle: UInt64 = try readInt(&buf)
|
|
return try lift(handle)
|
|
}
|
|
|
|
public static func lower(_ v: SwiftType) -> UInt64 {
|
|
return handleMap.insert(obj: v)
|
|
}
|
|
|
|
public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
|
|
writeInt(&buf, lower(v))
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionUInt8: FfiConverterRustBuffer {
|
|
typealias SwiftType = UInt8?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterUInt8.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterUInt8.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionUInt32: FfiConverterRustBuffer {
|
|
typealias SwiftType = UInt32?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterUInt32.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterUInt32.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionInt32: FfiConverterRustBuffer {
|
|
typealias SwiftType = Int32?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterInt32.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterInt32.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionUInt64: FfiConverterRustBuffer {
|
|
typealias SwiftType = UInt64?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterUInt64.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterUInt64.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionDouble: FfiConverterRustBuffer {
|
|
typealias SwiftType = Double?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterDouble.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterDouble.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionBool: FfiConverterRustBuffer {
|
|
typealias SwiftType = Bool?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterBool.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterBool.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer {
|
|
typealias SwiftType = String?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterString.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterString.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionDuration: FfiConverterRustBuffer {
|
|
typealias SwiftType = TimeInterval?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterDuration.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterDuration.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeEventTimelineItem: FfiConverterRustBuffer {
|
|
typealias SwiftType = EventTimelineItem?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeEventTimelineItem.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeEventTimelineItem.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeHomeserverLoginDetails: FfiConverterRustBuffer {
|
|
typealias SwiftType = HomeserverLoginDetails?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeHomeserverLoginDetails.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeHomeserverLoginDetails.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeMediaSource: FfiConverterRustBuffer {
|
|
typealias SwiftType = MediaSource?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeMediaSource.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeMediaSource.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeMessage: FfiConverterRustBuffer {
|
|
typealias SwiftType = Message?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeMessage.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeMessage.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeRoom: FfiConverterRustBuffer {
|
|
typealias SwiftType = Room?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeRoom.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeRoom.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeTaskHandle: FfiConverterRustBuffer {
|
|
typealias SwiftType = TaskHandle?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeTaskHandle.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeTaskHandle.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeTimelineEventTypeFilter: FfiConverterRustBuffer {
|
|
typealias SwiftType = TimelineEventTypeFilter?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeTimelineEventTypeFilter.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeTimelineEventTypeFilter.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeTimelineItem: FfiConverterRustBuffer {
|
|
typealias SwiftType = TimelineItem?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeTimelineItem.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeTimelineItem.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeAudioInfo: FfiConverterRustBuffer {
|
|
typealias SwiftType = AudioInfo?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeAudioInfo.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeAudioInfo.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeFileInfo: FfiConverterRustBuffer {
|
|
typealias SwiftType = FileInfo?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeFileInfo.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeFileInfo.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeFormattedBody: FfiConverterRustBuffer {
|
|
typealias SwiftType = FormattedBody?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeFormattedBody.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeFormattedBody.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeImageInfo: FfiConverterRustBuffer {
|
|
typealias SwiftType = ImageInfo?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeImageInfo.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeImageInfo.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeInReplyToDetails: FfiConverterRustBuffer {
|
|
typealias SwiftType = InReplyToDetails?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeInReplyToDetails.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeInReplyToDetails.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeInsertData: FfiConverterRustBuffer {
|
|
typealias SwiftType = InsertData?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeInsertData.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeInsertData.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeMatrixEntity: FfiConverterRustBuffer {
|
|
typealias SwiftType = MatrixEntity?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeMatrixEntity.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeMatrixEntity.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeNotificationItem: FfiConverterRustBuffer {
|
|
typealias SwiftType = NotificationItem?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeNotificationItem.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeNotificationItem.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeNotificationPowerLevels: FfiConverterRustBuffer {
|
|
typealias SwiftType = NotificationPowerLevels?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeNotificationPowerLevels.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeNotificationPowerLevels.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeOidcConfiguration: FfiConverterRustBuffer {
|
|
typealias SwiftType = OidcConfiguration?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeOidcConfiguration.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeOidcConfiguration.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypePowerLevels: FfiConverterRustBuffer {
|
|
typealias SwiftType = PowerLevels?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypePowerLevels.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypePowerLevels.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeRoomMember: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomMember?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeRoomMember.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeRoomMember.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeRoomSubscription: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomSubscription?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeRoomSubscription.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeRoomSubscription.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeSetData: FfiConverterRustBuffer {
|
|
typealias SwiftType = SetData?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeSetData.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeSetData.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeThumbnailInfo: FfiConverterRustBuffer {
|
|
typealias SwiftType = ThumbnailInfo?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeThumbnailInfo.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeThumbnailInfo.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeTracingFileConfiguration: FfiConverterRustBuffer {
|
|
typealias SwiftType = TracingFileConfiguration?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeTracingFileConfiguration.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeTracingFileConfiguration.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeUnstableAudioDetailsContent: FfiConverterRustBuffer {
|
|
typealias SwiftType = UnstableAudioDetailsContent?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeUnstableAudioDetailsContent.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeUnstableAudioDetailsContent.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeUnstableVoiceContent: FfiConverterRustBuffer {
|
|
typealias SwiftType = UnstableVoiceContent?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeUnstableVoiceContent.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeUnstableVoiceContent.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeVideoInfo: FfiConverterRustBuffer {
|
|
typealias SwiftType = VideoInfo?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeVideoInfo.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeVideoInfo.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeAccountManagementAction: FfiConverterRustBuffer {
|
|
typealias SwiftType = AccountManagementAction?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeAccountManagementAction.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeAccountManagementAction.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeAssetType: FfiConverterRustBuffer {
|
|
typealias SwiftType = AssetType?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeAssetType.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeAssetType.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeEventSendState: FfiConverterRustBuffer {
|
|
typealias SwiftType = EventSendState?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeEventSendState.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeEventSendState.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeMembershipChange: FfiConverterRustBuffer {
|
|
typealias SwiftType = MembershipChange?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeMembershipChange.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeMembershipChange.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypePublicRoomJoinRule: FfiConverterRustBuffer {
|
|
typealias SwiftType = PublicRoomJoinRule?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypePublicRoomJoinRule.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypePublicRoomJoinRule.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypePushFormat: FfiConverterRustBuffer {
|
|
typealias SwiftType = PushFormat?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypePushFormat.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypePushFormat.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeRoomNotificationMode: FfiConverterRustBuffer {
|
|
typealias SwiftType = RoomNotificationMode?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeRoomNotificationMode.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeRoomNotificationMode.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeVirtualTimelineItem: FfiConverterRustBuffer {
|
|
typealias SwiftType = VirtualTimelineItem?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeVirtualTimelineItem.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeVirtualTimelineItem.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionCallbackInterfaceBackupSteadyStateListener: FfiConverterRustBuffer {
|
|
typealias SwiftType = BackupSteadyStateListener?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterCallbackInterfaceBackupSteadyStateListener.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterCallbackInterfaceBackupSteadyStateListener.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionCallbackInterfaceClientDelegate: FfiConverterRustBuffer {
|
|
typealias SwiftType = ClientDelegate?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterCallbackInterfaceClientDelegate.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterCallbackInterfaceClientDelegate.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionCallbackInterfaceClientSessionDelegate: FfiConverterRustBuffer {
|
|
typealias SwiftType = ClientSessionDelegate?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterCallbackInterfaceClientSessionDelegate.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterCallbackInterfaceClientSessionDelegate.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionCallbackInterfaceNotificationSettingsDelegate: FfiConverterRustBuffer {
|
|
typealias SwiftType = NotificationSettingsDelegate?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterCallbackInterfaceNotificationSettingsDelegate.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterCallbackInterfaceNotificationSettingsDelegate.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionCallbackInterfaceProgressWatcher: FfiConverterRustBuffer {
|
|
typealias SwiftType = ProgressWatcher?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterCallbackInterfaceProgressWatcher.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterCallbackInterfaceProgressWatcher.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionCallbackInterfaceSessionVerificationControllerDelegate: FfiConverterRustBuffer {
|
|
typealias SwiftType = SessionVerificationControllerDelegate?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterCallbackInterfaceSessionVerificationControllerDelegate.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterCallbackInterfaceSessionVerificationControllerDelegate.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionSequenceString: FfiConverterRustBuffer {
|
|
typealias SwiftType = [String]?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterSequenceString.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterSequenceString.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionSequenceTypeTimelineItem: FfiConverterRustBuffer {
|
|
typealias SwiftType = [TimelineItem]?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterSequenceTypeTimelineItem.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterSequenceTypeTimelineItem.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionSequenceTypeRequiredState: FfiConverterRustBuffer {
|
|
typealias SwiftType = [RequiredState]?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterSequenceTypeRequiredState.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterSequenceTypeRequiredState.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionSequenceTypeRoomMember: FfiConverterRustBuffer {
|
|
typealias SwiftType = [RoomMember]?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterSequenceTypeRoomMember.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterSequenceTypeRoomMember.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionDictionaryStringInt64: FfiConverterRustBuffer {
|
|
typealias SwiftType = [String: Int64]?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterDictionaryStringInt64.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterDictionaryStringInt64.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterOptionTypeEventItemOrigin: FfiConverterRustBuffer {
|
|
typealias SwiftType = EventItemOrigin?
|
|
|
|
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
|
|
guard let value = value else {
|
|
writeInt(&buf, Int8(0))
|
|
return
|
|
}
|
|
writeInt(&buf, Int8(1))
|
|
FfiConverterTypeEventItemOrigin.write(value, into: &buf)
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
|
|
switch try readInt(&buf) as Int8 {
|
|
case 0: return nil
|
|
case 1: return try FfiConverterTypeEventItemOrigin.read(from: &buf)
|
|
default: throw UniffiInternalError.unexpectedOptionalTag
|
|
}
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceUInt16: FfiConverterRustBuffer {
|
|
typealias SwiftType = [UInt16]
|
|
|
|
public static func write(_ value: [UInt16], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterUInt16.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [UInt16] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [UInt16]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterUInt16.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceString: FfiConverterRustBuffer {
|
|
typealias SwiftType = [String]
|
|
|
|
public static func write(_ value: [String], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterString.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [String]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterString.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceData: FfiConverterRustBuffer {
|
|
typealias SwiftType = [Data]
|
|
|
|
public static func write(_ value: [Data], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterData.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [Data] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [Data]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterData.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeRoom: FfiConverterRustBuffer {
|
|
typealias SwiftType = [Room]
|
|
|
|
public static func write(_ value: [Room], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeRoom.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [Room] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [Room]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeRoom.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeSessionVerificationEmoji: FfiConverterRustBuffer {
|
|
typealias SwiftType = [SessionVerificationEmoji]
|
|
|
|
public static func write(_ value: [SessionVerificationEmoji], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeSessionVerificationEmoji.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [SessionVerificationEmoji] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [SessionVerificationEmoji]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeSessionVerificationEmoji.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeTimelineDiff: FfiConverterRustBuffer {
|
|
typealias SwiftType = [TimelineDiff]
|
|
|
|
public static func write(_ value: [TimelineDiff], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeTimelineDiff.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [TimelineDiff] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [TimelineDiff]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeTimelineDiff.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeTimelineItem: FfiConverterRustBuffer {
|
|
typealias SwiftType = [TimelineItem]
|
|
|
|
public static func write(_ value: [TimelineItem], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeTimelineItem.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [TimelineItem] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [TimelineItem]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeTimelineItem.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypePollAnswer: FfiConverterRustBuffer {
|
|
typealias SwiftType = [PollAnswer]
|
|
|
|
public static func write(_ value: [PollAnswer], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypePollAnswer.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [PollAnswer] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [PollAnswer]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypePollAnswer.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeReaction: FfiConverterRustBuffer {
|
|
typealias SwiftType = [Reaction]
|
|
|
|
public static func write(_ value: [Reaction], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeReaction.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [Reaction] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [Reaction]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeReaction.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeReactionSenderData: FfiConverterRustBuffer {
|
|
typealias SwiftType = [ReactionSenderData]
|
|
|
|
public static func write(_ value: [ReactionSenderData], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeReactionSenderData.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [ReactionSenderData] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [ReactionSenderData]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeReactionSenderData.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeRequiredState: FfiConverterRustBuffer {
|
|
typealias SwiftType = [RequiredState]
|
|
|
|
public static func write(_ value: [RequiredState], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeRequiredState.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RequiredState] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [RequiredState]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeRequiredState.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeRoomDescription: FfiConverterRustBuffer {
|
|
typealias SwiftType = [RoomDescription]
|
|
|
|
public static func write(_ value: [RoomDescription], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeRoomDescription.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RoomDescription] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [RoomDescription]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeRoomDescription.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeRoomListRange: FfiConverterRustBuffer {
|
|
typealias SwiftType = [RoomListRange]
|
|
|
|
public static func write(_ value: [RoomListRange], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeRoomListRange.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RoomListRange] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [RoomListRange]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeRoomListRange.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeRoomMember: FfiConverterRustBuffer {
|
|
typealias SwiftType = [RoomMember]
|
|
|
|
public static func write(_ value: [RoomMember], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeRoomMember.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RoomMember] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [RoomMember]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeRoomMember.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeUserPowerLevelUpdate: FfiConverterRustBuffer {
|
|
typealias SwiftType = [UserPowerLevelUpdate]
|
|
|
|
public static func write(_ value: [UserPowerLevelUpdate], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeUserPowerLevelUpdate.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [UserPowerLevelUpdate] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [UserPowerLevelUpdate]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeUserPowerLevelUpdate.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeUserProfile: FfiConverterRustBuffer {
|
|
typealias SwiftType = [UserProfile]
|
|
|
|
public static func write(_ value: [UserProfile], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeUserProfile.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [UserProfile] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [UserProfile]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeUserProfile.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeFilterTimelineEventType: FfiConverterRustBuffer {
|
|
typealias SwiftType = [FilterTimelineEventType]
|
|
|
|
public static func write(_ value: [FilterTimelineEventType], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeFilterTimelineEventType.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [FilterTimelineEventType] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [FilterTimelineEventType]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeFilterTimelineEventType.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeRoomDirectorySearchEntryUpdate: FfiConverterRustBuffer {
|
|
typealias SwiftType = [RoomDirectorySearchEntryUpdate]
|
|
|
|
public static func write(_ value: [RoomDirectorySearchEntryUpdate], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeRoomDirectorySearchEntryUpdate.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RoomDirectorySearchEntryUpdate] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [RoomDirectorySearchEntryUpdate]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeRoomDirectorySearchEntryUpdate.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeRoomListEntriesDynamicFilterKind: FfiConverterRustBuffer {
|
|
typealias SwiftType = [RoomListEntriesDynamicFilterKind]
|
|
|
|
public static func write(_ value: [RoomListEntriesDynamicFilterKind], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeRoomListEntriesDynamicFilterKind.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RoomListEntriesDynamicFilterKind] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [RoomListEntriesDynamicFilterKind]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeRoomListEntriesDynamicFilterKind.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeRoomListEntriesUpdate: FfiConverterRustBuffer {
|
|
typealias SwiftType = [RoomListEntriesUpdate]
|
|
|
|
public static func write(_ value: [RoomListEntriesUpdate], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeRoomListEntriesUpdate.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RoomListEntriesUpdate] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [RoomListEntriesUpdate]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeRoomListEntriesUpdate.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeRoomListEntry: FfiConverterRustBuffer {
|
|
typealias SwiftType = [RoomListEntry]
|
|
|
|
public static func write(_ value: [RoomListEntry], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeRoomListEntry.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RoomListEntry] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [RoomListEntry]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeRoomListEntry.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterSequenceTypeWidgetEventFilter: FfiConverterRustBuffer {
|
|
typealias SwiftType = [WidgetEventFilter]
|
|
|
|
public static func write(_ value: [WidgetEventFilter], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for item in value {
|
|
FfiConverterTypeWidgetEventFilter.write(item, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [WidgetEventFilter] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var seq = [WidgetEventFilter]()
|
|
seq.reserveCapacity(Int(len))
|
|
for _ in 0 ..< len {
|
|
seq.append(try FfiConverterTypeWidgetEventFilter.read(from: &buf))
|
|
}
|
|
return seq
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterDictionaryStringInt32: FfiConverterRustBuffer {
|
|
public static func write(_ value: [String: Int32], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for (key, value) in value {
|
|
FfiConverterString.write(key, into: &buf)
|
|
FfiConverterInt32.write(value, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: Int32] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var dict = [String: Int32]()
|
|
dict.reserveCapacity(Int(len))
|
|
for _ in 0..<len {
|
|
let key = try FfiConverterString.read(from: &buf)
|
|
let value = try FfiConverterInt32.read(from: &buf)
|
|
dict[key] = value
|
|
}
|
|
return dict
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterDictionaryStringInt64: FfiConverterRustBuffer {
|
|
public static func write(_ value: [String: Int64], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for (key, value) in value {
|
|
FfiConverterString.write(key, into: &buf)
|
|
FfiConverterInt64.write(value, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: Int64] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var dict = [String: Int64]()
|
|
dict.reserveCapacity(Int(len))
|
|
for _ in 0..<len {
|
|
let key = try FfiConverterString.read(from: &buf)
|
|
let value = try FfiConverterInt64.read(from: &buf)
|
|
dict[key] = value
|
|
}
|
|
return dict
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterDictionaryStringString: FfiConverterRustBuffer {
|
|
public static func write(_ value: [String: String], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for (key, value) in value {
|
|
FfiConverterString.write(key, into: &buf)
|
|
FfiConverterString.write(value, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: String] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var dict = [String: String]()
|
|
dict.reserveCapacity(Int(len))
|
|
for _ in 0..<len {
|
|
let key = try FfiConverterString.read(from: &buf)
|
|
let value = try FfiConverterString.read(from: &buf)
|
|
dict[key] = value
|
|
}
|
|
return dict
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterDictionaryStringTypeReceipt: FfiConverterRustBuffer {
|
|
public static func write(_ value: [String: Receipt], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for (key, value) in value {
|
|
FfiConverterString.write(key, into: &buf)
|
|
FfiConverterTypeReceipt.write(value, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: Receipt] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var dict = [String: Receipt]()
|
|
dict.reserveCapacity(Int(len))
|
|
for _ in 0..<len {
|
|
let key = try FfiConverterString.read(from: &buf)
|
|
let value = try FfiConverterTypeReceipt.read(from: &buf)
|
|
dict[key] = value
|
|
}
|
|
return dict
|
|
}
|
|
}
|
|
|
|
fileprivate struct FfiConverterDictionaryStringSequenceString: FfiConverterRustBuffer {
|
|
public static func write(_ value: [String: [String]], into buf: inout [UInt8]) {
|
|
let len = Int32(value.count)
|
|
writeInt(&buf, len)
|
|
for (key, value) in value {
|
|
FfiConverterString.write(key, into: &buf)
|
|
FfiConverterSequenceString.write(value, into: &buf)
|
|
}
|
|
}
|
|
|
|
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: [String]] {
|
|
let len: Int32 = try readInt(&buf)
|
|
var dict = [String: [String]]()
|
|
dict.reserveCapacity(Int(len))
|
|
for _ in 0..<len {
|
|
let key = try FfiConverterString.read(from: &buf)
|
|
let value = try FfiConverterSequenceString.read(from: &buf)
|
|
dict[key] = value
|
|
}
|
|
return dict
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private let UNIFFI_RUST_FUTURE_POLL_READY: Int8 = 0
|
|
private let UNIFFI_RUST_FUTURE_POLL_MAYBE_READY: Int8 = 1
|
|
|
|
fileprivate let uniffiContinuationHandleMap = UniffiHandleMap<UnsafeContinuation<Int8, Never>>()
|
|
|
|
fileprivate func uniffiRustCallAsync<F, T>(
|
|
rustFutureFunc: () -> UInt64,
|
|
pollFunc: (UInt64, @escaping UniffiRustFutureContinuationCallback, UInt64) -> (),
|
|
completeFunc: (UInt64, UnsafeMutablePointer<RustCallStatus>) -> F,
|
|
freeFunc: (UInt64) -> (),
|
|
liftFunc: (F) throws -> T,
|
|
errorHandler: ((RustBuffer) throws -> Error)?
|
|
) async throws -> T {
|
|
// Make sure to call uniffiEnsureInitialized() since future creation doesn't have a
|
|
// RustCallStatus param, so doesn't use makeRustCall()
|
|
uniffiEnsureInitialized()
|
|
let rustFuture = rustFutureFunc()
|
|
defer {
|
|
freeFunc(rustFuture)
|
|
}
|
|
var pollResult: Int8;
|
|
repeat {
|
|
pollResult = await withUnsafeContinuation {
|
|
pollFunc(
|
|
rustFuture,
|
|
uniffiFutureContinuationCallback,
|
|
uniffiContinuationHandleMap.insert(obj: $0)
|
|
)
|
|
}
|
|
} while pollResult != UNIFFI_RUST_FUTURE_POLL_READY
|
|
|
|
return try liftFunc(makeRustCall(
|
|
{ completeFunc(rustFuture, $0) },
|
|
errorHandler: errorHandler
|
|
))
|
|
}
|
|
|
|
// Callback handlers for an async calls. These are invoked by Rust when the future is ready. They
|
|
// lift the return value or error and resume the suspended function.
|
|
fileprivate func uniffiFutureContinuationCallback(handle: UInt64, pollResult: Int8) {
|
|
if let continuation = try? uniffiContinuationHandleMap.remove(handle: handle) {
|
|
continuation.resume(returning: pollResult)
|
|
} else {
|
|
print("uniffiFutureContinuationCallback invalid handle")
|
|
}
|
|
}
|
|
public func genTransactionId() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_gen_transaction_id($0)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Create the actual url that can be used to setup the WebView or IFrame
|
|
* that contains the widget.
|
|
*
|
|
* # Arguments
|
|
* * `widget_settings` - The widget settings to generate the url for.
|
|
* * `room` - A matrix room which is used to query the logged in username
|
|
* * `props` - Properties from the client that can be used by a widget to adapt
|
|
* to the client. e.g. language, font-scale...
|
|
*/
|
|
public func generateWebviewUrl(widgetSettings: WidgetSettings, room: Room, props: ClientProperties) async throws -> String {
|
|
return try await uniffiRustCallAsync(
|
|
rustFutureFunc: {
|
|
uniffi_matrix_sdk_ffi_fn_func_generate_webview_url(
|
|
FfiConverterTypeWidgetSettings.lower(widgetSettings),
|
|
FfiConverterTypeRoom.lower(room),
|
|
FfiConverterTypeClientProperties.lower(props)
|
|
)
|
|
},
|
|
pollFunc: ffi_matrix_sdk_ffi_rust_future_poll_rust_buffer,
|
|
completeFunc: ffi_matrix_sdk_ffi_rust_future_complete_rust_buffer,
|
|
freeFunc: ffi_matrix_sdk_ffi_rust_future_free_rust_buffer,
|
|
liftFunc: FfiConverterString.lift,
|
|
errorHandler: FfiConverterTypeParseError.lift
|
|
)
|
|
}
|
|
|
|
|
|
/**
|
|
* The Capabilities required to run a element call widget.
|
|
*
|
|
* This is intended to be used in combination with: `acquire_capabilities` of
|
|
* the `CapabilitiesProvider`.
|
|
*
|
|
* `acquire_capabilities` can simply return the `WidgetCapabilities` from this
|
|
* function. Even if there are non intersecting permissions to what the widget
|
|
* requested.
|
|
*
|
|
* Editing and extending the capabilities from this function is also possible,
|
|
* but should only be done as temporal workarounds until this function is
|
|
* adjusted
|
|
*/
|
|
public func getElementCallRequiredPermissions() -> WidgetCapabilities {
|
|
return try! FfiConverterTypeWidgetCapabilities.lift(
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_get_element_call_required_permissions($0)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Log an event.
|
|
*
|
|
* The target should be something like a module path, and can be referenced in
|
|
* the filter string given to `setup_tracing`. `level` and `target` for a
|
|
* callsite are fixed at the first `log_event` call for that callsite and can
|
|
* not be changed afterwards, i.e. the level and target passed for second and
|
|
* following `log_event`s with the same callsite will be ignored.
|
|
*
|
|
* This function leaks a little bit of memory for each unique (file + line +
|
|
* level + target) it is called with. Please make sure that the number of
|
|
* different combinations of those parameters this can be called with is
|
|
* constant in the final executable.
|
|
*/
|
|
public func logEvent(file: String, line: UInt32?, level: LogLevel, target: String, message: String) {
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_log_event(
|
|
FfiConverterString.lower(file),
|
|
FfiConverterOptionUInt32.lower(line),
|
|
FfiConverterTypeLogLevel.lower(level),
|
|
FfiConverterString.lower(target),
|
|
FfiConverterString.lower(message),$0)
|
|
}
|
|
}
|
|
|
|
|
|
public func makeWidgetDriver(settings: WidgetSettings) throws -> WidgetDriverAndHandle {
|
|
return try FfiConverterTypeWidgetDriverAndHandle.lift(
|
|
try rustCallWithError(FfiConverterTypeParseError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_func_make_widget_driver(
|
|
FfiConverterTypeWidgetSettings.lower(settings),$0)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Generates a `matrix.to` permalink from to the given userID.
|
|
*/
|
|
public func matrixToUserPermalink(userId: String) throws -> String {
|
|
return try FfiConverterString.lift(
|
|
try rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_func_matrix_to_user_permalink(
|
|
FfiConverterString.lower(userId),$0)
|
|
}
|
|
)
|
|
}
|
|
public func mediaSourceFromUrl(url: String) -> MediaSource {
|
|
return try! FfiConverterTypeMediaSource.lift(
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_media_source_from_url(
|
|
FfiConverterString.lower(url),$0)
|
|
}
|
|
)
|
|
}
|
|
public func messageEventContentFromHtml(body: String, htmlBody: String) -> RoomMessageEventContentWithoutRelation {
|
|
return try! FfiConverterTypeRoomMessageEventContentWithoutRelation.lift(
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_message_event_content_from_html(
|
|
FfiConverterString.lower(body),
|
|
FfiConverterString.lower(htmlBody),$0)
|
|
}
|
|
)
|
|
}
|
|
public func messageEventContentFromHtmlAsEmote(body: String, htmlBody: String) -> RoomMessageEventContentWithoutRelation {
|
|
return try! FfiConverterTypeRoomMessageEventContentWithoutRelation.lift(
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_message_event_content_from_html_as_emote(
|
|
FfiConverterString.lower(body),
|
|
FfiConverterString.lower(htmlBody),$0)
|
|
}
|
|
)
|
|
}
|
|
public func messageEventContentFromMarkdown(md: String) -> RoomMessageEventContentWithoutRelation {
|
|
return try! FfiConverterTypeRoomMessageEventContentWithoutRelation.lift(
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_message_event_content_from_markdown(
|
|
FfiConverterString.lower(md),$0)
|
|
}
|
|
)
|
|
}
|
|
public func messageEventContentFromMarkdownAsEmote(md: String) -> RoomMessageEventContentWithoutRelation {
|
|
return try! FfiConverterTypeRoomMessageEventContentWithoutRelation.lift(
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_message_event_content_from_markdown_as_emote(
|
|
FfiConverterString.lower(md),$0)
|
|
}
|
|
)
|
|
}
|
|
public func messageEventContentNew(msgtype: MessageType) throws -> RoomMessageEventContentWithoutRelation {
|
|
return try FfiConverterTypeRoomMessageEventContentWithoutRelation.lift(
|
|
try rustCallWithError(FfiConverterTypeClientError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_func_message_event_content_new(
|
|
FfiConverterTypeMessageType.lower(msgtype),$0)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* `WidgetSettings` are usually created from a state event.
|
|
* (currently unimplemented)
|
|
*
|
|
* In some cases the client wants to create custom `WidgetSettings`
|
|
* for specific rooms based on other conditions.
|
|
* This function returns a `WidgetSettings` object which can be used
|
|
* to setup a widget using `run_client_widget_api`
|
|
* and to generate the correct url for the widget.
|
|
* # Arguments
|
|
* * - `props` A struct containing the configuration parameters for a element
|
|
* call widget.
|
|
*/
|
|
public func newVirtualElementCallWidget(props: VirtualElementCallWidgetOptions) throws -> WidgetSettings {
|
|
return try FfiConverterTypeWidgetSettings.lift(
|
|
try rustCallWithError(FfiConverterTypeParseError.lift) {
|
|
uniffi_matrix_sdk_ffi_fn_func_new_virtual_element_call_widget(
|
|
FfiConverterTypeVirtualElementCallWidgetOptions.lower(props),$0)
|
|
}
|
|
)
|
|
}
|
|
/**
|
|
* Parse a matrix entity from a given URI, be it either
|
|
* a `matrix.to` link or a `matrix:` URI
|
|
*/
|
|
public func parseMatrixEntityFrom(uri: String) -> MatrixEntity? {
|
|
return try! FfiConverterOptionTypeMatrixEntity.lift(
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_parse_matrix_entity_from(
|
|
FfiConverterString.lower(uri),$0)
|
|
}
|
|
)
|
|
}
|
|
public func sdkGitSha() -> String {
|
|
return try! FfiConverterString.lift(
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_sdk_git_sha($0)
|
|
}
|
|
)
|
|
}
|
|
public func setupOtlpTracing(config: OtlpTracingConfiguration) {
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_setup_otlp_tracing(
|
|
FfiConverterTypeOtlpTracingConfiguration.lower(config),$0)
|
|
}
|
|
}
|
|
|
|
|
|
public func setupTracing(config: TracingConfiguration) {
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_setup_tracing(
|
|
FfiConverterTypeTracingConfiguration.lower(config),$0)
|
|
}
|
|
}
|
|
|
|
|
|
public func suggestedPowerLevelForRole(role: RoomMemberRole) -> Int64 {
|
|
return try! FfiConverterInt64.lift(
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_suggested_power_level_for_role(
|
|
FfiConverterTypeRoomMemberRole_lower(role),$0)
|
|
}
|
|
)
|
|
}
|
|
public func suggestedRoleForPowerLevel(powerLevel: Int64) -> RoomMemberRole {
|
|
return try! FfiConverterTypeRoomMemberRole_lift(
|
|
try! rustCall() {
|
|
uniffi_matrix_sdk_ffi_fn_func_suggested_role_for_power_level(
|
|
FfiConverterInt64.lower(powerLevel),$0)
|
|
}
|
|
)
|
|
}
|
|
|
|
private enum InitializationResult {
|
|
case ok
|
|
case contractVersionMismatch
|
|
case apiChecksumMismatch
|
|
}
|
|
// Use a global variables to perform the versioning checks. Swift ensures that
|
|
// the code inside is only computed once.
|
|
private var initializationResult: InitializationResult {
|
|
// Get the bindings contract version from our ComponentInterface
|
|
let bindings_contract_version = 26
|
|
// Get the scaffolding contract version by calling the into the dylib
|
|
let scaffolding_contract_version = ffi_matrix_sdk_ffi_uniffi_contract_version()
|
|
if bindings_contract_version != scaffolding_contract_version {
|
|
return InitializationResult.contractVersionMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_gen_transaction_id() != 15808) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_generate_webview_url() != 16579) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_get_element_call_required_permissions() != 30886) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_log_event() != 12418) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_make_widget_driver() != 11382) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_matrix_to_user_permalink() != 56419) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_media_source_from_url() != 33587) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_message_event_content_from_html() != 34215) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_message_event_content_from_html_as_emote() != 21632) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_message_event_content_from_markdown() != 7130) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_message_event_content_from_markdown_as_emote() != 7466) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_message_event_content_new() != 31683) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_new_virtual_element_call_widget() != 39901) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_parse_matrix_entity_from() != 20064) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_sdk_git_sha() != 4038) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_setup_otlp_tracing() != 4491) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_setup_tracing() != 35378) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_suggested_power_level_for_role() != 15784) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_func_suggested_role_for_power_level() != 21984) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_mediasource_to_json() != 2998) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_mediasource_url() != 34026) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roommessageeventcontentwithoutrelation_with_mentions() != 8867) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_authenticationservice_configure_homeserver() != 13406) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_authenticationservice_homeserver_details() != 39542) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_authenticationservice_login() != 30740) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_authenticationservice_login_with_oidc_callback() != 52385) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_authenticationservice_url_for_oidc_login() != 64804) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_account_data() != 42952) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_account_url() != 54235) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_avatar_url() != 18456) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_cached_avatar_url() != 36332) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_create_room() != 25555) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_delete_pusher() != 46707) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_device_id() != 44340) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_display_name() != 31680) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_encryption() != 9657) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_dm_room() != 55850) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_media_content() != 40597) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_media_file() != 37676) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_media_thumbnail() != 29639) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_notification_settings() != 6359) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_profile() != 54768) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_recently_visited_rooms() != 22399) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_room_preview() != 16738) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_get_session_verification_controller() != 62335) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_homeserver() != 26427) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_ignore_user() != 55157) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_ignored_users() != 49620) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_join_room_by_id() != 61264) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_login() != 32848) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_logout() != 7127) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_notification_client() != 49891) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_remove_avatar() != 60365) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_resolve_room_alias() != 40454) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_restore_session() != 19641) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_room_directory_search() != 39855) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_rooms() != 29558) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_search_users() != 30416) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_session() != 8085) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_set_account_data() != 52207) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_set_delegate() != 13852) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_set_display_name() != 27968) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_set_pusher() != 21191) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_subscribe_to_ignored_users() != 46021) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_sync_service() != 52812) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_track_recently_visited_room() != 37070) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_unignore_user() != 9349) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_upload_avatar() != 10403) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_upload_media() != 24862) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_client_user_id() != 40531) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_add_root_certificates() != 57950) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_base_path() != 40888) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_build() != 56018) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_disable_automatic_token_refresh() != 43839) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_disable_ssl_verification() != 2334) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_enable_cross_process_refresh_lock() != 23732) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_homeserver_url() != 30130) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_passphrase() != 47878) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_proxy() != 34543) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_server_name() != 63110) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_server_name_or_homeserver_url() != 22597) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_server_versions() != 36178) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_set_session_delegate() != 37012) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_sliding_sync_proxy() != 40747) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_user_agent() != 35113) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientbuilder_username() != 30031) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_backup_exists_on_server() != 45490) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_backup_state() != 51049) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_backup_state_listener() != 42037) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_disable_recovery() != 18699) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_enable_backups() != 55446) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_enable_recovery() != 27719) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_is_last_device() != 27955) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_recover() != 31143) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_recover_and_reset() != 13857) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_recovery_state() != 54051) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_recovery_state_listener() != 65018) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_reset_recovery_key() != 20380) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_verification_state() != 29114) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_verification_state_listener() != 26187) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_encryption_wait_for_backup_upload_steady_state() != 16813) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_can_be_replied_to() != 42922) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_content() != 41060) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_debug_info() != 31359) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_event_id() != 8156) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_is_editable() != 4716) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_is_local() != 12539) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_is_own() != 50903) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_is_remote() != 5953) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_local_send_state() != 53866) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_origin() != 19585) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_reactions() != 42968) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_read_receipts() != 22462) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_sender() != 58860) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_sender_profile() != 3911) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_timestamp() != 44397) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_eventtimelineitem_transaction_id() != 40338) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_homeserverlogindetails_sliding_sync_proxy() != 46815) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_homeserverlogindetails_supports_oidc_login() != 46090) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_homeserverlogindetails_supports_password_login() != 33501) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_homeserverlogindetails_url() != 61326) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_mediafilehandle_path() != 16357) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_mediafilehandle_persist() != 25010) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_message_body() != 21198) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_message_in_reply_to() != 16154) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_message_is_edited() != 60975) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_message_is_threaded() != 9404) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_message_msgtype() != 14062) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationclient_get_notification() != 22643) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationclientbuilder_filter_by_push_rules() != 20013) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationclientbuilder_finish() != 40007) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_can_homeserver_push_encrypted_event_to_device() != 37323) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_can_push_encrypted_event_to_device() != 21251) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_contains_keywords_rules() != 60025) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_get_default_room_notification_mode() != 38317) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_get_room_notification_settings() != 2344) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_get_rooms_with_user_defined_rules() != 31877) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_get_user_defined_room_notification_mode() != 65418) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_is_call_enabled() != 12210) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_is_invite_for_me_enabled() != 533) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_is_room_mention_enabled() != 13304) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_is_user_mention_enabled() != 49857) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_restore_default_room_notification_mode() != 36036) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_set_call_enabled() != 2652) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_set_default_room_notification_mode() != 58336) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_set_delegate() != 47719) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_set_invite_for_me_enabled() != 35019) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_set_room_mention_enabled() != 51244) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_set_room_notification_mode() != 43729) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_set_user_mention_enabled() != 21551) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettings_unmute_room() != 7480) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_oidcauthenticationdata_login_url() != 43638) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_active_members_count() != 61905) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_active_room_call_participants() != 60098) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_alternative_aliases() != 28555) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_apply_power_level_changes() != 41062) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_avatar_url() != 34637) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_ban_user() != 25865) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_can_user_ban() != 22009) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_can_user_invite() != 2594) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_can_user_kick() != 46822) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_can_user_redact_other() != 18770) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_can_user_redact_own() != 47784) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_can_user_send_message() != 7909) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_can_user_send_state() != 9892) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_can_user_trigger_room_notification() != 32409) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_canonical_alias() != 19786) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_discard_room_key() != 18081) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_display_name() != 39695) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_get_power_levels() != 54094) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_has_active_room_call() != 33588) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_id() != 61990) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_ignore_user() != 50971) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_invite_user_by_id() != 483) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_invited_members_count() != 1023) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_inviter() != 64006) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_is_direct() != 16947) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_is_encrypted() != 55158) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_is_public() != 7336) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_is_space() != 16919) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_is_tombstoned() != 49186) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_join() != 34994) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_joined_members_count() != 55835) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_kick_user() != 52409) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_leave() != 6569) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_mark_as_read() != 43726) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_matrix_to_event_permalink() != 14417) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_matrix_to_permalink() != 47781) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_member() != 53375) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_member_avatar_url() != 42670) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_member_display_name() != 25496) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_members() != 42691) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_members_no_sync() != 3255) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_membership() != 26065) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_name() != 49131) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_own_user_id() != 39510) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_redact() != 55672) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_remove_avatar() != 32659) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_report_content() != 39574) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_reset_power_levels() != 63622) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_room_info() != 41146) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_set_is_favourite() != 41879) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_set_is_low_priority() != 47223) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_set_name() != 60145) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_set_topic() != 29413) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_set_unread_flag() != 35026) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_subscribe_to_room_info_updates() != 47774) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_subscribe_to_typing_notifications() != 24633) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_suggested_role_for_user() != 37402) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_timeline() != 701) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_topic() != 59745) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_typing_notice() != 10027) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_unban_user() != 51089) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_update_power_levels_for_users() != 34363) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_room_upload_avatar() != 34800) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomdirectorysearch_is_at_last_page() != 22509) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomdirectorysearch_loaded_pages() != 7109) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomdirectorysearch_next_page() != 14603) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomdirectorysearch_results() != 40431) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomdirectorysearch_search() != 11131) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlist_entries() != 24971) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlist_entries_with_dynamic_adapters() != 3188) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlist_loading_state() != 53222) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlist_room() != 21437) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistdynamicentriescontroller_add_one_page() != 47748) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistdynamicentriescontroller_reset_to_one_page() != 61352) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistdynamicentriescontroller_set_filter() != 51384) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_avatar_url() != 39097) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_canonical_alias() != 63300) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_full_room() != 35618) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_id() != 41176) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_init_timeline() != 15676) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_is_direct() != 46873) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_is_timeline_initialized() != 46855) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_latest_event() != 41471) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_name() != 6516) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_room_info() != 32985) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_subscribe() != 19882) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistitem_unsubscribe() != 45026) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservice_all_rooms() != 49704) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservice_apply_input() != 63125) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservice_invites() != 18531) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservice_room() != 63500) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservice_state() != 49435) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservice_sync_indicator() != 50946) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roommembersiterator_len() != 39835) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roommembersiterator_next_chunk() != 36165) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sendattachmentjoinhandle_cancel() != 19759) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sendattachmentjoinhandle_join() != 49985) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontroller_approve_verification() != 12154) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontroller_cancel_verification() != 42503) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontroller_decline_verification() != 51976) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontroller_is_verified() != 60081) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontroller_request_verification() != 22948) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontroller_set_delegate() != 18081) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontroller_start_sas_verification() != 17409) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationemoji_description() != 21346) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationemoji_symbol() != 46075) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_span_enter() != 8900) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_span_exit() != 47924) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_span_is_none() != 33327) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_syncservice_room_list_service() != 26426) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_syncservice_start() != 16010) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_syncservice_state() != 23660) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_syncservice_stop() != 23138) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_syncservicebuilder_finish() != 22814) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_syncservicebuilder_with_cross_process_lock() != 43169) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_syncservicebuilder_with_unified_invites_in_room_list() != 46590) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_syncservicebuilder_with_utd_hook() != 31250) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_taskhandle_cancel() != 9124) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_taskhandle_is_finished() != 29008) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_add_listener() != 36410) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_cancel_send() != 48666) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_create_poll() != 19084) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_edit() != 30407) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_edit_poll() != 52880) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_end_poll() != 27185) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_fetch_details_for_event() != 20865) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_fetch_members() != 37994) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_get_event_timeline_item_by_event_id() != 33483) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_get_timeline_event_content_by_event_id() != 33318) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_latest_event() != 11115) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_mark_as_read() != 15734) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_paginate_backwards() != 40762) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_retry_decryption() != 57065) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_retry_send() != 31214) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_send() != 16148) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_send_audio() != 2898) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_send_file() != 14268) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_send_image() != 33650) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_send_location() != 2150) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_send_poll_response() != 32951) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_send_read_receipt() != 30808) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_send_reply() != 8317) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_send_video() != 28201) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_send_voice_message() != 50962) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_subscribe_to_back_pagination_status() != 9015) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timeline_toggle_reaction() != 42402) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelinediff_append() != 8453) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelinediff_change() != 4562) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelinediff_insert() != 26630) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelinediff_push_back() != 53464) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelinediff_push_front() != 42084) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelinediff_remove() != 74) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelinediff_reset() != 34118) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelinediff_set() != 13334) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelineevent_event_id() != 11088) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelineevent_event_type() != 12922) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelineevent_sender_id() != 18142) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelineevent_timestamp() != 58123) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelineitem_as_event() != 52211) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelineitem_as_virtual() != 50960) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelineitem_fmt_debug() != 38094) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelineitem_unique_id() != 8639) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelineitemcontent_as_message() != 45784) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelineitemcontent_kind() != 44789) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_unreadnotificationscount_has_notifications() != 33024) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_unreadnotificationscount_highlight_count() != 35997) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_unreadnotificationscount_notification_count() != 35655) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_widgetdriver_run() != 6150) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_widgetdriverhandle_recv() != 2662) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_widgetdriverhandle_send() != 34976) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_constructor_mediasource_from_json() != 62542) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_constructor_authenticationservice_new() != 249) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_constructor_clientbuilder_new() != 43131) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_constructor_span_current() != 65184) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_constructor_span_new() != 62579) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_constructor_timelineeventtypefilter_exclude() != 48570) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_constructor_timelineeventtypefilter_include() != 21388) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_backpaginationstatuslistener_on_update() != 5891) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_backupstatelistener_on_update() != 24369) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_backupsteadystatelistener_on_update() != 40381) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientdelegate_did_receive_auth_error() != 26414) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientdelegate_did_refresh_tokens() != 16325) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientsessiondelegate_retrieve_session_from_keychain() != 48691) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_clientsessiondelegate_save_session_in_keychain() != 34411) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_enablerecoveryprogresslistener_on_update() != 30049) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_ignoreduserslistener_call() != 22029) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_notificationsettingsdelegate_settings_did_change() != 51708) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_progresswatcher_transmission_progress() != 20412) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_recoverystatelistener_on_update() != 3747) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomdirectorysearchentrieslistener_on_update() != 3751) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roominfolistener_call() != 29620) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistentrieslistener_on_update() != 4030) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistloadingstatelistener_on_update() != 19361) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservicestatelistener_on_update() != 29313) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_roomlistservicesyncindicatorlistener_on_update() != 42394) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontrollerdelegate_did_accept_verification_request() != 22759) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontrollerdelegate_did_start_sas_verification() != 54982) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontrollerdelegate_did_receive_verification_data() != 63916) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontrollerdelegate_did_fail() != 56823) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontrollerdelegate_did_cancel() != 29888) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_sessionverificationcontrollerdelegate_did_finish() != 54532) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_syncservicestateobserver_on_update() != 11758) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_timelinelistener_on_update() != 9224) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_typingnotificationslistener_call() != 50844) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_unabletodecryptdelegate_on_utd() != 28912) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_verificationstatelistener_on_update() != 9392) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
if (uniffi_matrix_sdk_ffi_checksum_method_widgetcapabilitiesprovider_acquire_capabilities() != 43759) {
|
|
return InitializationResult.apiChecksumMismatch
|
|
}
|
|
|
|
uniffiCallbackInitBackPaginationStatusListener()
|
|
uniffiCallbackInitBackupStateListener()
|
|
uniffiCallbackInitBackupSteadyStateListener()
|
|
uniffiCallbackInitClientDelegate()
|
|
uniffiCallbackInitClientSessionDelegate()
|
|
uniffiCallbackInitEnableRecoveryProgressListener()
|
|
uniffiCallbackInitIgnoredUsersListener()
|
|
uniffiCallbackInitNotificationSettingsDelegate()
|
|
uniffiCallbackInitProgressWatcher()
|
|
uniffiCallbackInitRecoveryStateListener()
|
|
uniffiCallbackInitRoomDirectorySearchEntriesListener()
|
|
uniffiCallbackInitRoomInfoListener()
|
|
uniffiCallbackInitRoomListEntriesListener()
|
|
uniffiCallbackInitRoomListLoadingStateListener()
|
|
uniffiCallbackInitRoomListServiceStateListener()
|
|
uniffiCallbackInitRoomListServiceSyncIndicatorListener()
|
|
uniffiCallbackInitSessionVerificationControllerDelegate()
|
|
uniffiCallbackInitSyncServiceStateObserver()
|
|
uniffiCallbackInitTimelineListener()
|
|
uniffiCallbackInitTypingNotificationsListener()
|
|
uniffiCallbackInitUnableToDecryptDelegate()
|
|
uniffiCallbackInitVerificationStateListener()
|
|
uniffiCallbackInitWidgetCapabilitiesProvider()
|
|
return InitializationResult.ok
|
|
}
|
|
|
|
private func uniffiEnsureInitialized() {
|
|
switch initializationResult {
|
|
case .ok:
|
|
break
|
|
case .contractVersionMismatch:
|
|
fatalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
|
|
case .apiChecksumMismatch:
|
|
fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
|
|
}
|
|
}
|
|
|
|
// swiftlint:enable all |