// 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(gotcha_coreFFI)
import gotcha_coreFFI
#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 empty() -> RustBuffer {
        RustBuffer(capacity: 0, len:0, data: nil)
    }

    static func from(_ ptr: UnsafeBufferPointer<UInt8>) -> RustBuffer {
        try! rustCall { ffi_gotcha_core_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_gotcha_core_rustbuffer_free(self, $0) }
    }
}

fileprivate extension ForeignBytes {
    init(bufferPointer: UnsafeBufferPointer<UInt8>) {
        self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress)
    }

    init(rawBufferPointer: UnsafeRawBufferPointer) {
        self.init(
            len: Int32(rawBufferPointer.count),
            data: rawBufferPointer.baseAddress?.assumingMemoryBound(to: UInt8.self)
        )
    }
}

// Converter for `&[u8]` / `[ByRef] bytes` arguments.
//
// Conforms to `FfiConverter` so the compiler enforces the full converter
// method set. Only the scope-bound `lower(_:_body:)` overload is sound —
// zero-copy byte buffers only flow foreign -> Rust, and only in argument
// position. The four protocol-witness methods (`lift`, `lower`, `read`,
// `write`) `fatalError` at runtime if anyone reaches them.
//
// The scope-bound `lower` takes a closure because the `ForeignBytes`
// pointer is only guaranteed valid for the duration of
// `Data.withUnsafeBytes`. Callers must run the full FFI call inside
// the closure body.
fileprivate enum FfiConverterByRefBytes: FfiConverter {
    typealias SwiftType = Data
    typealias FfiType = ForeignBytes

    static func lower<R>(_ value: Data, _ body: (ForeignBytes) throws -> R) rethrows -> R {
        return try value.withUnsafeBytes { rawBuf in
            try body(ForeignBytes(rawBufferPointer: rawBuf))
        }
    }

    static func lower(_ value: Data) -> ForeignBytes {
        fatalError("ByRef bytes cannot use the plain lower: returning ForeignBytes escapes the Data.withUnsafeBytes scope. Use the scope-bound lower(_:_body:) overload instead.")
    }

    static func lift(_ value: ForeignBytes) throws -> Data {
        fatalError("ByRef bytes cannot be lifted: zero-copy &[u8] only flows foreign->Rust")
    }

    static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Data {
        fatalError("ByRef bytes cannot be read from a buffer: zero-copy &[u8] is only supported in argument position, not nested in records/options/etc.")
    }

    static func write(_ value: Data, into buf: inout [UInt8]) {
        fatalError("ByRef bytes cannot be written to a buffer: zero-copy &[u8] is only supported in argument position, not nested in records/options/etc.")
    }
}

// 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) {
        self.init(
            bytesNoCopy: rustBuffer.data!,
            count: Int(rustBuffer.len),
            deallocator: .none
        )
    }
}

// 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 to 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 {
#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    public static func lift(_ value: FfiType) throws -> SwiftType {
        return value
    }

#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    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 {
#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    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
    }

#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    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 {
    let neverThrow: ((RustBuffer) throws -> Never)? = nil
    return try makeRustCall(callback, errorHandler: neverThrow)
}

private func rustCallWithError<T, E: Swift.Error>(
    _ errorHandler: @escaping (RustBuffer) throws -> E,
    _ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
    try makeRustCall(callback, errorHandler: errorHandler)
}

private func makeRustCall<T, E: Swift.Error>(
    _ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
    errorHandler: ((RustBuffer) throws -> E)?
) throws -> T {
    uniffiEnsureGotchaCoreInitialized()
    var callStatus = RustCallStatus.init()
    let returnedVal = callback(&callStatus)
    try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler)
    return returnedVal
}

private func uniffiCheckCallStatus<E: Swift.Error>(
    callStatus: RustCallStatus,
    errorHandler: ((RustBuffer) throws -> E)?
) 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))
    }
}
// Initial value and increment amount for handles.
// These ensure that SWIFT handles always have the lowest bit set
fileprivate let UNIFFI_HANDLEMAP_INITIAL: UInt64 = 1
fileprivate let UNIFFI_HANDLEMAP_DELTA: UInt64 = 2

fileprivate final class UniffiHandleMap<T>: @unchecked Sendable {
    // All mutation happens with this lock held, which is why we implement @unchecked Sendable.
    private let lock = NSLock()
    private var map: [UInt64: T] = [:]
    private var currentHandle: UInt64 = UNIFFI_HANDLEMAP_INITIAL

    func insert(obj: T) -> UInt64 {
        lock.withLock {
            return doInsert(obj)
        }
    }

    // Low-level insert function, this assumes `lock` is held.
    private func doInsert(_ obj: T) -> UInt64 {
        let handle = currentHandle
        currentHandle += UNIFFI_HANDLEMAP_DELTA
        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
        }
    }

     func clone(handle: UInt64) throws -> UInt64 {
        try lock.withLock {
            guard let obj = map[handle] else {
                throw UniffiInternalError.unexpectedStaleHandle
            }
            return doInsert(obj)
        }
    }

    @discardableResult
    func remove(handle: UInt64) throws -> T {
        try lock.withLock {
            guard let obj = map.removeValue(forKey: handle) else {
                throw UniffiInternalError.unexpectedStaleHandle
            }
            return obj
        }
    }

    var count: Int {
        get {
            map.count
        }
    }
}


// Public interface members begin here.


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
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))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
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))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
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))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
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))
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
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))
        // Use Swift's native UTF-8 decoder; `String(bytes:encoding:.utf8)` goes
        // through Foundation's NSString and silently strips a leading U+FEFF BOM.
        // Invalid UTF-8 substitutes U+FFFD instead of trapping (unreachable
        // given Rust's `String` invariant).
        return String(decoding: bytes, as: UTF8.self)
    }

    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)
        // See `lift` above for why we avoid Foundation's NSString-backed decoder here.
        return String(decoding: try readBytes(&buf, count: Int(len)), as: UTF8.self)
    }

    public static func write(_ value: String, into buf: inout [UInt8]) {
        let len = Int32(value.utf8.count)
        writeInt(&buf, len)
        writeBytes(&buf, value.utf8)
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
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)
    }
}




public protocol GotchaCoreProtocol: AnyObject, Sendable {

    func commitDetails(owner: String, repository: String, sha: String, branch: String?) async throws  -> CommitDetailsPage

    func commitDiff(owner: String, repository: String, sha: String, path: String) async throws  -> DiffPage

    func commits(owner: String, repository: String, branch: String?, path: String, pages: UInt32) async throws  -> CommitPage

    func pullDiff(owner: String, repository: String, number: Int64, path: String) async throws  -> DiffPage

    func repositoryContents(owner: String, repository: String, path: String) async throws  -> [RepositoryContentRow]

    func repositoryFile(owner: String, repository: String, path: String) async throws  -> RepositoryFilePage

    func clearIssueFilters(owner: String, repository: String) throws

    func deleteIssue(owner: String, repository: String, number: Int64) async throws

    func issue(owner: String, repository: String, number: Int64, page: UInt32) async throws  -> IssuePage

    func issueEditor(owner: String, repository: String, number: Int64?) async throws  -> IssueEditorPage

    func issueFilters(owner: String, repository: String) async throws  -> IssueFilterOptions

    func issueFiltersActive(owner: String, repository: String) throws  -> Bool

    func issues(owner: String, repository: String, page: UInt32) async throws  -> IssueListPage

    func saveIssue(owner: String, repository: String, number: Int64?, title: String, body: String, labelIds: [Int64], milestoneId: Int64?, dueDate: Int64?, closed: Bool) async throws  -> Int64

    func saveIssueComment(owner: String, repository: String, number: Int64, commentId: Int64?, body: String) async throws

    func setIssueClosed(owner: String, repository: String, number: Int64, closed: Bool) async throws

    func setIssueFilters(owner: String, repository: String, milestone: String, labels: [String], searchText: String) throws

    func deleteMilestone(owner: String, repository: String, id: Int64) async throws

    func milestone(owner: String, repository: String, id: Int64, page: UInt32) async throws  -> MilestonePage

    func milestoneEditor(owner: String, repository: String, id: Int64?) async throws  -> MilestoneEditorPage

    func milestones(owner: String, repository: String, page: UInt32) async throws  -> MilestoneListPage

    func saveMilestone(owner: String, repository: String, id: Int64?, draft: MilestoneEditorPage) async throws  -> Int64

    func setMilestoneClosed(owner: String, repository: String, id: Int64, closed: Bool) async throws

    func markNotificationRead(serverId: String, id: Int64) async throws

    func notifications(status: NotificationStatus, page: UInt32) async throws  -> NotificationListPage

    func pollNotifications() async throws  -> [NotificationRow]

    func clearPullFilters() throws

    func pull(owner: String, repository: String, number: Int64, page: UInt32) async throws  -> PullPage

    func pullFilters() async throws  -> PullFilterOptions

    func pullFiltersActive() throws  -> Bool

    func pulls(page: UInt32) async throws  -> PullListPage

    func setPullFilters(milestone: String, searchText: String) throws

    func repositories(page: UInt32, pane: RepositoryPane) async throws  -> RepositoryListPage

    func toggleFavorite(owner: String, repository: String, pane: RepositoryPane) throws  -> [RepositoryRow]

    func activeServerIndex()  -> UInt32?

    func activeServerName()  -> String?

    func addServer(name: String, url: String, token: String, provider: ServerProvider) async throws  -> UInt32

    func deleteServer(index: UInt32) async throws

    func home(page: UInt32, filter: HomeActivityFilter) async throws  -> HomePage

    func selectServer(index: UInt32) throws

    func serverActivity(page: UInt32) async throws  -> ServerActivityPage

    func serverEditor(index: UInt32) throws  -> ServerEditor

    func servers()  -> [ServerRow]

    func setAppearance(index: UInt32) throws

    func setIssueStatus(status: String) throws

    func setNotificationsEnabled(enabled: Bool) throws

    func setPullStatus(status: String) throws

    func settings()  -> Settings

    func startupError()  -> String?

    func updateServer(index: UInt32, name: String, url: String, token: String, provider: ServerProvider) async throws

    func widgetActivity(serverId: String, limit: UInt32) async throws  -> WidgetActivityPage

    func widgetPulls(serverId: String, limit: UInt32) async throws  -> WidgetPullPage

}
open class GotchaCore: GotchaCoreProtocol, @unchecked Sendable {
    fileprivate let handle: UInt64

