mirror of
https://codeberg.org/secana/ForgejoKit.git
synced 2026-06-16 05:13:53 -07:00
fix: lint errors
This commit is contained in:
parent
0c2fc12ded
commit
f576906931
6 changed files with 69 additions and 75 deletions
|
|
@ -1,5 +1,29 @@
|
|||
import Foundation
|
||||
|
||||
private struct CreateUserPayload: Codable {
|
||||
let username: String
|
||||
let password: String
|
||||
let email: String
|
||||
let loginName: String
|
||||
let fullName: String?
|
||||
let mustChangePassword: Bool
|
||||
let sendNotify: Bool
|
||||
let sourceId: Int
|
||||
let visibility: String?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case username
|
||||
case password
|
||||
case email
|
||||
case loginName = "login_name"
|
||||
case fullName = "full_name"
|
||||
case mustChangePassword = "must_change_password"
|
||||
case sendNotify = "send_notify"
|
||||
case sourceId = "source_id"
|
||||
case visibility
|
||||
}
|
||||
}
|
||||
|
||||
public final class AdminService: Sendable {
|
||||
private let client: ForgejoClient
|
||||
|
||||
|
|
@ -7,30 +31,6 @@ public final class AdminService: Sendable {
|
|||
self.client = client
|
||||
}
|
||||
|
||||
private struct CreateUserPayload: Codable {
|
||||
let username: String
|
||||
let password: String
|
||||
let email: String
|
||||
let loginName: String
|
||||
let fullName: String?
|
||||
let mustChangePassword: Bool
|
||||
let sendNotify: Bool
|
||||
let sourceId: Int
|
||||
let visibility: String?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case username
|
||||
case password
|
||||
case email
|
||||
case loginName = "login_name"
|
||||
case fullName = "full_name"
|
||||
case mustChangePassword = "must_change_password"
|
||||
case sendNotify = "send_notify"
|
||||
case sourceId = "source_id"
|
||||
case visibility
|
||||
}
|
||||
}
|
||||
|
||||
public func createUser(
|
||||
username: String, password: String, email: String,
|
||||
fullName: String? = nil, mustChangePassword: Bool = false,
|
||||
|
|
|
|||
|
|
@ -137,7 +137,6 @@ public final class ForgejoClient: Sendable {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private static let tokenScopes = [
|
||||
"read:user", "write:user",
|
||||
"read:repository", "write:repository",
|
||||
|
|
@ -202,7 +201,6 @@ public final class ForgejoClient: Sendable {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
func authenticatedRequest(url: URL, method: String = "GET", body: Data? = nil) -> URLRequest {
|
||||
var request = URLRequest(url: url)
|
||||
request.httpMethod = method
|
||||
|
|
@ -283,7 +281,6 @@ public final class ForgejoClient: Sendable {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
extension ForgejoClient {
|
||||
/// Characters allowed in a single URL path segment (`.urlPathAllowed` minus `/`).
|
||||
private static let pathSegmentAllowed: CharacterSet = {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ public final class PullRequestService: Sendable {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public func fetchPullRequests(
|
||||
owner: String, repo: String,
|
||||
state: String = "open",
|
||||
|
|
@ -192,7 +191,6 @@ public final class PullRequestService: Sendable {
|
|||
return try await client.performRequestRawText(url: url)
|
||||
}
|
||||
|
||||
|
||||
public func fetchComments(
|
||||
owner: String, repo: String, index: Int,
|
||||
) async throws -> [IssueComment] {
|
||||
|
|
@ -212,7 +210,6 @@ public final class PullRequestService: Sendable {
|
|||
try await issueService.editComment(owner: owner, repo: repo, commentId: commentId, body: body)
|
||||
}
|
||||
|
||||
|
||||
public func fetchReviews(
|
||||
owner: String, repo: String, index: Int,
|
||||
) async throws -> [PullRequestReview] {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,47 @@
|
|||
import Foundation
|
||||
|
||||
// swiftlint:disable file_length
|
||||
|
||||
private struct CreateRepositoryPayload: Codable {
|
||||
let name: String
|
||||
let description: String?
|
||||
let `private`: Bool
|
||||
let autoInit: Bool
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case name
|
||||
case description
|
||||
case `private`
|
||||
case autoInit = "auto_init"
|
||||
}
|
||||
}
|
||||
|
||||
private struct CreateMilestonePayload: Codable {
|
||||
let title: String
|
||||
let description: String?
|
||||
let dueOn: String?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case title
|
||||
case description
|
||||
case dueOn = "due_on"
|
||||
}
|
||||
}
|
||||
|
||||
private struct CreateFilePayload: Codable {
|
||||
let content: String
|
||||
let message: String
|
||||
let branch: String?
|
||||
let newBranch: String?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case content
|
||||
case message
|
||||
case branch
|
||||
case newBranch = "new_branch"
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable:next type_body_length
|
||||
public final class RepositoryService: Sendable {
|
||||
private let client: ForgejoClient
|
||||
|
|
@ -13,20 +54,6 @@ public final class RepositoryService: Sendable {
|
|||
let data: [Repository]
|
||||
}
|
||||
|
||||
private struct CreateRepositoryPayload: Codable {
|
||||
let name: String
|
||||
let description: String?
|
||||
let `private`: Bool
|
||||
let autoInit: Bool
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case name
|
||||
case description
|
||||
case `private`
|
||||
case autoInit = "auto_init"
|
||||
}
|
||||
}
|
||||
|
||||
private struct EditRepositoryPayload: Codable {
|
||||
let archived: Bool?
|
||||
let description: String?
|
||||
|
|
@ -39,36 +66,10 @@ public final class RepositoryService: Sendable {
|
|||
let description: String?
|
||||
}
|
||||
|
||||
private struct CreateMilestonePayload: Codable {
|
||||
let title: String
|
||||
let description: String?
|
||||
let dueOn: String?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case title
|
||||
case description
|
||||
case dueOn = "due_on"
|
||||
}
|
||||
}
|
||||
|
||||
private struct CollaboratorPayload: Codable {
|
||||
let permission: String
|
||||
}
|
||||
|
||||
private struct CreateFilePayload: Codable {
|
||||
let content: String
|
||||
let message: String
|
||||
let branch: String?
|
||||
let newBranch: String?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case content
|
||||
case message
|
||||
case branch
|
||||
case newBranch = "new_branch"
|
||||
}
|
||||
}
|
||||
|
||||
private struct CreateFileResponse: Codable {
|
||||
let content: FileContent
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1772173633,
|
||||
"narHash": "sha256-MOH58F4AIbCkh6qlQcwMycyk5SWvsqnS/TCfnqDlpj4=",
|
||||
"lastModified": 1773110118,
|
||||
"narHash": "sha256-mPAG8phMbCReKSiKAijjjd3v7uVcJOQ75gSjGJjt/Rk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c0f3d81a7ddbc2b1332be0d8481a672b4f6004d6",
|
||||
"rev": "e607cb5360ff1234862ac9f8839522becb853bb9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
|
|
@ -14,11 +14,10 @@
|
|||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
devShells.default = pkgs.mkShellNoCC {
|
||||
packages =
|
||||
[
|
||||
pkgs.just
|
||||
pkgs.swift
|
||||
pkgs.swiftformat
|
||||
]
|
||||
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
|
||||
|
|
|
|||
Loading…
Reference in a new issue