Files
ios-gitea-prs/GiteaPR/Models/PullRequest.swift
T
Hermes 1025634978
Build iOS App / Build .ipa and publish source (push) Failing after 35s
GiteaPR: native iOS app to manage Gitea pull requests
Multi-repo PR inbox, review (approve/request changes/comment), merge with
gating toggle, read-only diff viewer, and Gitea Actions check status with
one-tap re-run. Ships unsigned via the iMac runner to the SideStore source.
2026-08-12 17:07:58 +00:00

104 lines
2.5 KiB
Swift

import Foundation
struct Branch: Codable, Hashable {
let label: String?
let ref: String?
let sha: String?
}
struct Label: Codable, Hashable, Identifiable {
let id: Int64?
let name: String
let color: String?
}
struct PRUser: Codable, Hashable {
let id: Int64?
let login: String
let fullName: String?
}
/// A pull request as returned by `/repos/{owner}/{repo}/pulls` and
/// `/issues/{index}`.
struct PullRequest: Codable, Hashable, Identifiable {
let id: Int64
let number: Int
let title: String
let body: String?
let state: String // open | closed | merged
let htmlURL: String?
let diffURL: String?
let patchURL: String?
let user: PRUser?
let assignees: [PRUser]?
let labels: [Label]?
let head: Branch?
let base: Branch?
let createdAt: Date?
let updatedAt: Date?
let merged: Bool?
let mergeable: Bool?
let draft: Bool?
enum CodingKeys: String, CodingKey {
case id, number, title, body, state, user, assignees, labels
case htmlURL = "html_url"
case diffURL = "diff_url"
case patchURL = "patch_url"
case head, base
case createdAt = "created_at"
case updatedAt = "updated_at"
case merged, mergeable, draft
}
}
/// A single review submission (approve / request changes / comment).
struct PullReview: Codable, Identifiable {
let id: Int64
let state: String // APPROVED | REQUEST_CHANGES | COMMENT | PENDING
let body: String?
let user: PRUser?
let submittedAt: Date?
enum CodingKeys: String, CodingKey {
case id, state, body, user
case submittedAt = "submitted_at"
}
}
/// An issue/PR comment.
struct IssueComment: Codable, Identifiable {
let id: Int64
let body: String?
let user: PRUser?
let createdAt: Date?
let updatedAt: Date?
enum CodingKeys: String, CodingKey {
case id, body, user
case createdAt = "created_at"
case updatedAt = "updated_at"
}
}
/// A commit in a pull request.
struct PRCommit: Codable, Identifiable {
struct Meta: Codable {
let sha: String?
let message: String?
}
struct Author: Codable {
let name: String?
let email: String?
let login: String?
}
let id: String // sha
let sha: String?
let commit: Meta?
let author: Author?
enum CodingKeys: String, CodingKey {
case id, sha, commit, author
}
}