Add milestone creation and editing

This commit is contained in:
Georg Bauer
2026-07-31 15:30:45 +02:00
parent da0a3aecb4
commit c4e64b5c0c
13 changed files with 591 additions and 21 deletions

View File

@@ -629,6 +629,8 @@ public protocol GotchaCoreProtocol: AnyObject, Sendable {
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 pull(owner: String, repository: String, number: Int64, page: UInt32) async throws -> PullPage
@@ -651,6 +653,8 @@ public protocol GotchaCoreProtocol: AnyObject, Sendable {
func saveIssueComment(owner: String, repository: String, number: Int64, commentId: Int64?, body: String) async throws
func saveMilestone(owner: String, repository: String, id: Int64?, title: String, description: String, dueDate: Int64?) async throws -> Int64
func selectServer(index: UInt32) throws
func servers() -> [ServerRow]
@@ -922,6 +926,22 @@ open func milestone(owner: String, repository: String, id: Int64, page: UInt32)a
)
}
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(
@@ -1091,6 +1111,22 @@ open func saveIssueComment(owner: String, repository: String, number: Int64, com
)
}
open func saveMilestone(owner: String, repository: String, id: Int64?, title: String, description: String, dueDate: Int64?)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),FfiConverterString.lower(title),FfiConverterString.lower(description),FfiConverterOptionInt64.lower(dueDate)
)
},
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 selectServer(index: UInt32)throws {try rustCallWithError(FfiConverterTypeGotchaError_lift) {
uniffiCallStatus in
uniffi_gotcha_core_fn_method_gotchacore_select_server(
@@ -2378,6 +2414,64 @@ public func FfiConverterTypeLabelRow_lower(_ value: LabelRow) -> RustBuffer {
}
public struct MilestoneEditorPage: Equatable, Hashable {
public var title: String
public var description: String
public var dueDate: Int64?
// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(title: String, description: String, dueDate: Int64?) {
self.title = title
self.description = description
self.dueDate = dueDate
}
}
#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)
)
}
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)
}
}
#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
@@ -3878,6 +3972,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_gotcha_core_checksum_method_gotchacore_milestone() != 57186) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_gotcha_core_checksum_method_gotchacore_milestone_editor() != 52261) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_gotcha_core_checksum_method_gotchacore_milestones() != 50431) {
return InitializationResult.apiChecksumMismatch
}
@@ -3911,6 +4008,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_gotcha_core_checksum_method_gotchacore_save_issue_comment() != 58596) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_gotcha_core_checksum_method_gotchacore_save_milestone() != 33075) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_gotcha_core_checksum_method_gotchacore_select_server() != 22721) {
return InitializationResult.apiChecksumMismatch
}