    /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly.
#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    public struct NoHandle {
        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`.
#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    required public init(unsafeFromHandle handle: UInt64) {
        self.handle = handle
    }

    // This constructor can be used to instantiate a fake object.
    // - Parameter noHandle: 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 handle the FFI lower functions will crash.
#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    public init(noHandle: NoHandle) {
        self.handle = 0
    }

#if swift(>=5.8)
    @_documentation(visibility: private)
#endif
    public func uniffiCloneHandle() -> UInt64 {
        return try! rustCall { uniffi_gotcha_core_fn_clone_gotchacore(self.handle, $0) }
    }
public convenience init(storageDirectory: String?) {
    let handle =
        try! rustCall() {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_constructor_gotchacore_new(
        FfiConverterOptionString.lower(storageDirectory),uniffiCallStatus
    )
}
    self.init(unsafeFromHandle: handle)
}

    deinit {
        if handle == 0 {
            // Mock objects have handle=0 don't try to free them
            return
        }

        try! rustCall { uniffi_gotcha_core_fn_free_gotchacore(handle, $0) }
    }




open func commitDetails(owner: String, repository: String, sha: String, branch: String?)async throws  -> CommitDetailsPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_commit_details(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterString.lower(sha),FfiConverterOptionString.lower(branch)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeCommitDetailsPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func commitDiff(owner: String, repository: String, sha: String, path: String)async throws  -> DiffPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_commit_diff(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterString.lower(sha),FfiConverterString.lower(path)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeDiffPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func commits(owner: String, repository: String, branch: String?, path: String, pages: UInt32)async throws  -> CommitPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_commits(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterOptionString.lower(branch),FfiConverterString.lower(path),FfiConverterUInt32.lower(pages)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeCommitPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func pullDiff(owner: String, repository: String, number: Int64, path: String)async throws  -> DiffPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_pull_diff(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(number),FfiConverterString.lower(path)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeDiffPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func repositoryContents(owner: String, repository: String, path: String)async throws  -> [RepositoryContentRow]  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_repository_contents(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterString.lower(path)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterSequenceTypeRepositoryContentRow.lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func repositoryFile(owner: String, repository: String, path: String)async throws  -> RepositoryFilePage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_repository_file(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterString.lower(path)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeRepositoryFilePage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func clearIssueFilters(owner: String, repository: String)throws   {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_clear_issue_filters(
            self.uniffiCloneHandle(),
        FfiConverterString.lower(owner),
        FfiConverterString.lower(repository),uniffiCallStatus
    )
}
}

open func deleteIssue(owner: String, repository: String, number: Int64)async throws   {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_delete_issue(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(number)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_void,
            completeFunc: ffi_gotcha_core_rust_future_complete_void,
            freeFunc: ffi_gotcha_core_rust_future_free_void,
            liftFunc: { $0 },
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func issue(owner: String, repository: String, number: Int64, page: UInt32)async throws  -> IssuePage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_issue(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(number),FfiConverterUInt32.lower(page)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeIssuePage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func issueEditor(owner: String, repository: String, number: Int64?)async throws  -> IssueEditorPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_issue_editor(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterOptionInt64.lower(number)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeIssueEditorPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func issueFilters(owner: String, repository: String)async throws  -> IssueFilterOptions  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_issue_filters(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeIssueFilterOptions_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func issueFiltersActive(owner: String, repository: String)throws  -> Bool  {
    return try  FfiConverterBool.lift(try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_issue_filters_active(
            self.uniffiCloneHandle(),
        FfiConverterString.lower(owner),
        FfiConverterString.lower(repository),uniffiCallStatus
    )
})
}

open func issues(owner: String, repository: String, page: UInt32)async throws  -> IssueListPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_issues(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterUInt32.lower(page)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeIssueListPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func saveIssue(owner: String, repository: String, number: Int64?, title: String, body: String, labelIds: [Int64], milestoneId: Int64?, dueDate: Int64?, closed: Bool)async throws  -> Int64  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_save_issue(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterOptionInt64.lower(number),FfiConverterString.lower(title),FfiConverterString.lower(body),FfiConverterSequenceInt64.lower(labelIds),FfiConverterOptionInt64.lower(milestoneId),FfiConverterOptionInt64.lower(dueDate),FfiConverterBool.lower(closed)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_i64,
            completeFunc: ffi_gotcha_core_rust_future_complete_i64,
            freeFunc: ffi_gotcha_core_rust_future_free_i64,
            liftFunc: FfiConverterInt64.lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func saveIssueComment(owner: String, repository: String, number: Int64, commentId: Int64?, body: String)async throws   {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_save_issue_comment(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(number),FfiConverterOptionInt64.lower(commentId),FfiConverterString.lower(body)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_void,
            completeFunc: ffi_gotcha_core_rust_future_complete_void,
            freeFunc: ffi_gotcha_core_rust_future_free_void,
            liftFunc: { $0 },
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func setIssueClosed(owner: String, repository: String, number: Int64, closed: Bool)async throws   {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_set_issue_closed(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(number),FfiConverterBool.lower(closed)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_void,
            completeFunc: ffi_gotcha_core_rust_future_complete_void,
            freeFunc: ffi_gotcha_core_rust_future_free_void,
            liftFunc: { $0 },
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func setIssueFilters(owner: String, repository: String, milestone: String, labels: [String], searchText: String)throws   {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_set_issue_filters(
            self.uniffiCloneHandle(),
        FfiConverterString.lower(owner),
        FfiConverterString.lower(repository),
        FfiConverterString.lower(milestone),
        FfiConverterSequenceString.lower(labels),
        FfiConverterString.lower(searchText),uniffiCallStatus
    )
}
}

open func deleteMilestone(owner: String, repository: String, id: Int64)async throws   {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_delete_milestone(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(id)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_void,
            completeFunc: ffi_gotcha_core_rust_future_complete_void,
            freeFunc: ffi_gotcha_core_rust_future_free_void,
            liftFunc: { $0 },
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func milestone(owner: String, repository: String, id: Int64, page: UInt32)async throws  -> MilestonePage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_milestone(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(id),FfiConverterUInt32.lower(page)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeMilestonePage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func milestoneEditor(owner: String, repository: String, id: Int64?)async throws  -> MilestoneEditorPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_milestone_editor(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterOptionInt64.lower(id)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeMilestoneEditorPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func milestones(owner: String, repository: String, page: UInt32)async throws  -> MilestoneListPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_milestones(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterUInt32.lower(page)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeMilestoneListPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func saveMilestone(owner: String, repository: String, id: Int64?, draft: MilestoneEditorPage)async throws  -> Int64  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_save_milestone(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterOptionInt64.lower(id),FfiConverterTypeMilestoneEditorPage_lower(draft)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_i64,
            completeFunc: ffi_gotcha_core_rust_future_complete_i64,
            freeFunc: ffi_gotcha_core_rust_future_free_i64,
            liftFunc: FfiConverterInt64.lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func setMilestoneClosed(owner: String, repository: String, id: Int64, closed: Bool)async throws   {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_set_milestone_closed(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(id),FfiConverterBool.lower(closed)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_void,
            completeFunc: ffi_gotcha_core_rust_future_complete_void,
            freeFunc: ffi_gotcha_core_rust_future_free_void,
            liftFunc: { $0 },
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func markNotificationRead(serverId: String, id: Int64)async throws   {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_mark_notification_read(
                        self.uniffiCloneHandle(),FfiConverterString.lower(serverId),FfiConverterInt64.lower(id)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_void,
            completeFunc: ffi_gotcha_core_rust_future_complete_void,
            freeFunc: ffi_gotcha_core_rust_future_free_void,
            liftFunc: { $0 },
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func notifications(status: NotificationStatus, page: UInt32)async throws  -> NotificationListPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_notifications(
                        self.uniffiCloneHandle(),FfiConverterTypeNotificationStatus_lower(status),FfiConverterUInt32.lower(page)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeNotificationListPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func pollNotifications()async throws  -> [NotificationRow]  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_poll_notifications(
                        self.uniffiCloneHandle()
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterSequenceTypeNotificationRow.lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func clearPullFilters()throws   {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_clear_pull_filters(
            self.uniffiCloneHandle(),uniffiCallStatus
    )
}
}

open func pull(owner: String, repository: String, number: Int64, page: UInt32)async throws  -> PullPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_pull(
                        self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(number),FfiConverterUInt32.lower(page)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypePullPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func pullFilters()async throws  -> PullFilterOptions  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_pull_filters(
                        self.uniffiCloneHandle()
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypePullFilterOptions_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func pullFiltersActive()throws  -> Bool  {
    return try  FfiConverterBool.lift(try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_pull_filters_active(
            self.uniffiCloneHandle(),uniffiCallStatus
    )
})
}

open func pulls(page: UInt32)async throws  -> PullListPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_pulls(
                        self.uniffiCloneHandle(),FfiConverterUInt32.lower(page)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypePullListPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func setPullFilters(milestone: String, searchText: String)throws   {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_set_pull_filters(
            self.uniffiCloneHandle(),
        FfiConverterString.lower(milestone),
        FfiConverterString.lower(searchText),uniffiCallStatus
    )
}
}

open func repositories(page: UInt32, pane: RepositoryPane)async throws  -> RepositoryListPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_repositories(
                        self.uniffiCloneHandle(),FfiConverterUInt32.lower(page),FfiConverterTypeRepositoryPane_lower(pane)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeRepositoryListPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func toggleFavorite(owner: String, repository: String, pane: RepositoryPane)throws  -> [RepositoryRow]  {
    return try  FfiConverterSequenceTypeRepositoryRow.lift(try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_toggle_favorite(
            self.uniffiCloneHandle(),
        FfiConverterString.lower(owner),
        FfiConverterString.lower(repository),
        FfiConverterTypeRepositoryPane_lower(pane),uniffiCallStatus
    )
})
}

open func activeServerIndex() -> UInt32?  {
    return try!  FfiConverterOptionUInt32.lift(try! rustCall() {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_active_server_index(
            self.uniffiCloneHandle(),uniffiCallStatus
    )
})
}

open func activeServerName() -> String?  {
    return try!  FfiConverterOptionString.lift(try! rustCall() {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_active_server_name(
            self.uniffiCloneHandle(),uniffiCallStatus
    )
})
}

open func addServer(name: String, url: String, token: String, provider: ServerProvider)async throws  -> UInt32  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_add_server(
                        self.uniffiCloneHandle(),FfiConverterString.lower(name),FfiConverterString.lower(url),FfiConverterString.lower(token),FfiConverterTypeServerProvider_lower(provider)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_u32,
            completeFunc: ffi_gotcha_core_rust_future_complete_u32,
            freeFunc: ffi_gotcha_core_rust_future_free_u32,
            liftFunc: FfiConverterUInt32.lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func deleteServer(index: UInt32)async throws   {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_delete_server(
                        self.uniffiCloneHandle(),FfiConverterUInt32.lower(index)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_void,
            completeFunc: ffi_gotcha_core_rust_future_complete_void,
            freeFunc: ffi_gotcha_core_rust_future_free_void,
            liftFunc: { $0 },
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func home(page: UInt32, filter: HomeActivityFilter)async throws  -> HomePage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_home(
                        self.uniffiCloneHandle(),FfiConverterUInt32.lower(page),FfiConverterTypeHomeActivityFilter_lower(filter)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeHomePage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func selectServer(index: UInt32)throws   {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_select_server(
            self.uniffiCloneHandle(),
        FfiConverterUInt32.lower(index),uniffiCallStatus
    )
}
}

open func serverActivity(page: UInt32)async throws  -> ServerActivityPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_server_activity(
                        self.uniffiCloneHandle(),FfiConverterUInt32.lower(page)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeServerActivityPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func serverEditor(index: UInt32)throws  -> ServerEditor  {
    return try  FfiConverterTypeServerEditor_lift(try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_server_editor(
            self.uniffiCloneHandle(),
        FfiConverterUInt32.lower(index),uniffiCallStatus
    )
})
}

open func servers() -> [ServerRow]  {
    return try!  FfiConverterSequenceTypeServerRow.lift(try! rustCall() {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_servers(
            self.uniffiCloneHandle(),uniffiCallStatus
    )
})
}

open func setAppearance(index: UInt32)throws   {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_set_appearance(
            self.uniffiCloneHandle(),
        FfiConverterUInt32.lower(index),uniffiCallStatus
    )
}
}

open func setIssueStatus(status: String)throws   {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_set_issue_status(
            self.uniffiCloneHandle(),
        FfiConverterString.lower(status),uniffiCallStatus
    )
}
}

open func setNotificationsEnabled(enabled: Bool)throws   {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_set_notifications_enabled(
            self.uniffiCloneHandle(),
        FfiConverterBool.lower(enabled),uniffiCallStatus
    )
}
}

open func setPullStatus(status: String)throws   {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_set_pull_status(
            self.uniffiCloneHandle(),
        FfiConverterString.lower(status),uniffiCallStatus
    )
}
}

open func settings() -> Settings  {
    return try!  FfiConverterTypeSettings_lift(try! rustCall() {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_settings(
            self.uniffiCloneHandle(),uniffiCallStatus
    )
})
}

open func startupError() -> String?  {
    return try!  FfiConverterOptionString.lift(try! rustCall() {
        uniffiCallStatus in
    uniffi_gotcha_core_fn_method_gotchacore_startup_error(
            self.uniffiCloneHandle(),uniffiCallStatus
    )
})
}

open func updateServer(index: UInt32, name: String, url: String, token: String, provider: ServerProvider)async throws   {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_update_server(
                        self.uniffiCloneHandle(),FfiConverterUInt32.lower(index),FfiConverterString.lower(name),FfiConverterString.lower(url),FfiConverterString.lower(token),FfiConverterTypeServerProvider_lower(provider)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_void,
            completeFunc: ffi_gotcha_core_rust_future_complete_void,
            freeFunc: ffi_gotcha_core_rust_future_free_void,
            liftFunc: { $0 },
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func widgetActivity(serverId: String, limit: UInt32)async throws  -> WidgetActivityPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_widget_activity(
                        self.uniffiCloneHandle(),FfiConverterString.lower(serverId),FfiConverterUInt32.lower(limit)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeWidgetActivityPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}

open func widgetPulls(serverId: String, limit: UInt32)async throws  -> WidgetPullPage  {
    return
        try  await uniffiRustCallAsync(
            rustFutureFunc: {
                uniffi_gotcha_core_fn_method_gotchacore_widget_pulls(
                        self.uniffiCloneHandle(),FfiConverterString.lower(serverId),FfiConverterUInt32.lower(limit)
                )
            },
            pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
            completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer,
            freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer,
            liftFunc: FfiConverterTypeWidgetPullPage_lift,
            errorHandler: FfiConverterTypeGotchaError_lift
        )
}



}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeGotchaCore: FfiConverter {
    typealias FfiType = UInt64
    typealias SwiftType = GotchaCore

    public static func lift(_ handle: UInt64) throws -> GotchaCore {
        return GotchaCore(unsafeFromHandle: handle)
    }

    public static func lower(_ value: GotchaCore) -> UInt64 {
        return value.uniffiCloneHandle()
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GotchaCore {
        let handle: UInt64 = try readInt(&buf)
        return try lift(handle)
    }

    public static func write(_ value: GotchaCore, into buf: inout [UInt8]) {
        writeInt(&buf, lower(value))
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGotchaCore_lift(_ handle: UInt64) throws -> GotchaCore {
    return try FfiConverterTypeGotchaCore.lift(handle)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGotchaCore_lower(_ value: GotchaCore) -> UInt64 {
    return FfiConverterTypeGotchaCore.lower(value)
}




public struct ActivityRow: Equatable, Hashable {
    public var icon: ActivityIcon
    public var title: String
    public var detail: String
    public var meta: String
    public var target: ActivityTargetKind
    public var owner: String
    public var repository: String
    public var number: Int64
    public var sha: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(icon: ActivityIcon, title: String, detail: String, meta: String, target: ActivityTargetKind, owner: String, repository: String, number: Int64, sha: String) {
        self.icon = icon
        self.title = title
        self.detail = detail
        self.meta = meta
        self.target = target
        self.owner = owner
        self.repository = repository
        self.number = number
        self.sha = sha
    }




}

#if compiler(>=6)
extension ActivityRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeActivityRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ActivityRow {
        return
            try ActivityRow(
                icon: FfiConverterTypeActivityIcon.read(from: &buf),
                title: FfiConverterString.read(from: &buf),
                detail: FfiConverterString.read(from: &buf),
                meta: FfiConverterString.read(from: &buf),
                target: FfiConverterTypeActivityTargetKind.read(from: &buf),
                owner: FfiConverterString.read(from: &buf),
                repository: FfiConverterString.read(from: &buf),
                number: FfiConverterInt64.read(from: &buf),
                sha: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: ActivityRow, into buf: inout [UInt8]) {
        FfiConverterTypeActivityIcon.write(value.icon, into: &buf)
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterString.write(value.detail, into: &buf)
        FfiConverterString.write(value.meta, into: &buf)
        FfiConverterTypeActivityTargetKind.write(value.target, into: &buf)
        FfiConverterString.write(value.owner, into: &buf)
        FfiConverterString.write(value.repository, into: &buf)
        FfiConverterInt64.write(value.number, into: &buf)
        FfiConverterString.write(value.sha, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeActivityRow_lift(_ buf: RustBuffer) throws -> ActivityRow {
    return try FfiConverterTypeActivityRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeActivityRow_lower(_ value: ActivityRow) -> RustBuffer {
    return FfiConverterTypeActivityRow.lower(value)
}


public struct CommentRow: Equatable, Hashable {
    public var id: Int64
    public var author: String
    public var body: String
    public var meta: String
    public var canEdit: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(id: Int64, author: String, body: String, meta: String, canEdit: Bool) {
        self.id = id
        self.author = author
        self.body = body
        self.meta = meta
        self.canEdit = canEdit
    }




}

#if compiler(>=6)
extension CommentRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeCommentRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CommentRow {
        return
            try CommentRow(
                id: FfiConverterInt64.read(from: &buf),
                author: FfiConverterString.read(from: &buf),
                body: FfiConverterString.read(from: &buf),
                meta: FfiConverterString.read(from: &buf),
                canEdit: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: CommentRow, into buf: inout [UInt8]) {
        FfiConverterInt64.write(value.id, into: &buf)
        FfiConverterString.write(value.author, into: &buf)
        FfiConverterString.write(value.body, into: &buf)
        FfiConverterString.write(value.meta, into: &buf)
        FfiConverterBool.write(value.canEdit, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCommentRow_lift(_ buf: RustBuffer) throws -> CommentRow {
    return try FfiConverterTypeCommentRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCommentRow_lower(_ value: CommentRow) -> RustBuffer {
    return FfiConverterTypeCommentRow.lower(value)
}


public struct CommitDetailsPage: Equatable, Hashable {
    public var title: String
    public var description: String
    public var metadata: [CommitMetadataRow]
    public var files: [FileRow]

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(title: String, description: String, metadata: [CommitMetadataRow], files: [FileRow]) {
        self.title = title
        self.description = description
        self.metadata = metadata
        self.files = files
    }




}

#if compiler(>=6)
extension CommitDetailsPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeCommitDetailsPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CommitDetailsPage {
        return
            try CommitDetailsPage(
                title: FfiConverterString.read(from: &buf),
                description: FfiConverterString.read(from: &buf),
                metadata: FfiConverterSequenceTypeCommitMetadataRow.read(from: &buf),
                files: FfiConverterSequenceTypeFileRow.read(from: &buf)
        )
    }

    public static func write(_ value: CommitDetailsPage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterString.write(value.description, into: &buf)
        FfiConverterSequenceTypeCommitMetadataRow.write(value.metadata, into: &buf)
        FfiConverterSequenceTypeFileRow.write(value.files, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCommitDetailsPage_lift(_ buf: RustBuffer) throws -> CommitDetailsPage {
    return try FfiConverterTypeCommitDetailsPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCommitDetailsPage_lower(_ value: CommitDetailsPage) -> RustBuffer {
    return FfiConverterTypeCommitDetailsPage.lower(value)
}


public struct CommitMetadataRow: Equatable, Hashable {
    public var label: String
    public var value: String
    public var monospaced: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(label: String, value: String, monospaced: Bool) {
        self.label = label
        self.value = value
        self.monospaced = monospaced
    }




}

#if compiler(>=6)
extension CommitMetadataRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeCommitMetadataRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CommitMetadataRow {
        return
            try CommitMetadataRow(
                label: FfiConverterString.read(from: &buf),
                value: FfiConverterString.read(from: &buf),
                monospaced: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: CommitMetadataRow, into buf: inout [UInt8]) {
        FfiConverterString.write(value.label, into: &buf)
        FfiConverterString.write(value.value, into: &buf)
        FfiConverterBool.write(value.monospaced, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCommitMetadataRow_lift(_ buf: RustBuffer) throws -> CommitMetadataRow {
    return try FfiConverterTypeCommitMetadataRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCommitMetadataRow_lower(_ value: CommitMetadataRow) -> RustBuffer {
    return FfiConverterTypeCommitMetadataRow.lower(value)
}


public struct CommitPage: Equatable, Hashable {
    public var branches: [String]
    public var commits: [CommitRow]
    public var laneCount: UInt32
    public var hasMore: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(branches: [String], commits: [CommitRow], laneCount: UInt32, hasMore: Bool) {
        self.branches = branches
        self.commits = commits
        self.laneCount = laneCount
        self.hasMore = hasMore
    }




}

#if compiler(>=6)
extension CommitPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeCommitPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CommitPage {
        return
            try CommitPage(
                branches: FfiConverterSequenceString.read(from: &buf),
                commits: FfiConverterSequenceTypeCommitRow.read(from: &buf),
                laneCount: FfiConverterUInt32.read(from: &buf),
                hasMore: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: CommitPage, into buf: inout [UInt8]) {
        FfiConverterSequenceString.write(value.branches, into: &buf)
        FfiConverterSequenceTypeCommitRow.write(value.commits, into: &buf)
        FfiConverterUInt32.write(value.laneCount, into: &buf)
        FfiConverterBool.write(value.hasMore, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCommitPage_lift(_ buf: RustBuffer) throws -> CommitPage {
    return try FfiConverterTypeCommitPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCommitPage_lower(_ value: CommitPage) -> RustBuffer {
    return FfiConverterTypeCommitPage.lower(value)
}


public struct CommitRow: Equatable, Hashable {
    public var sha: String
    public var title: String
    public var detail: String
    public var branchLabel: String?
    public var topLanes: [UInt32]
    public var bottomLanes: [UInt32]
    public var nodeLane: UInt32?
    public var topConnections: [UInt32]
    public var bottomConnections: [UInt32]

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(sha: String, title: String, detail: String, branchLabel: String?, topLanes: [UInt32], bottomLanes: [UInt32], nodeLane: UInt32?, topConnections: [UInt32], bottomConnections: [UInt32]) {
        self.sha = sha
        self.title = title
        self.detail = detail
        self.branchLabel = branchLabel
        self.topLanes = topLanes
        self.bottomLanes = bottomLanes
        self.nodeLane = nodeLane
        self.topConnections = topConnections
        self.bottomConnections = bottomConnections
    }




}

#if compiler(>=6)
extension CommitRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeCommitRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CommitRow {
        return
            try CommitRow(
                sha: FfiConverterString.read(from: &buf),
                title: FfiConverterString.read(from: &buf),
                detail: FfiConverterString.read(from: &buf),
                branchLabel: FfiConverterOptionString.read(from: &buf),
                topLanes: FfiConverterSequenceUInt32.read(from: &buf),
                bottomLanes: FfiConverterSequenceUInt32.read(from: &buf),
                nodeLane: FfiConverterOptionUInt32.read(from: &buf),
                topConnections: FfiConverterSequenceUInt32.read(from: &buf),
                bottomConnections: FfiConverterSequenceUInt32.read(from: &buf)
        )
    }

    public static func write(_ value: CommitRow, into buf: inout [UInt8]) {
        FfiConverterString.write(value.sha, into: &buf)
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterString.write(value.detail, into: &buf)
        FfiConverterOptionString.write(value.branchLabel, into: &buf)
        FfiConverterSequenceUInt32.write(value.topLanes, into: &buf)
        FfiConverterSequenceUInt32.write(value.bottomLanes, into: &buf)
        FfiConverterOptionUInt32.write(value.nodeLane, into: &buf)
        FfiConverterSequenceUInt32.write(value.topConnections, into: &buf)
        FfiConverterSequenceUInt32.write(value.bottomConnections, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCommitRow_lift(_ buf: RustBuffer) throws -> CommitRow {
    return try FfiConverterTypeCommitRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeCommitRow_lower(_ value: CommitRow) -> RustBuffer {
    return FfiConverterTypeCommitRow.lower(value)
}


public struct DiffLine: Equatable, Hashable {
    public var oldNumber: String
    public var newNumber: String
    public var text: String
    public var kind: DiffLineKind

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(oldNumber: String, newNumber: String, text: String, kind: DiffLineKind) {
        self.oldNumber = oldNumber
        self.newNumber = newNumber
        self.text = text
        self.kind = kind
    }




}

#if compiler(>=6)
extension DiffLine: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeDiffLine: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DiffLine {
        return
            try DiffLine(
                oldNumber: FfiConverterString.read(from: &buf),
                newNumber: FfiConverterString.read(from: &buf),
                text: FfiConverterString.read(from: &buf),
                kind: FfiConverterTypeDiffLineKind.read(from: &buf)
        )
    }

    public static func write(_ value: DiffLine, into buf: inout [UInt8]) {
        FfiConverterString.write(value.oldNumber, into: &buf)
        FfiConverterString.write(value.newNumber, into: &buf)
        FfiConverterString.write(value.text, into: &buf)
        FfiConverterTypeDiffLineKind.write(value.kind, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDiffLine_lift(_ buf: RustBuffer) throws -> DiffLine {
    return try FfiConverterTypeDiffLine.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDiffLine_lower(_ value: DiffLine) -> RustBuffer {
    return FfiConverterTypeDiffLine.lower(value)
}


public struct DiffPage: Equatable, Hashable {
    public var title: String
    public var columns: UInt32
    public var lines: [DiffLine]

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(title: String, columns: UInt32, lines: [DiffLine]) {
        self.title = title
        self.columns = columns
        self.lines = lines
    }




}

#if compiler(>=6)
extension DiffPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeDiffPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DiffPage {
        return
            try DiffPage(
                title: FfiConverterString.read(from: &buf),
                columns: FfiConverterUInt32.read(from: &buf),
                lines: FfiConverterSequenceTypeDiffLine.read(from: &buf)
        )
    }

    public static func write(_ value: DiffPage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterUInt32.write(value.columns, into: &buf)
        FfiConverterSequenceTypeDiffLine.write(value.lines, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDiffPage_lift(_ buf: RustBuffer) throws -> DiffPage {
    return try FfiConverterTypeDiffPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDiffPage_lower(_ value: DiffPage) -> RustBuffer {
    return FfiConverterTypeDiffPage.lower(value)
}


public struct FileListPage: Equatable, Hashable {
    public var rows: [FileRow]
    public var hasMore: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(rows: [FileRow], hasMore: Bool) {
        self.rows = rows
        self.hasMore = hasMore
    }




}

#if compiler(>=6)
extension FileListPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeFileListPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FileListPage {
        return
            try FileListPage(
                rows: FfiConverterSequenceTypeFileRow.read(from: &buf),
                hasMore: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: FileListPage, into buf: inout [UInt8]) {
        FfiConverterSequenceTypeFileRow.write(value.rows, into: &buf)
        FfiConverterBool.write(value.hasMore, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeFileListPage_lift(_ buf: RustBuffer) throws -> FileListPage {
    return try FfiConverterTypeFileListPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeFileListPage_lower(_ value: FileListPage) -> RustBuffer {
    return FfiConverterTypeFileListPage.lower(value)
}


public struct FileRow: Equatable, Hashable {
    public var path: String
    public var status: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(path: String, status: String) {
        self.path = path
        self.status = status
    }




}

#if compiler(>=6)
extension FileRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeFileRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FileRow {
        return
            try FileRow(
                path: FfiConverterString.read(from: &buf),
                status: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: FileRow, into buf: inout [UInt8]) {
        FfiConverterString.write(value.path, into: &buf)
        FfiConverterString.write(value.status, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeFileRow_lift(_ buf: RustBuffer) throws -> FileRow {
    return try FfiConverterTypeFileRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeFileRow_lower(_ value: FileRow) -> RustBuffer {
    return FfiConverterTypeFileRow.lower(value)
}


public struct HeatCell: Equatable, Hashable {
    public var level: UInt32
    public var timestamp: Int64

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(level: UInt32, timestamp: Int64) {
        self.level = level
        self.timestamp = timestamp
    }




}

#if compiler(>=6)
extension HeatCell: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeHeatCell: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> HeatCell {
        return
            try HeatCell(
                level: FfiConverterUInt32.read(from: &buf),
                timestamp: FfiConverterInt64.read(from: &buf)
        )
    }

    public static func write(_ value: HeatCell, into buf: inout [UInt8]) {
        FfiConverterUInt32.write(value.level, into: &buf)
        FfiConverterInt64.write(value.timestamp, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeHeatCell_lift(_ buf: RustBuffer) throws -> HeatCell {
    return try FfiConverterTypeHeatCell.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeHeatCell_lower(_ value: HeatCell) -> RustBuffer {
    return FfiConverterTypeHeatCell.lower(value)
}


public struct HomePage: Equatable, Hashable {
    public var serverName: String
    public var activities: [ActivityRow]
    public var heatCells: [HeatCell]
    public var contributionCount: Int64
    public var nextPage: UInt32?

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(serverName: String, activities: [ActivityRow], heatCells: [HeatCell], contributionCount: Int64, nextPage: UInt32?) {
        self.serverName = serverName
        self.activities = activities
        self.heatCells = heatCells
        self.contributionCount = contributionCount
        self.nextPage = nextPage
    }




}

#if compiler(>=6)
extension HomePage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeHomePage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> HomePage {
        return
            try HomePage(
                serverName: FfiConverterString.read(from: &buf),
                activities: FfiConverterSequenceTypeActivityRow.read(from: &buf),
                heatCells: FfiConverterSequenceTypeHeatCell.read(from: &buf),
                contributionCount: FfiConverterInt64.read(from: &buf),
                nextPage: FfiConverterOptionUInt32.read(from: &buf)
        )
    }

    public static func write(_ value: HomePage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.serverName, into: &buf)
        FfiConverterSequenceTypeActivityRow.write(value.activities, into: &buf)
        FfiConverterSequenceTypeHeatCell.write(value.heatCells, into: &buf)
        FfiConverterInt64.write(value.contributionCount, into: &buf)
        FfiConverterOptionUInt32.write(value.nextPage, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeHomePage_lift(_ buf: RustBuffer) throws -> HomePage {
    return try FfiConverterTypeHomePage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeHomePage_lower(_ value: HomePage) -> RustBuffer {
    return FfiConverterTypeHomePage.lower(value)
}


public struct IssueEditorLabel: Equatable, Hashable {
    public var id: Int64
    public var name: String
    public var selected: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(id: Int64, name: String, selected: Bool) {
        self.id = id
        self.name = name
        self.selected = selected
    }




}

#if compiler(>=6)
extension IssueEditorLabel: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIssueEditorLabel: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> IssueEditorLabel {
        return
            try IssueEditorLabel(
                id: FfiConverterInt64.read(from: &buf),
                name: FfiConverterString.read(from: &buf),
                selected: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: IssueEditorLabel, into buf: inout [UInt8]) {
        FfiConverterInt64.write(value.id, into: &buf)
        FfiConverterString.write(value.name, into: &buf)
        FfiConverterBool.write(value.selected, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueEditorLabel_lift(_ buf: RustBuffer) throws -> IssueEditorLabel {
    return try FfiConverterTypeIssueEditorLabel.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueEditorLabel_lower(_ value: IssueEditorLabel) -> RustBuffer {
    return FfiConverterTypeIssueEditorLabel.lower(value)
}


public struct IssueEditorMilestone: Equatable, Hashable {
    public var id: Int64
    public var title: String
    public var selected: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(id: Int64, title: String, selected: Bool) {
        self.id = id
        self.title = title
        self.selected = selected
    }




}

#if compiler(>=6)
extension IssueEditorMilestone: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIssueEditorMilestone: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> IssueEditorMilestone {
        return
            try IssueEditorMilestone(
                id: FfiConverterInt64.read(from: &buf),
                title: FfiConverterString.read(from: &buf),
                selected: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: IssueEditorMilestone, into buf: inout [UInt8]) {
        FfiConverterInt64.write(value.id, into: &buf)
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterBool.write(value.selected, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueEditorMilestone_lift(_ buf: RustBuffer) throws -> IssueEditorMilestone {
    return try FfiConverterTypeIssueEditorMilestone.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueEditorMilestone_lower(_ value: IssueEditorMilestone) -> RustBuffer {
    return FfiConverterTypeIssueEditorMilestone.lower(value)
}


public struct IssueEditorPage: Equatable, Hashable {
    public var title: String
    public var body: String
    public var dueDate: Int64?
    public var closed: Bool
    public var labels: [IssueEditorLabel]
    public var milestones: [IssueEditorMilestone]

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(title: String, body: String, dueDate: Int64?, closed: Bool, labels: [IssueEditorLabel], milestones: [IssueEditorMilestone]) {
        self.title = title
        self.body = body
        self.dueDate = dueDate
        self.closed = closed
        self.labels = labels
        self.milestones = milestones
    }




}

#if compiler(>=6)
extension IssueEditorPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIssueEditorPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> IssueEditorPage {
        return
            try IssueEditorPage(
                title: FfiConverterString.read(from: &buf),
                body: FfiConverterString.read(from: &buf),
                dueDate: FfiConverterOptionInt64.read(from: &buf),
                closed: FfiConverterBool.read(from: &buf),
                labels: FfiConverterSequenceTypeIssueEditorLabel.read(from: &buf),
                milestones: FfiConverterSequenceTypeIssueEditorMilestone.read(from: &buf)
        )
    }

    public static func write(_ value: IssueEditorPage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterString.write(value.body, into: &buf)
        FfiConverterOptionInt64.write(value.dueDate, into: &buf)
        FfiConverterBool.write(value.closed, into: &buf)
        FfiConverterSequenceTypeIssueEditorLabel.write(value.labels, into: &buf)
        FfiConverterSequenceTypeIssueEditorMilestone.write(value.milestones, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueEditorPage_lift(_ buf: RustBuffer) throws -> IssueEditorPage {
    return try FfiConverterTypeIssueEditorPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueEditorPage_lower(_ value: IssueEditorPage) -> RustBuffer {
    return FfiConverterTypeIssueEditorPage.lower(value)
}


public struct IssueFilterOptions: Equatable, Hashable {
    public var milestones: [String]
    public var labels: [String]
    public var unavailableLabels: [String]
    public var selectedMilestone: String
    public var selectedLabels: [String]
    public var searchText: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(milestones: [String], labels: [String], unavailableLabels: [String], selectedMilestone: String, selectedLabels: [String], searchText: String) {
        self.milestones = milestones
        self.labels = labels
        self.unavailableLabels = unavailableLabels
        self.selectedMilestone = selectedMilestone
        self.selectedLabels = selectedLabels
        self.searchText = searchText
    }




}

#if compiler(>=6)
extension IssueFilterOptions: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIssueFilterOptions: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> IssueFilterOptions {
        return
            try IssueFilterOptions(
                milestones: FfiConverterSequenceString.read(from: &buf),
                labels: FfiConverterSequenceString.read(from: &buf),
                unavailableLabels: FfiConverterSequenceString.read(from: &buf),
                selectedMilestone: FfiConverterString.read(from: &buf),
                selectedLabels: FfiConverterSequenceString.read(from: &buf),
                searchText: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: IssueFilterOptions, into buf: inout [UInt8]) {
        FfiConverterSequenceString.write(value.milestones, into: &buf)
        FfiConverterSequenceString.write(value.labels, into: &buf)
        FfiConverterSequenceString.write(value.unavailableLabels, into: &buf)
        FfiConverterString.write(value.selectedMilestone, into: &buf)
        FfiConverterSequenceString.write(value.selectedLabels, into: &buf)
        FfiConverterString.write(value.searchText, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueFilterOptions_lift(_ buf: RustBuffer) throws -> IssueFilterOptions {
    return try FfiConverterTypeIssueFilterOptions.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueFilterOptions_lower(_ value: IssueFilterOptions) -> RustBuffer {
    return FfiConverterTypeIssueFilterOptions.lower(value)
}


public struct IssueListPage: Equatable, Hashable {
    public var rows: [IssueRow]
    public var hasMore: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(rows: [IssueRow], hasMore: Bool) {
        self.rows = rows
        self.hasMore = hasMore
    }




}

#if compiler(>=6)
extension IssueListPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIssueListPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> IssueListPage {
        return
            try IssueListPage(
                rows: FfiConverterSequenceTypeIssueRow.read(from: &buf),
                hasMore: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: IssueListPage, into buf: inout [UInt8]) {
        FfiConverterSequenceTypeIssueRow.write(value.rows, into: &buf)
        FfiConverterBool.write(value.hasMore, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueListPage_lift(_ buf: RustBuffer) throws -> IssueListPage {
    return try FfiConverterTypeIssueListPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueListPage_lower(_ value: IssueListPage) -> RustBuffer {
    return FfiConverterTypeIssueListPage.lower(value)
}


public struct IssuePage: Equatable, Hashable {
    public var title: String
    public var state: WorkItemState
    public var meta: String
    public var milestone: String
    public var labels: [LabelRow]
    public var body: String
    public var comments: [CommentRow]
    public var hasMore: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(title: String, state: WorkItemState, meta: String, milestone: String, labels: [LabelRow], body: String, comments: [CommentRow], hasMore: Bool) {
        self.title = title
        self.state = state
        self.meta = meta
        self.milestone = milestone
        self.labels = labels
        self.body = body
        self.comments = comments
        self.hasMore = hasMore
    }




}

#if compiler(>=6)
extension IssuePage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIssuePage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> IssuePage {
        return
            try IssuePage(
                title: FfiConverterString.read(from: &buf),
                state: FfiConverterTypeWorkItemState.read(from: &buf),
                meta: FfiConverterString.read(from: &buf),
                milestone: FfiConverterString.read(from: &buf),
                labels: FfiConverterSequenceTypeLabelRow.read(from: &buf),
                body: FfiConverterString.read(from: &buf),
                comments: FfiConverterSequenceTypeCommentRow.read(from: &buf),
                hasMore: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: IssuePage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterTypeWorkItemState.write(value.state, into: &buf)
        FfiConverterString.write(value.meta, into: &buf)
        FfiConverterString.write(value.milestone, into: &buf)
        FfiConverterSequenceTypeLabelRow.write(value.labels, into: &buf)
        FfiConverterString.write(value.body, into: &buf)
        FfiConverterSequenceTypeCommentRow.write(value.comments, into: &buf)
        FfiConverterBool.write(value.hasMore, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssuePage_lift(_ buf: RustBuffer) throws -> IssuePage {
    return try FfiConverterTypeIssuePage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssuePage_lower(_ value: IssuePage) -> RustBuffer {
    return FfiConverterTypeIssuePage.lower(value)
}


public struct IssueRow: Equatable, Hashable {
    public var number: Int64
    public var state: WorkItemState
    public var title: String
    public var summary: String
    public var meta: String
    public var milestone: String
    public var labels: [LabelRow]

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(number: Int64, state: WorkItemState, title: String, summary: String, meta: String, milestone: String, labels: [LabelRow]) {
        self.number = number
        self.state = state
        self.title = title
        self.summary = summary
        self.meta = meta
        self.milestone = milestone
        self.labels = labels
    }




}

#if compiler(>=6)
extension IssueRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeIssueRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> IssueRow {
        return
            try IssueRow(
                number: FfiConverterInt64.read(from: &buf),
                state: FfiConverterTypeWorkItemState.read(from: &buf),
                title: FfiConverterString.read(from: &buf),
                summary: FfiConverterString.read(from: &buf),
                meta: FfiConverterString.read(from: &buf),
                milestone: FfiConverterString.read(from: &buf),
                labels: FfiConverterSequenceTypeLabelRow.read(from: &buf)
        )
    }

    public static func write(_ value: IssueRow, into buf: inout [UInt8]) {
        FfiConverterInt64.write(value.number, into: &buf)
        FfiConverterTypeWorkItemState.write(value.state, into: &buf)
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterString.write(value.summary, into: &buf)
        FfiConverterString.write(value.meta, into: &buf)
        FfiConverterString.write(value.milestone, into: &buf)
        FfiConverterSequenceTypeLabelRow.write(value.labels, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueRow_lift(_ buf: RustBuffer) throws -> IssueRow {
    return try FfiConverterTypeIssueRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeIssueRow_lower(_ value: IssueRow) -> RustBuffer {
    return FfiConverterTypeIssueRow.lower(value)
}


public struct LabelRow: Equatable, Hashable {
    public var name: String
    public var color: String
    public var light: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(name: String, color: String, light: Bool) {
        self.name = name
        self.color = color
        self.light = light
    }




}

#if compiler(>=6)
extension LabelRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeLabelRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LabelRow {
        return
            try LabelRow(
                name: FfiConverterString.read(from: &buf),
                color: FfiConverterString.read(from: &buf),
                light: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: LabelRow, into buf: inout [UInt8]) {
        FfiConverterString.write(value.name, into: &buf)
        FfiConverterString.write(value.color, into: &buf)
        FfiConverterBool.write(value.light, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeLabelRow_lift(_ buf: RustBuffer) throws -> LabelRow {
    return try FfiConverterTypeLabelRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeLabelRow_lower(_ value: LabelRow) -> RustBuffer {
    return FfiConverterTypeLabelRow.lower(value)
}


public struct MilestoneEditorPage: Equatable, Hashable {
    public var title: String
    public var description: String
    public var dueDate: Int64?
    public var closed: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(title: String, description: String, dueDate: Int64?, closed: Bool) {
        self.title = title
        self.description = description
        self.dueDate = dueDate
        self.closed = closed
    }




}

#if compiler(>=6)
extension MilestoneEditorPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeMilestoneEditorPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MilestoneEditorPage {
        return
            try MilestoneEditorPage(
                title: FfiConverterString.read(from: &buf),
                description: FfiConverterString.read(from: &buf),
                dueDate: FfiConverterOptionInt64.read(from: &buf),
                closed: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: MilestoneEditorPage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterString.write(value.description, into: &buf)
        FfiConverterOptionInt64.write(value.dueDate, into: &buf)
        FfiConverterBool.write(value.closed, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMilestoneEditorPage_lift(_ buf: RustBuffer) throws -> MilestoneEditorPage {
    return try FfiConverterTypeMilestoneEditorPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMilestoneEditorPage_lower(_ value: MilestoneEditorPage) -> RustBuffer {
    return FfiConverterTypeMilestoneEditorPage.lower(value)
}


public struct MilestoneListPage: Equatable, Hashable {
    public var rows: [MilestoneRow]
    public var hasMore: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(rows: [MilestoneRow], hasMore: Bool) {
        self.rows = rows
        self.hasMore = hasMore
    }




}

#if compiler(>=6)
extension MilestoneListPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeMilestoneListPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MilestoneListPage {
        return
            try MilestoneListPage(
                rows: FfiConverterSequenceTypeMilestoneRow.read(from: &buf),
                hasMore: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: MilestoneListPage, into buf: inout [UInt8]) {
        FfiConverterSequenceTypeMilestoneRow.write(value.rows, into: &buf)
        FfiConverterBool.write(value.hasMore, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMilestoneListPage_lift(_ buf: RustBuffer) throws -> MilestoneListPage {
    return try FfiConverterTypeMilestoneListPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMilestoneListPage_lower(_ value: MilestoneListPage) -> RustBuffer {
    return FfiConverterTypeMilestoneListPage.lower(value)
}


public struct MilestonePage: Equatable, Hashable {
    public var milestone: MilestoneRow
    public var issues: [IssueRow]
    public var pulls: [PullRow]
    public var hasMore: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(milestone: MilestoneRow, issues: [IssueRow], pulls: [PullRow], hasMore: Bool) {
        self.milestone = milestone
        self.issues = issues
        self.pulls = pulls
        self.hasMore = hasMore
    }




}

#if compiler(>=6)
extension MilestonePage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeMilestonePage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MilestonePage {
        return
            try MilestonePage(
                milestone: FfiConverterTypeMilestoneRow.read(from: &buf),
                issues: FfiConverterSequenceTypeIssueRow.read(from: &buf),
                pulls: FfiConverterSequenceTypePullRow.read(from: &buf),
                hasMore: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: MilestonePage, into buf: inout [UInt8]) {
        FfiConverterTypeMilestoneRow.write(value.milestone, into: &buf)
        FfiConverterSequenceTypeIssueRow.write(value.issues, into: &buf)
        FfiConverterSequenceTypePullRow.write(value.pulls, into: &buf)
        FfiConverterBool.write(value.hasMore, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMilestonePage_lift(_ buf: RustBuffer) throws -> MilestonePage {
    return try FfiConverterTypeMilestonePage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMilestonePage_lower(_ value: MilestonePage) -> RustBuffer {
    return FfiConverterTypeMilestonePage.lower(value)
}


public struct MilestoneRow: Equatable, Hashable {
    public var id: Int64
    public var state: WorkItemState
    public var title: String
    public var description: String
    public var meta: String
    public var hasIssues: Bool
    public var progress: Double
    public var progressAccessibility: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(id: Int64, state: WorkItemState, title: String, description: String, meta: String, hasIssues: Bool, progress: Double, progressAccessibility: String) {
        self.id = id
        self.state = state
        self.title = title
        self.description = description
        self.meta = meta
        self.hasIssues = hasIssues
        self.progress = progress
        self.progressAccessibility = progressAccessibility
    }




}

#if compiler(>=6)
extension MilestoneRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeMilestoneRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MilestoneRow {
        return
            try MilestoneRow(
                id: FfiConverterInt64.read(from: &buf),
                state: FfiConverterTypeWorkItemState.read(from: &buf),
                title: FfiConverterString.read(from: &buf),
                description: FfiConverterString.read(from: &buf),
                meta: FfiConverterString.read(from: &buf),
                hasIssues: FfiConverterBool.read(from: &buf),
                progress: FfiConverterDouble.read(from: &buf),
                progressAccessibility: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: MilestoneRow, into buf: inout [UInt8]) {
        FfiConverterInt64.write(value.id, into: &buf)
        FfiConverterTypeWorkItemState.write(value.state, into: &buf)
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterString.write(value.description, into: &buf)
        FfiConverterString.write(value.meta, into: &buf)
        FfiConverterBool.write(value.hasIssues, into: &buf)
        FfiConverterDouble.write(value.progress, into: &buf)
        FfiConverterString.write(value.progressAccessibility, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMilestoneRow_lift(_ buf: RustBuffer) throws -> MilestoneRow {
    return try FfiConverterTypeMilestoneRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeMilestoneRow_lower(_ value: MilestoneRow) -> RustBuffer {
    return FfiConverterTypeMilestoneRow.lower(value)
}


public struct NotificationListPage: Equatable, Hashable {
    public var rows: [NotificationRow]
    public var hasMore: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(rows: [NotificationRow], hasMore: Bool) {
        self.rows = rows
        self.hasMore = hasMore
    }




}

#if compiler(>=6)
extension NotificationListPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNotificationListPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationListPage {
        return
            try NotificationListPage(
                rows: FfiConverterSequenceTypeNotificationRow.read(from: &buf),
                hasMore: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: NotificationListPage, into buf: inout [UInt8]) {
        FfiConverterSequenceTypeNotificationRow.write(value.rows, into: &buf)
        FfiConverterBool.write(value.hasMore, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNotificationListPage_lift(_ buf: RustBuffer) throws -> NotificationListPage {
    return try FfiConverterTypeNotificationListPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNotificationListPage_lower(_ value: NotificationListPage) -> RustBuffer {
    return FfiConverterTypeNotificationListPage.lower(value)
}


public struct NotificationRow: Equatable, Hashable {
    public var id: Int64
    public var serverId: String
    public var title: String
    public var detail: String
    public var meta: String
    public var unread: Bool
    public var target: ActivityTargetKind
    public var owner: String
    public var repository: String
    public var number: Int64
    public var sha: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(id: Int64, serverId: String, title: String, detail: String, meta: String, unread: Bool, target: ActivityTargetKind, owner: String, repository: String, number: Int64, sha: String) {
        self.id = id
        self.serverId = serverId
        self.title = title
        self.detail = detail
        self.meta = meta
        self.unread = unread
        self.target = target
        self.owner = owner
        self.repository = repository
        self.number = number
        self.sha = sha
    }




}

#if compiler(>=6)
extension NotificationRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNotificationRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationRow {
        return
            try NotificationRow(
                id: FfiConverterInt64.read(from: &buf),
                serverId: FfiConverterString.read(from: &buf),
                title: FfiConverterString.read(from: &buf),
                detail: FfiConverterString.read(from: &buf),
                meta: FfiConverterString.read(from: &buf),
                unread: FfiConverterBool.read(from: &buf),
                target: FfiConverterTypeActivityTargetKind.read(from: &buf),
                owner: FfiConverterString.read(from: &buf),
                repository: FfiConverterString.read(from: &buf),
                number: FfiConverterInt64.read(from: &buf),
                sha: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: NotificationRow, into buf: inout [UInt8]) {
        FfiConverterInt64.write(value.id, into: &buf)
        FfiConverterString.write(value.serverId, into: &buf)
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterString.write(value.detail, into: &buf)
        FfiConverterString.write(value.meta, into: &buf)
        FfiConverterBool.write(value.unread, into: &buf)
        FfiConverterTypeActivityTargetKind.write(value.target, into: &buf)
        FfiConverterString.write(value.owner, into: &buf)
        FfiConverterString.write(value.repository, into: &buf)
        FfiConverterInt64.write(value.number, into: &buf)
        FfiConverterString.write(value.sha, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNotificationRow_lift(_ buf: RustBuffer) throws -> NotificationRow {
    return try FfiConverterTypeNotificationRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNotificationRow_lower(_ value: NotificationRow) -> RustBuffer {
    return FfiConverterTypeNotificationRow.lower(value)
}


public struct PullFilterOptions: Equatable, Hashable {
    public var milestones: [String]
    public var selectedMilestone: String
    public var searchText: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(milestones: [String], selectedMilestone: String, searchText: String) {
        self.milestones = milestones
        self.selectedMilestone = selectedMilestone
        self.searchText = searchText
    }




}

#if compiler(>=6)
extension PullFilterOptions: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypePullFilterOptions: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PullFilterOptions {
        return
            try PullFilterOptions(
                milestones: FfiConverterSequenceString.read(from: &buf),
                selectedMilestone: FfiConverterString.read(from: &buf),
                searchText: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: PullFilterOptions, into buf: inout [UInt8]) {
        FfiConverterSequenceString.write(value.milestones, into: &buf)
        FfiConverterString.write(value.selectedMilestone, into: &buf)
        FfiConverterString.write(value.searchText, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePullFilterOptions_lift(_ buf: RustBuffer) throws -> PullFilterOptions {
    return try FfiConverterTypePullFilterOptions.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePullFilterOptions_lower(_ value: PullFilterOptions) -> RustBuffer {
    return FfiConverterTypePullFilterOptions.lower(value)
}


public struct PullListPage: Equatable, Hashable {
    public var rows: [PullRow]
    public var hasMore: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(rows: [PullRow], hasMore: Bool) {
        self.rows = rows
        self.hasMore = hasMore
    }




}

#if compiler(>=6)
extension PullListPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypePullListPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PullListPage {
        return
            try PullListPage(
                rows: FfiConverterSequenceTypePullRow.read(from: &buf),
                hasMore: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: PullListPage, into buf: inout [UInt8]) {
        FfiConverterSequenceTypePullRow.write(value.rows, into: &buf)
        FfiConverterBool.write(value.hasMore, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePullListPage_lift(_ buf: RustBuffer) throws -> PullListPage {
    return try FfiConverterTypePullListPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePullListPage_lower(_ value: PullListPage) -> RustBuffer {
    return FfiConverterTypePullListPage.lower(value)
}


public struct PullPage: Equatable, Hashable {
    public var title: String
    public var state: WorkItemState
    public var meta: String
    public var body: String
    public var filesRef: String
    public var files: [FileRow]
    public var comments: [CommentRow]
    public var hasMore: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(title: String, state: WorkItemState, meta: String, body: String, filesRef: String, files: [FileRow], comments: [CommentRow], hasMore: Bool) {
        self.title = title
        self.state = state
        self.meta = meta
        self.body = body
        self.filesRef = filesRef
        self.files = files
        self.comments = comments
        self.hasMore = hasMore
    }




}

#if compiler(>=6)
extension PullPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypePullPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PullPage {
        return
            try PullPage(
                title: FfiConverterString.read(from: &buf),
                state: FfiConverterTypeWorkItemState.read(from: &buf),
                meta: FfiConverterString.read(from: &buf),
                body: FfiConverterString.read(from: &buf),
                filesRef: FfiConverterString.read(from: &buf),
                files: FfiConverterSequenceTypeFileRow.read(from: &buf),
                comments: FfiConverterSequenceTypeCommentRow.read(from: &buf),
                hasMore: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: PullPage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterTypeWorkItemState.write(value.state, into: &buf)
        FfiConverterString.write(value.meta, into: &buf)
        FfiConverterString.write(value.body, into: &buf)
        FfiConverterString.write(value.filesRef, into: &buf)
        FfiConverterSequenceTypeFileRow.write(value.files, into: &buf)
        FfiConverterSequenceTypeCommentRow.write(value.comments, into: &buf)
        FfiConverterBool.write(value.hasMore, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePullPage_lift(_ buf: RustBuffer) throws -> PullPage {
    return try FfiConverterTypePullPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePullPage_lower(_ value: PullPage) -> RustBuffer {
    return FfiConverterTypePullPage.lower(value)
}


public struct PullRow: Equatable, Hashable {
    public var number: Int64
    public var owner: String
    public var repository: String
    public var state: WorkItemState
    public var title: String
    public var summary: String
    public var meta: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(number: Int64, owner: String, repository: String, state: WorkItemState, title: String, summary: String, meta: String) {
        self.number = number
        self.owner = owner
        self.repository = repository
        self.state = state
        self.title = title
        self.summary = summary
        self.meta = meta
    }




}

#if compiler(>=6)
extension PullRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypePullRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PullRow {
        return
            try PullRow(
                number: FfiConverterInt64.read(from: &buf),
                owner: FfiConverterString.read(from: &buf),
                repository: FfiConverterString.read(from: &buf),
                state: FfiConverterTypeWorkItemState.read(from: &buf),
                title: FfiConverterString.read(from: &buf),
                summary: FfiConverterString.read(from: &buf),
                meta: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: PullRow, into buf: inout [UInt8]) {
        FfiConverterInt64.write(value.number, into: &buf)
        FfiConverterString.write(value.owner, into: &buf)
        FfiConverterString.write(value.repository, into: &buf)
        FfiConverterTypeWorkItemState.write(value.state, into: &buf)
        FfiConverterString.write(value.title, into: &buf)
        FfiConverterString.write(value.summary, into: &buf)
        FfiConverterString.write(value.meta, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePullRow_lift(_ buf: RustBuffer) throws -> PullRow {
    return try FfiConverterTypePullRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypePullRow_lower(_ value: PullRow) -> RustBuffer {
    return FfiConverterTypePullRow.lower(value)
}


public struct RepositoryContentRow: Equatable, Hashable {
    public var name: String
    public var path: String
    public var kind: RepositoryContentKind
    public var size: Int64

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(name: String, path: String, kind: RepositoryContentKind, size: Int64) {
        self.name = name
        self.path = path
        self.kind = kind
        self.size = size
    }




}

#if compiler(>=6)
extension RepositoryContentRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeRepositoryContentRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RepositoryContentRow {
        return
            try RepositoryContentRow(
                name: FfiConverterString.read(from: &buf),
                path: FfiConverterString.read(from: &buf),
                kind: FfiConverterTypeRepositoryContentKind.read(from: &buf),
                size: FfiConverterInt64.read(from: &buf)
        )
    }

    public static func write(_ value: RepositoryContentRow, into buf: inout [UInt8]) {
        FfiConverterString.write(value.name, into: &buf)
        FfiConverterString.write(value.path, into: &buf)
        FfiConverterTypeRepositoryContentKind.write(value.kind, into: &buf)
        FfiConverterInt64.write(value.size, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryContentRow_lift(_ buf: RustBuffer) throws -> RepositoryContentRow {
    return try FfiConverterTypeRepositoryContentRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryContentRow_lower(_ value: RepositoryContentRow) -> RustBuffer {
    return FfiConverterTypeRepositoryContentRow.lower(value)
}


public struct RepositoryFilePage: Equatable, Hashable {
    public var name: String
    public var kind: RepositoryFileKind
    public var language: String
    public var text: String
    public var data: Data

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(name: String, kind: RepositoryFileKind, language: String, text: String, data: Data) {
        self.name = name
        self.kind = kind
        self.language = language
        self.text = text
        self.data = data
    }




}

#if compiler(>=6)
extension RepositoryFilePage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeRepositoryFilePage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RepositoryFilePage {
        return
            try RepositoryFilePage(
                name: FfiConverterString.read(from: &buf),
                kind: FfiConverterTypeRepositoryFileKind.read(from: &buf),
                language: FfiConverterString.read(from: &buf),
                text: FfiConverterString.read(from: &buf),
                data: FfiConverterData.read(from: &buf)
        )
    }

    public static func write(_ value: RepositoryFilePage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.name, into: &buf)
        FfiConverterTypeRepositoryFileKind.write(value.kind, into: &buf)
        FfiConverterString.write(value.language, into: &buf)
        FfiConverterString.write(value.text, into: &buf)
        FfiConverterData.write(value.data, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryFilePage_lift(_ buf: RustBuffer) throws -> RepositoryFilePage {
    return try FfiConverterTypeRepositoryFilePage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryFilePage_lower(_ value: RepositoryFilePage) -> RustBuffer {
    return FfiConverterTypeRepositoryFilePage.lower(value)
}


public struct RepositoryListPage: Equatable, Hashable {
    public var rows: [RepositoryRow]
    public var hasMore: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(rows: [RepositoryRow], hasMore: Bool) {
        self.rows = rows
        self.hasMore = hasMore
    }




}

#if compiler(>=6)
extension RepositoryListPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeRepositoryListPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RepositoryListPage {
        return
            try RepositoryListPage(
                rows: FfiConverterSequenceTypeRepositoryRow.read(from: &buf),
                hasMore: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: RepositoryListPage, into buf: inout [UInt8]) {
        FfiConverterSequenceTypeRepositoryRow.write(value.rows, into: &buf)
        FfiConverterBool.write(value.hasMore, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryListPage_lift(_ buf: RustBuffer) throws -> RepositoryListPage {
    return try FfiConverterTypeRepositoryListPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryListPage_lower(_ value: RepositoryListPage) -> RustBuffer {
    return FfiConverterTypeRepositoryListPage.lower(value)
}


public struct RepositoryRow: Equatable, Hashable {
    public var name: String
    public var owner: String
    public var description: String
    public var meta: String
    public var favorite: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(name: String, owner: String, description: String, meta: String, favorite: Bool) {
        self.name = name
        self.owner = owner
        self.description = description
        self.meta = meta
        self.favorite = favorite
    }




}

#if compiler(>=6)
extension RepositoryRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeRepositoryRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RepositoryRow {
        return
            try RepositoryRow(
                name: FfiConverterString.read(from: &buf),
                owner: FfiConverterString.read(from: &buf),
                description: FfiConverterString.read(from: &buf),
                meta: FfiConverterString.read(from: &buf),
                favorite: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: RepositoryRow, into buf: inout [UInt8]) {
        FfiConverterString.write(value.name, into: &buf)
        FfiConverterString.write(value.owner, into: &buf)
        FfiConverterString.write(value.description, into: &buf)
        FfiConverterString.write(value.meta, into: &buf)
        FfiConverterBool.write(value.favorite, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryRow_lift(_ buf: RustBuffer) throws -> RepositoryRow {
    return try FfiConverterTypeRepositoryRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryRow_lower(_ value: RepositoryRow) -> RustBuffer {
    return FfiConverterTypeRepositoryRow.lower(value)
}


public struct ServerActivityPage: Equatable, Hashable {
    public var rows: [ActivityRow]
    public var hasMore: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(rows: [ActivityRow], hasMore: Bool) {
        self.rows = rows
        self.hasMore = hasMore
    }




}

#if compiler(>=6)
extension ServerActivityPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeServerActivityPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ServerActivityPage {
        return
            try ServerActivityPage(
                rows: FfiConverterSequenceTypeActivityRow.read(from: &buf),
                hasMore: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: ServerActivityPage, into buf: inout [UInt8]) {
        FfiConverterSequenceTypeActivityRow.write(value.rows, into: &buf)
        FfiConverterBool.write(value.hasMore, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeServerActivityPage_lift(_ buf: RustBuffer) throws -> ServerActivityPage {
    return try FfiConverterTypeServerActivityPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeServerActivityPage_lower(_ value: ServerActivityPage) -> RustBuffer {
    return FfiConverterTypeServerActivityPage.lower(value)
}


public struct ServerEditor: Equatable, Hashable {
    public var name: String
    public var url: String
    public var provider: ServerProvider

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(name: String, url: String, provider: ServerProvider) {
        self.name = name
        self.url = url
        self.provider = provider
    }




}

#if compiler(>=6)
extension ServerEditor: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeServerEditor: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ServerEditor {
        return
            try ServerEditor(
                name: FfiConverterString.read(from: &buf),
                url: FfiConverterString.read(from: &buf),
                provider: FfiConverterTypeServerProvider.read(from: &buf)
        )
    }

    public static func write(_ value: ServerEditor, into buf: inout [UInt8]) {
        FfiConverterString.write(value.name, into: &buf)
        FfiConverterString.write(value.url, into: &buf)
        FfiConverterTypeServerProvider.write(value.provider, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeServerEditor_lift(_ buf: RustBuffer) throws -> ServerEditor {
    return try FfiConverterTypeServerEditor.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeServerEditor_lower(_ value: ServerEditor) -> RustBuffer {
    return FfiConverterTypeServerEditor.lower(value)
}


public struct ServerRow: Equatable, Hashable {
    public var id: String
    public var name: String
    public var url: String

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(id: String, name: String, url: String) {
        self.id = id
        self.name = name
        self.url = url
    }




}

#if compiler(>=6)
extension ServerRow: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeServerRow: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ServerRow {
        return
            try ServerRow(
                id: FfiConverterString.read(from: &buf),
                name: FfiConverterString.read(from: &buf),
                url: FfiConverterString.read(from: &buf)
        )
    }

    public static func write(_ value: ServerRow, into buf: inout [UInt8]) {
        FfiConverterString.write(value.id, into: &buf)
        FfiConverterString.write(value.name, into: &buf)
        FfiConverterString.write(value.url, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeServerRow_lift(_ buf: RustBuffer) throws -> ServerRow {
    return try FfiConverterTypeServerRow.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeServerRow_lower(_ value: ServerRow) -> RustBuffer {
    return FfiConverterTypeServerRow.lower(value)
}


public struct Settings: Equatable, Hashable {
    public var issueStatus: String
    public var pullStatus: String
    public var appearance: UInt32
    public var notificationsEnabled: Bool

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(issueStatus: String, pullStatus: String, appearance: UInt32, notificationsEnabled: Bool) {
        self.issueStatus = issueStatus
        self.pullStatus = pullStatus
        self.appearance = appearance
        self.notificationsEnabled = notificationsEnabled
    }




}

#if compiler(>=6)
extension Settings: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeSettings: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Settings {
        return
            try Settings(
                issueStatus: FfiConverterString.read(from: &buf),
                pullStatus: FfiConverterString.read(from: &buf),
                appearance: FfiConverterUInt32.read(from: &buf),
                notificationsEnabled: FfiConverterBool.read(from: &buf)
        )
    }

    public static func write(_ value: Settings, into buf: inout [UInt8]) {
        FfiConverterString.write(value.issueStatus, into: &buf)
        FfiConverterString.write(value.pullStatus, into: &buf)
        FfiConverterUInt32.write(value.appearance, into: &buf)
        FfiConverterBool.write(value.notificationsEnabled, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSettings_lift(_ buf: RustBuffer) throws -> Settings {
    return try FfiConverterTypeSettings.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeSettings_lower(_ value: Settings) -> RustBuffer {
    return FfiConverterTypeSettings.lower(value)
}


public struct WidgetActivityPage: Equatable, Hashable {
    public var serverName: String
    public var rows: [ActivityRow]

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(serverName: String, rows: [ActivityRow]) {
        self.serverName = serverName
        self.rows = rows
    }




}

#if compiler(>=6)
extension WidgetActivityPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeWidgetActivityPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WidgetActivityPage {
        return
            try WidgetActivityPage(
                serverName: FfiConverterString.read(from: &buf),
                rows: FfiConverterSequenceTypeActivityRow.read(from: &buf)
        )
    }

    public static func write(_ value: WidgetActivityPage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.serverName, into: &buf)
        FfiConverterSequenceTypeActivityRow.write(value.rows, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeWidgetActivityPage_lift(_ buf: RustBuffer) throws -> WidgetActivityPage {
    return try FfiConverterTypeWidgetActivityPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeWidgetActivityPage_lower(_ value: WidgetActivityPage) -> RustBuffer {
    return FfiConverterTypeWidgetActivityPage.lower(value)
}


public struct WidgetPullPage: Equatable, Hashable {
    public var serverName: String
    public var rows: [PullRow]

    // Default memberwise initializers are never public by default, so we
    // declare one manually.
    public init(serverName: String, rows: [PullRow]) {
        self.serverName = serverName
        self.rows = rows
    }




}

#if compiler(>=6)
extension WidgetPullPage: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeWidgetPullPage: FfiConverterRustBuffer {
    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WidgetPullPage {
        return
            try WidgetPullPage(
                serverName: FfiConverterString.read(from: &buf),
                rows: FfiConverterSequenceTypePullRow.read(from: &buf)
        )
    }

    public static func write(_ value: WidgetPullPage, into buf: inout [UInt8]) {
        FfiConverterString.write(value.serverName, into: &buf)
        FfiConverterSequenceTypePullRow.write(value.rows, into: &buf)
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeWidgetPullPage_lift(_ buf: RustBuffer) throws -> WidgetPullPage {
    return try FfiConverterTypeWidgetPullPage.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeWidgetPullPage_lower(_ value: WidgetPullPage) -> RustBuffer {
    return FfiConverterTypeWidgetPullPage.lower(value)
}



public enum ActivityIcon: Equatable, Hashable {

    case repository
    case issue
    case pullRequest
    case branch
    case tag
    case push
    case release





}

#if compiler(>=6)
extension ActivityIcon: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeActivityIcon: FfiConverterRustBuffer {
    typealias SwiftType = ActivityIcon

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ActivityIcon {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        case 1: return .repository

        case 2: return .issue

        case 3: return .pullRequest

        case 4: return .branch

        case 5: return .tag

        case 6: return .push

        case 7: return .release

        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: ActivityIcon, into buf: inout [UInt8]) {
        switch value {


        case .repository:
            writeInt(&buf, Int32(1))


        case .issue:
            writeInt(&buf, Int32(2))


        case .pullRequest:
            writeInt(&buf, Int32(3))


        case .branch:
            writeInt(&buf, Int32(4))


        case .tag:
            writeInt(&buf, Int32(5))


        case .push:
            writeInt(&buf, Int32(6))


        case .release:
            writeInt(&buf, Int32(7))

        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeActivityIcon_lift(_ buf: RustBuffer) throws -> ActivityIcon {
    return try FfiConverterTypeActivityIcon.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeActivityIcon_lower(_ value: ActivityIcon) -> RustBuffer {
    return FfiConverterTypeActivityIcon.lower(value)
}




public enum ActivityTargetKind: Equatable, Hashable {

    case none
    case repository
    case issue
    case pullRequest
    case commit





}

#if compiler(>=6)
extension ActivityTargetKind: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeActivityTargetKind: FfiConverterRustBuffer {
    typealias SwiftType = ActivityTargetKind

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ActivityTargetKind {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        case 1: return .none

        case 2: return .repository

        case 3: return .issue

        case 4: return .pullRequest

        case 5: return .commit

        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: ActivityTargetKind, into buf: inout [UInt8]) {
        switch value {


        case .none:
            writeInt(&buf, Int32(1))


        case .repository:
            writeInt(&buf, Int32(2))


        case .issue:
            writeInt(&buf, Int32(3))


        case .pullRequest:
            writeInt(&buf, Int32(4))


        case .commit:
            writeInt(&buf, Int32(5))

        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeActivityTargetKind_lift(_ buf: RustBuffer) throws -> ActivityTargetKind {
    return try FfiConverterTypeActivityTargetKind.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeActivityTargetKind_lower(_ value: ActivityTargetKind) -> RustBuffer {
    return FfiConverterTypeActivityTargetKind.lower(value)
}




public enum DiffLineKind: Equatable, Hashable {

    case addition
    case removal
    case hunk
    case header
    case context





}

#if compiler(>=6)
extension DiffLineKind: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeDiffLineKind: FfiConverterRustBuffer {
    typealias SwiftType = DiffLineKind

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DiffLineKind {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        case 1: return .addition

        case 2: return .removal

        case 3: return .hunk

        case 4: return .header

        case 5: return .context

        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: DiffLineKind, into buf: inout [UInt8]) {
        switch value {


        case .addition:
            writeInt(&buf, Int32(1))


        case .removal:
            writeInt(&buf, Int32(2))


        case .hunk:
            writeInt(&buf, Int32(3))


        case .header:
            writeInt(&buf, Int32(4))


        case .context:
            writeInt(&buf, Int32(5))

        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDiffLineKind_lift(_ buf: RustBuffer) throws -> DiffLineKind {
    return try FfiConverterTypeDiffLineKind.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeDiffLineKind_lower(_ value: DiffLineKind) -> RustBuffer {
    return FfiConverterTypeDiffLineKind.lower(value)
}



public
enum GotchaError: Swift.Error, Equatable, Hashable, Foundation.LocalizedError {



    case Message(message: String
    )






    public var errorDescription: String? {
        String(reflecting: self)
    }

}

#if compiler(>=6)
extension GotchaError: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeGotchaError: FfiConverterRustBuffer {
    typealias SwiftType = GotchaError

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GotchaError {
        let variant: Int32 = try readInt(&buf)
        switch variant {




        case 1: return .Message(
            message: try FfiConverterString.read(from: &buf)
            )

         default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: GotchaError, into buf: inout [UInt8]) {
        switch value {





        case let .Message(message):
            writeInt(&buf, Int32(1))
            FfiConverterString.write(message, into: &buf)

        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGotchaError_lift(_ buf: RustBuffer) throws -> GotchaError {
    return try FfiConverterTypeGotchaError.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeGotchaError_lower(_ value: GotchaError) -> RustBuffer {
    return FfiConverterTypeGotchaError.lower(value)
}



public enum HomeActivityFilter: Equatable, Hashable {

    case all
    case issues
    case pullRequests





}

#if compiler(>=6)
extension HomeActivityFilter: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeHomeActivityFilter: FfiConverterRustBuffer {
    typealias SwiftType = HomeActivityFilter

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> HomeActivityFilter {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        case 1: return .all

        case 2: return .issues

        case 3: return .pullRequests

        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: HomeActivityFilter, into buf: inout [UInt8]) {
        switch value {


        case .all:
            writeInt(&buf, Int32(1))


        case .issues:
            writeInt(&buf, Int32(2))


        case .pullRequests:
            writeInt(&buf, Int32(3))

        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeHomeActivityFilter_lift(_ buf: RustBuffer) throws -> HomeActivityFilter {
    return try FfiConverterTypeHomeActivityFilter.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeHomeActivityFilter_lower(_ value: HomeActivityFilter) -> RustBuffer {
    return FfiConverterTypeHomeActivityFilter.lower(value)
}




public enum NotificationStatus: Equatable, Hashable {

    case `open`
    case closed





}

#if compiler(>=6)
extension NotificationStatus: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeNotificationStatus: FfiConverterRustBuffer {
    typealias SwiftType = NotificationStatus

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NotificationStatus {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        case 1: return .`open`

        case 2: return .closed

        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: NotificationStatus, into buf: inout [UInt8]) {
        switch value {


        case .`open`:
            writeInt(&buf, Int32(1))


        case .closed:
            writeInt(&buf, Int32(2))

        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNotificationStatus_lift(_ buf: RustBuffer) throws -> NotificationStatus {
    return try FfiConverterTypeNotificationStatus.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeNotificationStatus_lower(_ value: NotificationStatus) -> RustBuffer {
    return FfiConverterTypeNotificationStatus.lower(value)
}




public enum RepositoryContentKind: Equatable, Hashable {

    case directory
    case file





}

#if compiler(>=6)
extension RepositoryContentKind: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeRepositoryContentKind: FfiConverterRustBuffer {
    typealias SwiftType = RepositoryContentKind

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RepositoryContentKind {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        case 1: return .directory

        case 2: return .file

        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: RepositoryContentKind, into buf: inout [UInt8]) {
        switch value {


        case .directory:
            writeInt(&buf, Int32(1))


        case .file:
            writeInt(&buf, Int32(2))

        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryContentKind_lift(_ buf: RustBuffer) throws -> RepositoryContentKind {
    return try FfiConverterTypeRepositoryContentKind.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryContentKind_lower(_ value: RepositoryContentKind) -> RustBuffer {
    return FfiConverterTypeRepositoryContentKind.lower(value)
}




public enum RepositoryFileKind: Equatable, Hashable {

    case markdown
    case source
    case preview





}

#if compiler(>=6)
extension RepositoryFileKind: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeRepositoryFileKind: FfiConverterRustBuffer {
    typealias SwiftType = RepositoryFileKind

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RepositoryFileKind {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        case 1: return .markdown

        case 2: return .source

        case 3: return .preview

        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: RepositoryFileKind, into buf: inout [UInt8]) {
        switch value {


        case .markdown:
            writeInt(&buf, Int32(1))


        case .source:
            writeInt(&buf, Int32(2))


        case .preview:
            writeInt(&buf, Int32(3))

        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryFileKind_lift(_ buf: RustBuffer) throws -> RepositoryFileKind {
    return try FfiConverterTypeRepositoryFileKind.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryFileKind_lower(_ value: RepositoryFileKind) -> RustBuffer {
    return FfiConverterTypeRepositoryFileKind.lower(value)
}




public enum RepositoryPane: Equatable, Hashable {

    case issues
    case commits
    case milestones





}

#if compiler(>=6)
extension RepositoryPane: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeRepositoryPane: FfiConverterRustBuffer {
    typealias SwiftType = RepositoryPane

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RepositoryPane {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        case 1: return .issues

        case 2: return .commits

        case 3: return .milestones

        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: RepositoryPane, into buf: inout [UInt8]) {
        switch value {


        case .issues:
            writeInt(&buf, Int32(1))


        case .commits:
            writeInt(&buf, Int32(2))


        case .milestones:
            writeInt(&buf, Int32(3))

        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryPane_lift(_ buf: RustBuffer) throws -> RepositoryPane {
    return try FfiConverterTypeRepositoryPane.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeRepositoryPane_lower(_ value: RepositoryPane) -> RustBuffer {
    return FfiConverterTypeRepositoryPane.lower(value)
}




public enum ServerProvider: Equatable, Hashable {

    case gitea
    case forgejo





}

#if compiler(>=6)
extension ServerProvider: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeServerProvider: FfiConverterRustBuffer {
    typealias SwiftType = ServerProvider

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ServerProvider {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        case 1: return .gitea

        case 2: return .forgejo

        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: ServerProvider, into buf: inout [UInt8]) {
        switch value {


        case .gitea:
            writeInt(&buf, Int32(1))


        case .forgejo:
            writeInt(&buf, Int32(2))

        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeServerProvider_lift(_ buf: RustBuffer) throws -> ServerProvider {
    return try FfiConverterTypeServerProvider.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeServerProvider_lower(_ value: ServerProvider) -> RustBuffer {
    return FfiConverterTypeServerProvider.lower(value)
}




public enum WorkItemState: Equatable, Hashable {

    case `open`
    case closed
    case unknown





}

#if compiler(>=6)
extension WorkItemState: Sendable {}
#endif

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public struct FfiConverterTypeWorkItemState: FfiConverterRustBuffer {
    typealias SwiftType = WorkItemState

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WorkItemState {
        let variant: Int32 = try readInt(&buf)
        switch variant {

        case 1: return .`open`

        case 2: return .closed

        case 3: return .unknown

        default: throw UniffiInternalError.unexpectedEnumCase
        }
    }

    public static func write(_ value: WorkItemState, into buf: inout [UInt8]) {
        switch value {


        case .`open`:
            writeInt(&buf, Int32(1))


        case .closed:
            writeInt(&buf, Int32(2))


        case .unknown:
            writeInt(&buf, Int32(3))

        }
    }
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeWorkItemState_lift(_ buf: RustBuffer) throws -> WorkItemState {
    return try FfiConverterTypeWorkItemState.lift(buf)
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
public func FfiConverterTypeWorkItemState_lower(_ value: WorkItemState) -> RustBuffer {
    return FfiConverterTypeWorkItemState.lower(value)
}


#if swift(>=5.8)
@_documentation(visibility: private)
#endif
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
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterOptionInt64: FfiConverterRustBuffer {
    typealias SwiftType = 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))
        FfiConverterInt64.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 FfiConverterInt64.read(from: &buf)
        default: throw UniffiInternalError.unexpectedOptionalTag
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
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
        }
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceUInt32: FfiConverterRustBuffer {
    typealias SwiftType = [UInt32]

    public static func write(_ value: [UInt32], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterUInt32.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [UInt32] {
        let len: Int32 = try readInt(&buf)
        var seq = [UInt32]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterUInt32.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceInt64: FfiConverterRustBuffer {
    typealias SwiftType = [Int64]

    public static func write(_ value: [Int64], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterInt64.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [Int64] {
        let len: Int32 = try readInt(&buf)
        var seq = [Int64]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterInt64.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
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
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeActivityRow: FfiConverterRustBuffer {
    typealias SwiftType = [ActivityRow]

    public static func write(_ value: [ActivityRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeActivityRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [ActivityRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [ActivityRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeActivityRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeCommentRow: FfiConverterRustBuffer {
    typealias SwiftType = [CommentRow]

    public static func write(_ value: [CommentRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeCommentRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [CommentRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [CommentRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeCommentRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeCommitMetadataRow: FfiConverterRustBuffer {
    typealias SwiftType = [CommitMetadataRow]

    public static func write(_ value: [CommitMetadataRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeCommitMetadataRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [CommitMetadataRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [CommitMetadataRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeCommitMetadataRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeCommitRow: FfiConverterRustBuffer {
    typealias SwiftType = [CommitRow]

    public static func write(_ value: [CommitRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeCommitRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [CommitRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [CommitRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeCommitRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeDiffLine: FfiConverterRustBuffer {
    typealias SwiftType = [DiffLine]

    public static func write(_ value: [DiffLine], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeDiffLine.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [DiffLine] {
        let len: Int32 = try readInt(&buf)
        var seq = [DiffLine]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeDiffLine.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeFileRow: FfiConverterRustBuffer {
    typealias SwiftType = [FileRow]

    public static func write(_ value: [FileRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeFileRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [FileRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [FileRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeFileRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeHeatCell: FfiConverterRustBuffer {
    typealias SwiftType = [HeatCell]

    public static func write(_ value: [HeatCell], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeHeatCell.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [HeatCell] {
        let len: Int32 = try readInt(&buf)
        var seq = [HeatCell]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeHeatCell.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeIssueEditorLabel: FfiConverterRustBuffer {
    typealias SwiftType = [IssueEditorLabel]

    public static func write(_ value: [IssueEditorLabel], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeIssueEditorLabel.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [IssueEditorLabel] {
        let len: Int32 = try readInt(&buf)
        var seq = [IssueEditorLabel]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeIssueEditorLabel.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeIssueEditorMilestone: FfiConverterRustBuffer {
    typealias SwiftType = [IssueEditorMilestone]

    public static func write(_ value: [IssueEditorMilestone], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeIssueEditorMilestone.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [IssueEditorMilestone] {
        let len: Int32 = try readInt(&buf)
        var seq = [IssueEditorMilestone]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeIssueEditorMilestone.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeIssueRow: FfiConverterRustBuffer {
    typealias SwiftType = [IssueRow]

    public static func write(_ value: [IssueRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeIssueRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [IssueRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [IssueRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeIssueRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeLabelRow: FfiConverterRustBuffer {
    typealias SwiftType = [LabelRow]

    public static func write(_ value: [LabelRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeLabelRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [LabelRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [LabelRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeLabelRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeMilestoneRow: FfiConverterRustBuffer {
    typealias SwiftType = [MilestoneRow]

    public static func write(_ value: [MilestoneRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeMilestoneRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [MilestoneRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [MilestoneRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeMilestoneRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeNotificationRow: FfiConverterRustBuffer {
    typealias SwiftType = [NotificationRow]

    public static func write(_ value: [NotificationRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeNotificationRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [NotificationRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [NotificationRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeNotificationRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypePullRow: FfiConverterRustBuffer {
    typealias SwiftType = [PullRow]

    public static func write(_ value: [PullRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypePullRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [PullRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [PullRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypePullRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeRepositoryContentRow: FfiConverterRustBuffer {
    typealias SwiftType = [RepositoryContentRow]

    public static func write(_ value: [RepositoryContentRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeRepositoryContentRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RepositoryContentRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [RepositoryContentRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeRepositoryContentRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeRepositoryRow: FfiConverterRustBuffer {
    typealias SwiftType = [RepositoryRow]

    public static func write(_ value: [RepositoryRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeRepositoryRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RepositoryRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [RepositoryRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeRepositoryRow.read(from: &buf))
        }
        return seq
    }
}

#if swift(>=5.8)
@_documentation(visibility: private)
#endif
fileprivate struct FfiConverterSequenceTypeServerRow: FfiConverterRustBuffer {
    typealias SwiftType = [ServerRow]

    public static func write(_ value: [ServerRow], into buf: inout [UInt8]) {
        let len = Int32(value.count)
        writeInt(&buf, len)
        for item in value {
            FfiConverterTypeServerRow.write(item, into: &buf)
        }
    }

    public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [ServerRow] {
        let len: Int32 = try readInt(&buf)
        var seq = [ServerRow]()
        seq.reserveCapacity(Int(len))
        for _ in 0 ..< len {
            seq.append(try FfiConverterTypeServerRow.read(from: &buf))
        }
        return seq
    }
}
private let UNIFFI_RUST_FUTURE_POLL_READY: Int8 = 0
private let UNIFFI_RUST_FUTURE_POLL_WAKE: 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 -> Swift.Error)?
) async throws -> T {
    // Make sure to call the ensure init function since future creation doesn't have a
    // RustCallStatus param, so doesn't use makeRustCall()
    uniffiEnsureGotchaCoreInitialized()
    let rustFuture = rustFutureFunc()
    defer {
        freeFunc(rustFuture)
    }
    var pollResult: Int8;
    repeat {
        pollResult = await withUnsafeContinuation {
            pollFunc(
                rustFuture,
                { handle, pollResult in
                    uniffiFutureContinuationCallback(handle: handle, pollResult: pollResult)
                },
                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")
    }
}

private enum InitializationResult {
    case ok
    case contractVersionMismatch
    case apiChecksumMismatch
}
// Use a global variable to perform the versioning checks. Swift ensures that
// the code inside is only computed once.
private let initializationResult: InitializationResult = {
    // Get the bindings contract version from our ComponentInterface
    let bindings_contract_version = 30
    // Get the scaffolding contract version by calling the into the dylib
    let scaffolding_contract_version = ffi_gotcha_core_uniffi_contract_version()
    if bindings_contract_version != scaffolding_contract_version {
        return InitializationResult.contractVersionMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_commit_details() != 61777) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_commit_diff() != 61482) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_commits() != 32481) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_pull_diff() != 62574) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_repository_contents() != 53943) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_repository_file() != 13870) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_clear_issue_filters() != 21897) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_delete_issue() != 22660) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_issue() != 15614) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_issue_editor() != 32394) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_issue_filters() != 12134) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_issue_filters_active() != 21302) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_issues() != 57513) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_save_issue() != 58663) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_save_issue_comment() != 13391) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_set_issue_closed() != 30617) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_set_issue_filters() != 4176) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_delete_milestone() != 3994) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_milestone() != 34814) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_milestone_editor() != 38638) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_milestones() != 56160) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_save_milestone() != 63660) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_set_milestone_closed() != 33) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_mark_notification_read() != 39536) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_notifications() != 58813) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_poll_notifications() != 21038) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_clear_pull_filters() != 61566) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_pull() != 15127) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_pull_filters() != 53612) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_pull_filters_active() != 11719) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_pulls() != 36665) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_set_pull_filters() != 42079) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_repositories() != 43682) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_toggle_favorite() != 61398) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_active_server_index() != 39193) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_active_server_name() != 45045) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_add_server() != 51168) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_delete_server() != 5208) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_home() != 37602) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_select_server() != 10204) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_server_activity() != 35959) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_server_editor() != 36193) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_servers() != 16732) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_set_appearance() != 42609) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_set_issue_status() != 5573) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_set_notifications_enabled() != 13019) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_set_pull_status() != 40421) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_settings() != 5604) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_startup_error() != 58843) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_update_server() != 31001) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_widget_activity() != 29431) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_method_gotchacore_widget_pulls() != 23227) {
        return InitializationResult.apiChecksumMismatch
    }
    if (uniffi_gotcha_core_checksum_constructor_gotchacore_new() != 64965) {
        return InitializationResult.apiChecksumMismatch
    }

    return InitializationResult.ok
}()

// Make the ensure init function public so that other modules which have external type references to
// our types can call it.
public func uniffiEnsureGotchaCoreInitialized() {
    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