Add issue comment editing

This commit is contained in:
Georg Bauer
2026-07-31 15:17:09 +02:00
parent 33f9eb809c
commit da0a3aecb4
10 changed files with 451 additions and 12 deletions

View File

@@ -649,6 +649,8 @@ public protocol GotchaCoreProtocol: AnyObject, Sendable {
func saveIssue(owner: String, repository: String, number: Int64?, title: String, body: String, labelIds: [Int64], milestoneId: Int64?, dueDate: Int64?) async throws -> Int64
func saveIssueComment(owner: String, repository: String, number: Int64, commentId: Int64?, body: String) async throws
func selectServer(index: UInt32) throws
func servers() -> [ServerRow]
@@ -1073,6 +1075,22 @@ open func saveIssue(owner: String, repository: String, number: Int64?, title: St
)
}
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 selectServer(index: UInt32)throws {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
uniffiCallStatus in
uniffi_gotcha_core_fn_method_gotchacore_select_server(
@@ -1299,16 +1317,20 @@ public func FfiConverterTypeActivityRow_lower(_ value: ActivityRow) -> RustBuffe
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(author: String, body: String, meta: String) {
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
}
@@ -1327,16 +1349,20 @@ 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)
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)
}
}
@@ -3882,6 +3908,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_gotcha_core_checksum_method_gotchacore_save_issue() != 55053) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_gotcha_core_checksum_method_gotchacore_save_issue_comment() != 58596) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_gotcha_core_checksum_method_gotchacore_select_server() != 22721) {
return InitializationResult.apiChecksumMismatch
}