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,12 +1,5 @@
|
|||
import Foundation
|
||||
|
||||
public final class AdminService: Sendable {
|
||||
private let client: ForgejoClient
|
||||
|
||||
public init(client: ForgejoClient) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
private struct CreateUserPayload: Codable {
|
||||
let username: String
|
||||
let password: String
|
||||
|
|
@ -31,6 +24,13 @@ public final class AdminService: Sendable {
|
|||
}
|
||||
}
|
||||
|
||||
public final class AdminService: Sendable {
|
||||
private let client: ForgejoClient
|
||||
|
||||
public init(client: ForgejoClient) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
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,17 +1,6 @@
|
|||
import Foundation
|
||||
|
||||
// swiftlint:disable file_length
|
||||
// swiftlint:disable:next type_body_length
|
||||
public final class RepositoryService: Sendable {
|
||||
private let client: ForgejoClient
|
||||
|
||||
public init(client: ForgejoClient) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
private struct SearchResponse: Codable {
|
||||
let data: [Repository]
|
||||
}
|
||||
|
||||
private struct CreateRepositoryPayload: Codable {
|
||||
let name: String
|
||||
|
|
@ -27,18 +16,6 @@ public final class RepositoryService: Sendable {
|
|||
}
|
||||
}
|
||||
|
||||
private struct EditRepositoryPayload: Codable {
|
||||
let archived: Bool?
|
||||
let description: String?
|
||||
let name: String?
|
||||
}
|
||||
|
||||
private struct CreateLabelPayload: Codable {
|
||||
let name: String
|
||||
let color: String
|
||||
let description: String?
|
||||
}
|
||||
|
||||
private struct CreateMilestonePayload: Codable {
|
||||
let title: String
|
||||
let description: String?
|
||||
|
|
@ -51,10 +28,6 @@ public final class RepositoryService: Sendable {
|
|||
}
|
||||
}
|
||||
|
||||
private struct CollaboratorPayload: Codable {
|
||||
let permission: String
|
||||
}
|
||||
|
||||
private struct CreateFilePayload: Codable {
|
||||
let content: String
|
||||
let message: String
|
||||
|
|
@ -69,6 +42,34 @@ public final class RepositoryService: Sendable {
|
|||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable:next type_body_length
|
||||
public final class RepositoryService: Sendable {
|
||||
private let client: ForgejoClient
|
||||
|
||||
public init(client: ForgejoClient) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
private struct SearchResponse: Codable {
|
||||
let data: [Repository]
|
||||
}
|
||||
|
||||
private struct EditRepositoryPayload: Codable {
|
||||
let archived: Bool?
|
||||
let description: String?
|
||||
let name: String?
|
||||
}
|
||||
|
||||
private struct CreateLabelPayload: Codable {
|
||||
let name: String
|
||||
let color: String
|
||||
let description: String?
|
||||
}
|
||||
|
||||
private struct CollaboratorPayload: Codable {
|
||||
let permission: String
|
||||
}
|
||||
|
||||
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