Skip to content

Commit de7bdfb

Browse files
Merge pull request #121 from wei18/dependabot/submodules/Submodule/github/rest-api-description-f024f30
Bump Submodule/github/rest-api-description from `0956844` to `f024f30`
2 parents 1320d55 + de9d04e commit de7bdfb

File tree

16 files changed

+772
-23
lines changed

16 files changed

+772
-23
lines changed

Sources/actions/Client.swift

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2915,12 +2915,38 @@ public struct Client: APIProtocol {
29152915
method: .delete
29162916
)
29172917
suppressMutabilityWarning(&request)
2918+
converter.setAcceptHeader(
2919+
in: &request.headerFields,
2920+
contentTypes: input.headers.accept
2921+
)
29182922
return (request, nil)
29192923
},
29202924
deserializer: { response, responseBody in
29212925
switch response.status.code {
29222926
case 204:
29232927
return .noContent(.init())
2928+
case 422:
2929+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
2930+
let body: Components.Responses.ValidationFailedSimple.Body
2931+
let chosenContentType = try converter.bestContentType(
2932+
received: contentType,
2933+
options: [
2934+
"application/json"
2935+
]
2936+
)
2937+
switch chosenContentType {
2938+
case "application/json":
2939+
body = try await converter.getResponseBodyAsJSON(
2940+
Components.Schemas.ValidationErrorSimple.self,
2941+
from: responseBody,
2942+
transforming: { value in
2943+
.json(value)
2944+
}
2945+
)
2946+
default:
2947+
preconditionFailure("bestContentType chose an invalid content type.")
2948+
}
2949+
return .unprocessableContent(.init(body: body))
29242950
default:
29252951
return .undocumented(
29262952
statusCode: response.status.code,
@@ -6976,12 +7002,38 @@ public struct Client: APIProtocol {
69767002
method: .delete
69777003
)
69787004
suppressMutabilityWarning(&request)
7005+
converter.setAcceptHeader(
7006+
in: &request.headerFields,
7007+
contentTypes: input.headers.accept
7008+
)
69797009
return (request, nil)
69807010
},
69817011
deserializer: { response, responseBody in
69827012
switch response.status.code {
69837013
case 204:
69847014
return .noContent(.init())
7015+
case 422:
7016+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
7017+
let body: Components.Responses.ValidationFailedSimple.Body
7018+
let chosenContentType = try converter.bestContentType(
7019+
received: contentType,
7020+
options: [
7021+
"application/json"
7022+
]
7023+
)
7024+
switch chosenContentType {
7025+
case "application/json":
7026+
body = try await converter.getResponseBodyAsJSON(
7027+
Components.Schemas.ValidationErrorSimple.self,
7028+
from: responseBody,
7029+
transforming: { value in
7030+
.json(value)
7031+
}
7032+
)
7033+
default:
7034+
preconditionFailure("bestContentType chose an invalid content type.")
7035+
}
7036+
return .unprocessableContent(.init(body: body))
69857037
default:
69867038
return .undocumented(
69877039
statusCode: response.status.code,

Sources/actions/Types.swift

Lines changed: 182 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,8 +2327,14 @@ extension APIProtocol {
23272327
///
23282328
/// - Remark: HTTP `DELETE /orgs/{org}/actions/runners/{runner_id}`.
23292329
/// - Remark: Generated from `#/paths//orgs/{org}/actions/runners/{runner_id}/delete(actions/delete-self-hosted-runner-from-org)`.
2330-
public func actionsDeleteSelfHostedRunnerFromOrg(path: Operations.ActionsDeleteSelfHostedRunnerFromOrg.Input.Path) async throws -> Operations.ActionsDeleteSelfHostedRunnerFromOrg.Output {
2331-
try await actionsDeleteSelfHostedRunnerFromOrg(Operations.ActionsDeleteSelfHostedRunnerFromOrg.Input(path: path))
2330+
public func actionsDeleteSelfHostedRunnerFromOrg(
2331+
path: Operations.ActionsDeleteSelfHostedRunnerFromOrg.Input.Path,
2332+
headers: Operations.ActionsDeleteSelfHostedRunnerFromOrg.Input.Headers = .init()
2333+
) async throws -> Operations.ActionsDeleteSelfHostedRunnerFromOrg.Output {
2334+
try await actionsDeleteSelfHostedRunnerFromOrg(Operations.ActionsDeleteSelfHostedRunnerFromOrg.Input(
2335+
path: path,
2336+
headers: headers
2337+
))
23322338
}
23332339
/// List labels for a self-hosted runner for an organization
23342340
///
@@ -3321,8 +3327,14 @@ extension APIProtocol {
33213327
///
33223328
/// - Remark: HTTP `DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}`.
33233329
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/actions/runners/{runner_id}/delete(actions/delete-self-hosted-runner-from-repo)`.
3324-
public func actionsDeleteSelfHostedRunnerFromRepo(path: Operations.ActionsDeleteSelfHostedRunnerFromRepo.Input.Path) async throws -> Operations.ActionsDeleteSelfHostedRunnerFromRepo.Output {
3325-
try await actionsDeleteSelfHostedRunnerFromRepo(Operations.ActionsDeleteSelfHostedRunnerFromRepo.Input(path: path))
3330+
public func actionsDeleteSelfHostedRunnerFromRepo(
3331+
path: Operations.ActionsDeleteSelfHostedRunnerFromRepo.Input.Path,
3332+
headers: Operations.ActionsDeleteSelfHostedRunnerFromRepo.Input.Headers = .init()
3333+
) async throws -> Operations.ActionsDeleteSelfHostedRunnerFromRepo.Output {
3334+
try await actionsDeleteSelfHostedRunnerFromRepo(Operations.ActionsDeleteSelfHostedRunnerFromRepo.Input(
3335+
path: path,
3336+
headers: headers
3337+
))
33263338
}
33273339
/// List labels for a self-hosted runner for a repository
33283340
///
@@ -5228,6 +5240,35 @@ public enum Components {
52285240
///
52295241
/// - Remark: Generated from `#/components/schemas/repository/anonymous_access_enabled`.
52305242
public var anonymousAccessEnabled: Swift.Bool?
5243+
/// The status of the code search index for this repository
5244+
///
5245+
/// - Remark: Generated from `#/components/schemas/repository/code_search_index_status`.
5246+
public struct CodeSearchIndexStatusPayload: Codable, Hashable, Sendable {
5247+
/// - Remark: Generated from `#/components/schemas/repository/code_search_index_status/lexical_search_ok`.
5248+
public var lexicalSearchOk: Swift.Bool?
5249+
/// - Remark: Generated from `#/components/schemas/repository/code_search_index_status/lexical_commit_sha`.
5250+
public var lexicalCommitSha: Swift.String?
5251+
/// Creates a new `CodeSearchIndexStatusPayload`.
5252+
///
5253+
/// - Parameters:
5254+
/// - lexicalSearchOk:
5255+
/// - lexicalCommitSha:
5256+
public init(
5257+
lexicalSearchOk: Swift.Bool? = nil,
5258+
lexicalCommitSha: Swift.String? = nil
5259+
) {
5260+
self.lexicalSearchOk = lexicalSearchOk
5261+
self.lexicalCommitSha = lexicalCommitSha
5262+
}
5263+
public enum CodingKeys: String, CodingKey {
5264+
case lexicalSearchOk = "lexical_search_ok"
5265+
case lexicalCommitSha = "lexical_commit_sha"
5266+
}
5267+
}
5268+
/// The status of the code search index for this repository
5269+
///
5270+
/// - Remark: Generated from `#/components/schemas/repository/code_search_index_status`.
5271+
public var codeSearchIndexStatus: Components.Schemas.Repository.CodeSearchIndexStatusPayload?
52315272
/// Creates a new `Repository`.
52325273
///
52335274
/// - Parameters:
@@ -5326,6 +5367,7 @@ public enum Components {
53265367
/// - masterBranch:
53275368
/// - starredAt:
53285369
/// - anonymousAccessEnabled: Whether anonymous git access is enabled for this repository
5370+
/// - codeSearchIndexStatus: The status of the code search index for this repository
53295371
public init(
53305372
id: Swift.Int64,
53315373
nodeId: Swift.String,
@@ -5421,7 +5463,8 @@ public enum Components {
54215463
watchers: Swift.Int,
54225464
masterBranch: Swift.String? = nil,
54235465
starredAt: Swift.String? = nil,
5424-
anonymousAccessEnabled: Swift.Bool? = nil
5466+
anonymousAccessEnabled: Swift.Bool? = nil,
5467+
codeSearchIndexStatus: Components.Schemas.Repository.CodeSearchIndexStatusPayload? = nil
54255468
) {
54265469
self.id = id
54275470
self.nodeId = nodeId
@@ -5518,6 +5561,7 @@ public enum Components {
55185561
self.masterBranch = masterBranch
55195562
self.starredAt = starredAt
55205563
self.anonymousAccessEnabled = anonymousAccessEnabled
5564+
self.codeSearchIndexStatus = codeSearchIndexStatus
55215565
}
55225566
public enum CodingKeys: String, CodingKey {
55235567
case id
@@ -5615,6 +5659,7 @@ public enum Components {
56155659
case masterBranch = "master_branch"
56165660
case starredAt = "starred_at"
56175661
case anonymousAccessEnabled = "anonymous_access_enabled"
5662+
case codeSearchIndexStatus = "code_search_index_status"
56185663
}
56195664
}
56205665
/// Code Of Conduct
@@ -17165,12 +17210,29 @@ public enum Operations {
1716517210
}
1716617211
}
1716717212
public var path: Operations.ActionsDeleteSelfHostedRunnerFromOrg.Input.Path
17213+
/// - Remark: Generated from `#/paths/orgs/{org}/actions/runners/{runner_id}/DELETE/header`.
17214+
public struct Headers: Sendable, Hashable {
17215+
public var accept: [OpenAPIRuntime.AcceptHeaderContentType<Operations.ActionsDeleteSelfHostedRunnerFromOrg.AcceptableContentType>]
17216+
/// Creates a new `Headers`.
17217+
///
17218+
/// - Parameters:
17219+
/// - accept:
17220+
public init(accept: [OpenAPIRuntime.AcceptHeaderContentType<Operations.ActionsDeleteSelfHostedRunnerFromOrg.AcceptableContentType>] = .defaultValues()) {
17221+
self.accept = accept
17222+
}
17223+
}
17224+
public var headers: Operations.ActionsDeleteSelfHostedRunnerFromOrg.Input.Headers
1716817225
/// Creates a new `Input`.
1716917226
///
1717017227
/// - Parameters:
1717117228
/// - path:
17172-
public init(path: Operations.ActionsDeleteSelfHostedRunnerFromOrg.Input.Path) {
17229+
/// - headers:
17230+
public init(
17231+
path: Operations.ActionsDeleteSelfHostedRunnerFromOrg.Input.Path,
17232+
headers: Operations.ActionsDeleteSelfHostedRunnerFromOrg.Input.Headers = .init()
17233+
) {
1717317234
self.path = path
17235+
self.headers = headers
1717417236
}
1717517237
}
1717617238
@frozen public enum Output: Sendable, Hashable {
@@ -17209,11 +17271,59 @@ public enum Operations {
1720917271
}
1721017272
}
1721117273
}
17274+
/// Validation failed, or the endpoint has been spammed.
17275+
///
17276+
/// - Remark: Generated from `#/paths//orgs/{org}/actions/runners/{runner_id}/delete(actions/delete-self-hosted-runner-from-org)/responses/422`.
17277+
///
17278+
/// HTTP response code: `422 unprocessableContent`.
17279+
case unprocessableContent(Components.Responses.ValidationFailedSimple)
17280+
/// The associated value of the enum case if `self` is `.unprocessableContent`.
17281+
///
17282+
/// - Throws: An error if `self` is not `.unprocessableContent`.
17283+
/// - SeeAlso: `.unprocessableContent`.
17284+
public var unprocessableContent: Components.Responses.ValidationFailedSimple {
17285+
get throws {
17286+
switch self {
17287+
case let .unprocessableContent(response):
17288+
return response
17289+
default:
17290+
try throwUnexpectedResponseStatus(
17291+
expectedStatus: "unprocessableContent",
17292+
response: self
17293+
)
17294+
}
17295+
}
17296+
}
1721217297
/// Undocumented response.
1721317298
///
1721417299
/// A response with a code that is not documented in the OpenAPI document.
1721517300
case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload)
1721617301
}
17302+
@frozen public enum AcceptableContentType: AcceptableProtocol {
17303+
case json
17304+
case other(Swift.String)
17305+
public init?(rawValue: Swift.String) {
17306+
switch rawValue.lowercased() {
17307+
case "application/json":
17308+
self = .json
17309+
default:
17310+
self = .other(rawValue)
17311+
}
17312+
}
17313+
public var rawValue: Swift.String {
17314+
switch self {
17315+
case let .other(string):
17316+
return string
17317+
case .json:
17318+
return "application/json"
17319+
}
17320+
}
17321+
public static var allCases: [Self] {
17322+
[
17323+
.json
17324+
]
17325+
}
17326+
}
1721717327
}
1721817328
/// List labels for a self-hosted runner for an organization
1721917329
///
@@ -25593,12 +25703,29 @@ public enum Operations {
2559325703
}
2559425704
}
2559525705
public var path: Operations.ActionsDeleteSelfHostedRunnerFromRepo.Input.Path
25706+
/// - Remark: Generated from `#/paths/repos/{owner}/{repo}/actions/runners/{runner_id}/DELETE/header`.
25707+
public struct Headers: Sendable, Hashable {
25708+
public var accept: [OpenAPIRuntime.AcceptHeaderContentType<Operations.ActionsDeleteSelfHostedRunnerFromRepo.AcceptableContentType>]
25709+
/// Creates a new `Headers`.
25710+
///
25711+
/// - Parameters:
25712+
/// - accept:
25713+
public init(accept: [OpenAPIRuntime.AcceptHeaderContentType<Operations.ActionsDeleteSelfHostedRunnerFromRepo.AcceptableContentType>] = .defaultValues()) {
25714+
self.accept = accept
25715+
}
25716+
}
25717+
public var headers: Operations.ActionsDeleteSelfHostedRunnerFromRepo.Input.Headers
2559625718
/// Creates a new `Input`.
2559725719
///
2559825720
/// - Parameters:
2559925721
/// - path:
25600-
public init(path: Operations.ActionsDeleteSelfHostedRunnerFromRepo.Input.Path) {
25722+
/// - headers:
25723+
public init(
25724+
path: Operations.ActionsDeleteSelfHostedRunnerFromRepo.Input.Path,
25725+
headers: Operations.ActionsDeleteSelfHostedRunnerFromRepo.Input.Headers = .init()
25726+
) {
2560125727
self.path = path
25728+
self.headers = headers
2560225729
}
2560325730
}
2560425731
@frozen public enum Output: Sendable, Hashable {
@@ -25637,11 +25764,59 @@ public enum Operations {
2563725764
}
2563825765
}
2563925766
}
25767+
/// Validation failed, or the endpoint has been spammed.
25768+
///
25769+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/actions/runners/{runner_id}/delete(actions/delete-self-hosted-runner-from-repo)/responses/422`.
25770+
///
25771+
/// HTTP response code: `422 unprocessableContent`.
25772+
case unprocessableContent(Components.Responses.ValidationFailedSimple)
25773+
/// The associated value of the enum case if `self` is `.unprocessableContent`.
25774+
///
25775+
/// - Throws: An error if `self` is not `.unprocessableContent`.
25776+
/// - SeeAlso: `.unprocessableContent`.
25777+
public var unprocessableContent: Components.Responses.ValidationFailedSimple {
25778+
get throws {
25779+
switch self {
25780+
case let .unprocessableContent(response):
25781+
return response
25782+
default:
25783+
try throwUnexpectedResponseStatus(
25784+
expectedStatus: "unprocessableContent",
25785+
response: self
25786+
)
25787+
}
25788+
}
25789+
}
2564025790
/// Undocumented response.
2564125791
///
2564225792
/// A response with a code that is not documented in the OpenAPI document.
2564325793
case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload)
2564425794
}
25795+
@frozen public enum AcceptableContentType: AcceptableProtocol {
25796+
case json
25797+
case other(Swift.String)
25798+
public init?(rawValue: Swift.String) {
25799+
switch rawValue.lowercased() {
25800+
case "application/json":
25801+
self = .json
25802+
default:
25803+
self = .other(rawValue)
25804+
}
25805+
}
25806+
public var rawValue: Swift.String {
25807+
switch self {
25808+
case let .other(string):
25809+
return string
25810+
case .json:
25811+
return "application/json"
25812+
}
25813+
}
25814+
public static var allCases: [Self] {
25815+
[
25816+
.json
25817+
]
25818+
}
25819+
}
2564525820
}
2564625821
/// List labels for a self-hosted runner for a repository
2564725822
///

0 commit comments

Comments
 (0)