Load filtered home activity streams
This commit is contained in:
@@ -4,4 +4,4 @@ module gotcha_core {
|
||||
use "Darwin"
|
||||
use "_Builtin_stdbool"
|
||||
use "_Builtin_stdint"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -615,7 +615,7 @@ public protocol GotchaCoreProtocol: AnyObject, Sendable {
|
||||
|
||||
func commits(owner: String, repository: String, branch: String?, path: String, pages: UInt32) async throws -> CommitPage
|
||||
|
||||
func home(page: UInt32) async throws -> HomePage
|
||||
func home(page: UInt32, filter: HomeActivityFilter) async throws -> HomePage
|
||||
|
||||
func issue(owner: String, repository: String, number: Int64, page: UInt32) async throws -> IssuePage
|
||||
|
||||
@@ -819,12 +819,12 @@ open func commits(owner: String, repository: String, branch: String?, path: Stri
|
||||
)
|
||||
}
|
||||
|
||||
open func home(page: UInt32)async throws -> HomePage {
|
||||
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)
|
||||
self.uniffiCloneHandle(),FfiConverterUInt32.lower(page),FfiConverterTypeHomeActivityFilter_lower(filter)
|
||||
)
|
||||
},
|
||||
pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer,
|
||||
@@ -1839,22 +1839,18 @@ public func FfiConverterTypeHeatCell_lower(_ value: HeatCell) -> RustBuffer {
|
||||
public struct HomePage: Equatable, Hashable {
|
||||
public var serverName: String
|
||||
public var activities: [ActivityRow]
|
||||
public var issueActivities: [ActivityRow]
|
||||
public var pullActivities: [ActivityRow]
|
||||
public var heatCells: [HeatCell]
|
||||
public var contributionCount: Int64
|
||||
public var hasMore: Bool
|
||||
public var nextPage: UInt32?
|
||||
|
||||
// Default memberwise initializers are never public by default, so we
|
||||
// declare one manually.
|
||||
public init(serverName: String, activities: [ActivityRow], issueActivities: [ActivityRow], pullActivities: [ActivityRow], heatCells: [HeatCell], contributionCount: Int64, hasMore: Bool) {
|
||||
public init(serverName: String, activities: [ActivityRow], heatCells: [HeatCell], contributionCount: Int64, nextPage: UInt32?) {
|
||||
self.serverName = serverName
|
||||
self.activities = activities
|
||||
self.issueActivities = issueActivities
|
||||
self.pullActivities = pullActivities
|
||||
self.heatCells = heatCells
|
||||
self.contributionCount = contributionCount
|
||||
self.hasMore = hasMore
|
||||
self.nextPage = nextPage
|
||||
}
|
||||
|
||||
|
||||
@@ -1875,22 +1871,18 @@ public struct FfiConverterTypeHomePage: FfiConverterRustBuffer {
|
||||
try HomePage(
|
||||
serverName: FfiConverterString.read(from: &buf),
|
||||
activities: FfiConverterSequenceTypeActivityRow.read(from: &buf),
|
||||
issueActivities: FfiConverterSequenceTypeActivityRow.read(from: &buf),
|
||||
pullActivities: FfiConverterSequenceTypeActivityRow.read(from: &buf),
|
||||
heatCells: FfiConverterSequenceTypeHeatCell.read(from: &buf),
|
||||
contributionCount: FfiConverterInt64.read(from: &buf),
|
||||
hasMore: FfiConverterBool.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)
|
||||
FfiConverterSequenceTypeActivityRow.write(value.issueActivities, into: &buf)
|
||||
FfiConverterSequenceTypeActivityRow.write(value.pullActivities, into: &buf)
|
||||
FfiConverterSequenceTypeHeatCell.write(value.heatCells, into: &buf)
|
||||
FfiConverterInt64.write(value.contributionCount, into: &buf)
|
||||
FfiConverterBool.write(value.hasMore, into: &buf)
|
||||
FfiConverterOptionUInt32.write(value.nextPage, into: &buf)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3352,6 +3344,79 @@ public func FfiConverterTypeGotchaError_lower(_ value: GotchaError) -> RustBuffe
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
@@ -3955,7 +4020,7 @@ private let initializationResult: InitializationResult = {
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_commits() != 60062) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_home() != 38990) {
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_home() != 2797) {
|
||||
return InitializationResult.apiChecksumMismatch
|
||||
}
|
||||
if (uniffi_gotcha_core_checksum_method_gotchacore_issue() != 3108) {
|
||||
@@ -4065,4 +4130,4 @@ public func uniffiEnsureGotchaCoreInitialized() {
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:enable all
|
||||
// swiftlint:enable all
|
||||
@@ -291,7 +291,7 @@ uint64_t uniffi_gotcha_core_fn_method_gotchacore_commits(uint64_t ptr, RustBuffe
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_FN_METHOD_GOTCHACORE_HOME
|
||||
#define UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_FN_METHOD_GOTCHACORE_HOME
|
||||
uint64_t uniffi_gotcha_core_fn_method_gotchacore_home(uint64_t ptr, uint32_t page
|
||||
uint64_t uniffi_gotcha_core_fn_method_gotchacore_home(uint64_t ptr, uint32_t page, RustBuffer filter
|
||||
);
|
||||
#endif
|
||||
#ifndef UNIFFI_FFIDEF_UNIFFI_GOTCHA_CORE_FN_METHOD_GOTCHACORE_ISSUE
|
||||
|
||||
Reference in New Issue
Block a user