diff --git a/Sources/interactions/Client.swift b/Sources/interactions/Client.swift index f7ca891567..d4501756dd 100644 --- a/Sources/interactions/Client.swift +++ b/Sources/interactions/Client.swift @@ -237,6 +237,305 @@ public struct Client: APIProtocol { } ) } + /// Get pull request creation cap for an org + /// + /// Gets the pull request creation cap configuration for an organization. + /// The cap limits the total number of open pull requests a user can have across all public + /// repositories in the organization at one time. + /// + /// Only users with admin access to the organization can view the cap configuration. + /// + /// - Remark: HTTP `GET /orgs/{org}/interaction-limits/pulls/creation-cap`. + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/get(interactions/get-pull-request-creation-cap-for-org)`. + public func interactionsGetPullRequestCreationCapForOrg(_ input: Operations.InteractionsGetPullRequestCreationCapForOrg.Input) async throws -> Operations.InteractionsGetPullRequestCreationCapForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.InteractionsGetPullRequestCreationCapForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/interaction-limits/pulls/creation-cap", + parameters: [ + input.path.org + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.InteractionsGetPullRequestCreationCapForOrg.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Operations.InteractionsGetPullRequestCreationCapForOrg.Output.Ok.Body.JsonPayload.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 405: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.InteractionsGetPullRequestCreationCapForOrg.Output.MethodNotAllowed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .methodNotAllowed(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Update pull request creation cap for an org + /// + /// Updates the pull request creation cap for an organization. The cap limits the total number + /// of open pull requests a user can have across all public repositories in the organization + /// at one time. + /// + /// Only users with admin access to the organization can configure the cap. + /// + /// - Remark: HTTP `PATCH /orgs/{org}/interaction-limits/pulls/creation-cap`. + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/patch(interactions/update-pull-request-creation-cap-for-org)`. + public func interactionsUpdatePullRequestCreationCapForOrg(_ input: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input) async throws -> Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.InteractionsUpdatePullRequestCreationCapForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/interaction-limits/pulls/creation-cap", + parameters: [ + input.path.org + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .patch + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case let .json(value): + body = try converter.setRequiredRequestBodyAsJSON( + value, + headerFields: &request.headerFields, + contentType: "application/json; charset=utf-8" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.Ok.Body.JsonPayload.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 405: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.MethodNotAllowed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .methodNotAllowed(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .unprocessableContent(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } /// Get interaction restrictions for a repository /// /// Shows which type of GitHub user can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response. diff --git a/Sources/interactions/Types.swift b/Sources/interactions/Types.swift index c0302a2cfc..cbd52c59c1 100644 --- a/Sources/interactions/Types.swift +++ b/Sources/interactions/Types.swift @@ -32,6 +32,28 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `DELETE /orgs/{org}/interaction-limits`. /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/delete(interactions/remove-restrictions-for-org)`. func interactionsRemoveRestrictionsForOrg(_ input: Operations.InteractionsRemoveRestrictionsForOrg.Input) async throws -> Operations.InteractionsRemoveRestrictionsForOrg.Output + /// Get pull request creation cap for an org + /// + /// Gets the pull request creation cap configuration for an organization. + /// The cap limits the total number of open pull requests a user can have across all public + /// repositories in the organization at one time. + /// + /// Only users with admin access to the organization can view the cap configuration. + /// + /// - Remark: HTTP `GET /orgs/{org}/interaction-limits/pulls/creation-cap`. + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/get(interactions/get-pull-request-creation-cap-for-org)`. + func interactionsGetPullRequestCreationCapForOrg(_ input: Operations.InteractionsGetPullRequestCreationCapForOrg.Input) async throws -> Operations.InteractionsGetPullRequestCreationCapForOrg.Output + /// Update pull request creation cap for an org + /// + /// Updates the pull request creation cap for an organization. The cap limits the total number + /// of open pull requests a user can have across all public repositories in the organization + /// at one time. + /// + /// Only users with admin access to the organization can configure the cap. + /// + /// - Remark: HTTP `PATCH /orgs/{org}/interaction-limits/pulls/creation-cap`. + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/patch(interactions/update-pull-request-creation-cap-for-org)`. + func interactionsUpdatePullRequestCreationCapForOrg(_ input: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input) async throws -> Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output /// Get interaction restrictions for a repository /// /// Shows which type of GitHub user can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response. @@ -174,6 +196,46 @@ extension APIProtocol { public func interactionsRemoveRestrictionsForOrg(path: Operations.InteractionsRemoveRestrictionsForOrg.Input.Path) async throws -> Operations.InteractionsRemoveRestrictionsForOrg.Output { try await interactionsRemoveRestrictionsForOrg(Operations.InteractionsRemoveRestrictionsForOrg.Input(path: path)) } + /// Get pull request creation cap for an org + /// + /// Gets the pull request creation cap configuration for an organization. + /// The cap limits the total number of open pull requests a user can have across all public + /// repositories in the organization at one time. + /// + /// Only users with admin access to the organization can view the cap configuration. + /// + /// - Remark: HTTP `GET /orgs/{org}/interaction-limits/pulls/creation-cap`. + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/get(interactions/get-pull-request-creation-cap-for-org)`. + public func interactionsGetPullRequestCreationCapForOrg( + path: Operations.InteractionsGetPullRequestCreationCapForOrg.Input.Path, + headers: Operations.InteractionsGetPullRequestCreationCapForOrg.Input.Headers = .init() + ) async throws -> Operations.InteractionsGetPullRequestCreationCapForOrg.Output { + try await interactionsGetPullRequestCreationCapForOrg(Operations.InteractionsGetPullRequestCreationCapForOrg.Input( + path: path, + headers: headers + )) + } + /// Update pull request creation cap for an org + /// + /// Updates the pull request creation cap for an organization. The cap limits the total number + /// of open pull requests a user can have across all public repositories in the organization + /// at one time. + /// + /// Only users with admin access to the organization can configure the cap. + /// + /// - Remark: HTTP `PATCH /orgs/{org}/interaction-limits/pulls/creation-cap`. + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/patch(interactions/update-pull-request-creation-cap-for-org)`. + public func interactionsUpdatePullRequestCreationCapForOrg( + path: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input.Path, + headers: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input.Headers = .init(), + body: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input.Body + ) async throws -> Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output { + try await interactionsUpdatePullRequestCreationCapForOrg(Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input( + path: path, + headers: headers, + body: body + )) + } /// Get interaction restrictions for a repository /// /// Shows which type of GitHub user can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response. @@ -1308,6 +1370,585 @@ public enum Operations { case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) } } + /// Get pull request creation cap for an org + /// + /// Gets the pull request creation cap configuration for an organization. + /// The cap limits the total number of open pull requests a user can have across all public + /// repositories in the organization at one time. + /// + /// Only users with admin access to the organization can view the cap configuration. + /// + /// - Remark: HTTP `GET /orgs/{org}/interaction-limits/pulls/creation-cap`. + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/get(interactions/get-pull-request-creation-cap-for-org)`. + public enum InteractionsGetPullRequestCreationCapForOrg { + public static let id: Swift.String = "interactions/get-pull-request-creation-cap-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/GET/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/GET/path/org`. + public var org: Components.Parameters.Org + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + public init(org: Components.Parameters.Org) { + self.org = org + } + } + public var path: Operations.InteractionsGetPullRequestCreationCapForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.InteractionsGetPullRequestCreationCapForOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.InteractionsGetPullRequestCreationCapForOrg.Input.Path, + headers: Operations.InteractionsGetPullRequestCreationCapForOrg.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/GET/responses/200/content/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// Whether the pull request creation cap is enabled + /// + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/GET/responses/200/content/json/enabled`. + public var enabled: Swift.Bool + /// The maximum number of open pull requests a user can have at one time + /// + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/GET/responses/200/content/json/max_open_pull_requests`. + public var maxOpenPullRequests: Swift.Int + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - enabled: Whether the pull request creation cap is enabled + /// - maxOpenPullRequests: The maximum number of open pull requests a user can have at one time + public init( + enabled: Swift.Bool, + maxOpenPullRequests: Swift.Int + ) { + self.enabled = enabled + self.maxOpenPullRequests = maxOpenPullRequests + } + public enum CodingKeys: String, CodingKey { + case enabled + case maxOpenPullRequests = "max_open_pull_requests" + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/GET/responses/200/content/application\/json`. + case json(Operations.InteractionsGetPullRequestCreationCapForOrg.Output.Ok.Body.JsonPayload) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Operations.InteractionsGetPullRequestCreationCapForOrg.Output.Ok.Body.JsonPayload { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.InteractionsGetPullRequestCreationCapForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.InteractionsGetPullRequestCreationCapForOrg.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/get(interactions/get-pull-request-creation-cap-for-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.InteractionsGetPullRequestCreationCapForOrg.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.InteractionsGetPullRequestCreationCapForOrg.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/get(interactions/get-pull-request-creation-cap-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/get(interactions/get-pull-request-creation-cap-for-org)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + public struct MethodNotAllowed: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/GET/responses/405/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/GET/responses/405/content/application\/json`. + case json(Components.Schemas.BasicError) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.BasicError { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.InteractionsGetPullRequestCreationCapForOrg.Output.MethodNotAllowed.Body + /// Creates a new `MethodNotAllowed`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.InteractionsGetPullRequestCreationCapForOrg.Output.MethodNotAllowed.Body) { + self.body = body + } + } + /// Method Not Allowed + /// + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/get(interactions/get-pull-request-creation-cap-for-org)/responses/405`. + /// + /// HTTP response code: `405 methodNotAllowed`. + case methodNotAllowed(Operations.InteractionsGetPullRequestCreationCapForOrg.Output.MethodNotAllowed) + /// The associated value of the enum case if `self` is `.methodNotAllowed`. + /// + /// - Throws: An error if `self` is not `.methodNotAllowed`. + /// - SeeAlso: `.methodNotAllowed`. + public var methodNotAllowed: Operations.InteractionsGetPullRequestCreationCapForOrg.Output.MethodNotAllowed { + get throws { + switch self { + case let .methodNotAllowed(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "methodNotAllowed", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Update pull request creation cap for an org + /// + /// Updates the pull request creation cap for an organization. The cap limits the total number + /// of open pull requests a user can have across all public repositories in the organization + /// at one time. + /// + /// Only users with admin access to the organization can configure the cap. + /// + /// - Remark: HTTP `PATCH /orgs/{org}/interaction-limits/pulls/creation-cap`. + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/patch(interactions/update-pull-request-creation-cap-for-org)`. + public enum InteractionsUpdatePullRequestCreationCapForOrg { + public static let id: Swift.String = "interactions/update-pull-request-creation-cap-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/path/org`. + public var org: Components.Parameters.Org + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + public init(org: Components.Parameters.Org) { + self.org = org + } + } + public var path: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input.Headers + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// Whether the pull request creation cap is enabled + /// + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/requestBody/json/enabled`. + public var enabled: Swift.Bool + /// The maximum number of open pull requests a user can have at one time + /// + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/requestBody/json/max_open_pull_requests`. + public var maxOpenPullRequests: Swift.Int? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - enabled: Whether the pull request creation cap is enabled + /// - maxOpenPullRequests: The maximum number of open pull requests a user can have at one time + public init( + enabled: Swift.Bool, + maxOpenPullRequests: Swift.Int? = nil + ) { + self.enabled = enabled + self.maxOpenPullRequests = maxOpenPullRequests + } + public enum CodingKeys: String, CodingKey { + case enabled + case maxOpenPullRequests = "max_open_pull_requests" + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/requestBody/content/application\/json`. + case json(Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input.Body.JsonPayload) + } + public var body: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input.Path, + headers: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input.Headers = .init(), + body: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/responses/200/content/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// Whether the pull request creation cap is enabled + /// + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/responses/200/content/json/enabled`. + public var enabled: Swift.Bool + /// The maximum number of open pull requests a user can have at one time + /// + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/responses/200/content/json/max_open_pull_requests`. + public var maxOpenPullRequests: Swift.Int + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - enabled: Whether the pull request creation cap is enabled + /// - maxOpenPullRequests: The maximum number of open pull requests a user can have at one time + public init( + enabled: Swift.Bool, + maxOpenPullRequests: Swift.Int + ) { + self.enabled = enabled + self.maxOpenPullRequests = maxOpenPullRequests + } + public enum CodingKeys: String, CodingKey { + case enabled + case maxOpenPullRequests = "max_open_pull_requests" + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/responses/200/content/application\/json`. + case json(Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.Ok.Body.JsonPayload) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.Ok.Body.JsonPayload { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/patch(interactions/update-pull-request-creation-cap-for-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/patch(interactions/update-pull-request-creation-cap-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/patch(interactions/update-pull-request-creation-cap-for-org)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + public struct MethodNotAllowed: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/responses/405/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/interaction-limits/pulls/creation-cap/PATCH/responses/405/content/application\/json`. + case json(Components.Schemas.BasicError) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.BasicError { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.MethodNotAllowed.Body + /// Creates a new `MethodNotAllowed`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.MethodNotAllowed.Body) { + self.body = body + } + } + /// Method Not Allowed + /// + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/patch(interactions/update-pull-request-creation-cap-for-org)/responses/405`. + /// + /// HTTP response code: `405 methodNotAllowed`. + case methodNotAllowed(Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.MethodNotAllowed) + /// The associated value of the enum case if `self` is `.methodNotAllowed`. + /// + /// - Throws: An error if `self` is not `.methodNotAllowed`. + /// - SeeAlso: `.methodNotAllowed`. + public var methodNotAllowed: Operations.InteractionsUpdatePullRequestCreationCapForOrg.Output.MethodNotAllowed { + get throws { + switch self { + case let .methodNotAllowed(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "methodNotAllowed", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/interaction-limits/pulls/creation-cap/patch(interactions/update-pull-request-creation-cap-for-org)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } /// Get interaction restrictions for a repository /// /// Shows which type of GitHub user can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response. diff --git a/Sources/issues/Types.swift b/Sources/issues/Types.swift index 68ad3fd5e0..9f264c2397 100644 --- a/Sources/issues/Types.swift +++ b/Sources/issues/Types.swift @@ -16572,10 +16572,9 @@ public enum Operations { /// Pending suggestions for each suggestible field (`type`, /// `issue_field_values`, `labels`, `assignees`, `state`) the /// request touched. Omitted for fields not in the request or - /// with no pending suggestions. Items tagged `already_applied` - /// are echoes of the current request's inputs whose target is - /// already applied to the issue; they are not persisted as - /// pending suggestions. + /// with no pending or ignored suggestions. Items tagged + /// `ignored` are echoes of the current request's inputs that + /// were not persisted as pending suggestions. /// /// /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions`. @@ -16596,8 +16595,15 @@ public enum Operations { } /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/_TypePayload/confidence`. public var confidence: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload._TypePayloadPayload.ConfidencePayload? - /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/_TypePayload/already_applied`. - public var alreadyApplied: Swift.Bool? + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/_TypePayload/ignored`. + public var ignored: Swift.Bool? + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/_TypePayload/ignored_reason`. + @frozen public enum IgnoredReasonPayload: String, Codable, Hashable, Sendable, CaseIterable { + case alreadyApplied = "already_applied" + case issueAlreadyClosed = "issue_already_closed" + } + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/_TypePayload/ignored_reason`. + public var ignoredReason: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload._TypePayloadPayload.IgnoredReasonPayload? /// Creates a new `_TypePayloadPayload`. /// /// - Parameters: @@ -16605,26 +16611,30 @@ public enum Operations { /// - rationale: /// - suggest: /// - confidence: - /// - alreadyApplied: + /// - ignored: + /// - ignoredReason: public init( value: Swift.String? = nil, rationale: Swift.String? = nil, suggest: Swift.Bool? = nil, confidence: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload._TypePayloadPayload.ConfidencePayload? = nil, - alreadyApplied: Swift.Bool? = nil + ignored: Swift.Bool? = nil, + ignoredReason: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload._TypePayloadPayload.IgnoredReasonPayload? = nil ) { self.value = value self.rationale = rationale self.suggest = suggest self.confidence = confidence - self.alreadyApplied = alreadyApplied + self.ignored = ignored + self.ignoredReason = ignoredReason } public enum CodingKeys: String, CodingKey { case value case rationale case suggest case confidence - case alreadyApplied = "already_applied" + case ignored + case ignoredReason = "ignored_reason" } } /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/type`. @@ -16694,8 +16704,15 @@ public enum Operations { } /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/IssueFieldValuesPayload/confidence`. public var confidence: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.IssueFieldValuesPayloadPayload.ConfidencePayload? - /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/IssueFieldValuesPayload/already_applied`. - public var alreadyApplied: Swift.Bool? + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/IssueFieldValuesPayload/ignored`. + public var ignored: Swift.Bool? + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/IssueFieldValuesPayload/ignored_reason`. + @frozen public enum IgnoredReasonPayload: String, Codable, Hashable, Sendable, CaseIterable { + case alreadyApplied = "already_applied" + case issueAlreadyClosed = "issue_already_closed" + } + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/IssueFieldValuesPayload/ignored_reason`. + public var ignoredReason: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.IssueFieldValuesPayloadPayload.IgnoredReasonPayload? /// Creates a new `IssueFieldValuesPayloadPayload`. /// /// - Parameters: @@ -16704,21 +16721,24 @@ public enum Operations { /// - rationale: /// - suggest: /// - confidence: - /// - alreadyApplied: + /// - ignored: + /// - ignoredReason: public init( fieldId: Swift.Int? = nil, value: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.IssueFieldValuesPayloadPayload.ValuePayload? = nil, rationale: Swift.String? = nil, suggest: Swift.Bool? = nil, confidence: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.IssueFieldValuesPayloadPayload.ConfidencePayload? = nil, - alreadyApplied: Swift.Bool? = nil + ignored: Swift.Bool? = nil, + ignoredReason: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.IssueFieldValuesPayloadPayload.IgnoredReasonPayload? = nil ) { self.fieldId = fieldId self.value = value self.rationale = rationale self.suggest = suggest self.confidence = confidence - self.alreadyApplied = alreadyApplied + self.ignored = ignored + self.ignoredReason = ignoredReason } public enum CodingKeys: String, CodingKey { case fieldId = "field_id" @@ -16726,7 +16746,8 @@ public enum Operations { case rationale case suggest case confidence - case alreadyApplied = "already_applied" + case ignored + case ignoredReason = "ignored_reason" } } /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/issue_field_values`. @@ -16749,8 +16770,15 @@ public enum Operations { } /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/LabelsPayload/confidence`. public var confidence: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.LabelsPayloadPayload.ConfidencePayload? - /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/LabelsPayload/already_applied`. - public var alreadyApplied: Swift.Bool? + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/LabelsPayload/ignored`. + public var ignored: Swift.Bool? + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/LabelsPayload/ignored_reason`. + @frozen public enum IgnoredReasonPayload: String, Codable, Hashable, Sendable, CaseIterable { + case alreadyApplied = "already_applied" + case issueAlreadyClosed = "issue_already_closed" + } + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/LabelsPayload/ignored_reason`. + public var ignoredReason: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.LabelsPayloadPayload.IgnoredReasonPayload? /// Creates a new `LabelsPayloadPayload`. /// /// - Parameters: @@ -16758,26 +16786,30 @@ public enum Operations { /// - rationale: /// - suggest: /// - confidence: - /// - alreadyApplied: + /// - ignored: + /// - ignoredReason: public init( name: Swift.String? = nil, rationale: Swift.String? = nil, suggest: Swift.Bool? = nil, confidence: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.LabelsPayloadPayload.ConfidencePayload? = nil, - alreadyApplied: Swift.Bool? = nil + ignored: Swift.Bool? = nil, + ignoredReason: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.LabelsPayloadPayload.IgnoredReasonPayload? = nil ) { self.name = name self.rationale = rationale self.suggest = suggest self.confidence = confidence - self.alreadyApplied = alreadyApplied + self.ignored = ignored + self.ignoredReason = ignoredReason } public enum CodingKeys: String, CodingKey { case name case rationale case suggest case confidence - case alreadyApplied = "already_applied" + case ignored + case ignoredReason = "ignored_reason" } } /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/labels`. @@ -16800,8 +16832,15 @@ public enum Operations { } /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/AssigneesPayload/confidence`. public var confidence: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.AssigneesPayloadPayload.ConfidencePayload? - /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/AssigneesPayload/already_applied`. - public var alreadyApplied: Swift.Bool? + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/AssigneesPayload/ignored`. + public var ignored: Swift.Bool? + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/AssigneesPayload/ignored_reason`. + @frozen public enum IgnoredReasonPayload: String, Codable, Hashable, Sendable, CaseIterable { + case alreadyApplied = "already_applied" + case issueAlreadyClosed = "issue_already_closed" + } + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/AssigneesPayload/ignored_reason`. + public var ignoredReason: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.AssigneesPayloadPayload.IgnoredReasonPayload? /// Creates a new `AssigneesPayloadPayload`. /// /// - Parameters: @@ -16809,26 +16848,30 @@ public enum Operations { /// - rationale: /// - suggest: /// - confidence: - /// - alreadyApplied: + /// - ignored: + /// - ignoredReason: public init( login: Swift.String? = nil, rationale: Swift.String? = nil, suggest: Swift.Bool? = nil, confidence: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.AssigneesPayloadPayload.ConfidencePayload? = nil, - alreadyApplied: Swift.Bool? = nil + ignored: Swift.Bool? = nil, + ignoredReason: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.AssigneesPayloadPayload.IgnoredReasonPayload? = nil ) { self.login = login self.rationale = rationale self.suggest = suggest self.confidence = confidence - self.alreadyApplied = alreadyApplied + self.ignored = ignored + self.ignoredReason = ignoredReason } public enum CodingKeys: String, CodingKey { case login case rationale case suggest case confidence - case alreadyApplied = "already_applied" + case ignored + case ignoredReason = "ignored_reason" } } /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/assignees`. @@ -16855,8 +16898,15 @@ public enum Operations { } /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/StatePayload/confidence`. public var confidence: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.StatePayloadPayload.ConfidencePayload? - /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/StatePayload/already_applied`. - public var alreadyApplied: Swift.Bool? + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/StatePayload/ignored`. + public var ignored: Swift.Bool? + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/StatePayload/ignored_reason`. + @frozen public enum IgnoredReasonPayload: String, Codable, Hashable, Sendable, CaseIterable { + case alreadyApplied = "already_applied" + case issueAlreadyClosed = "issue_already_closed" + } + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/StatePayload/ignored_reason`. + public var ignoredReason: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.StatePayloadPayload.IgnoredReasonPayload? /// Creates a new `StatePayloadPayload`. /// /// - Parameters: @@ -16866,7 +16916,8 @@ public enum Operations { /// - rationale: /// - suggest: /// - confidence: - /// - alreadyApplied: + /// - ignored: + /// - ignoredReason: public init( value: Swift.String? = nil, stateReason: Swift.String? = nil, @@ -16874,7 +16925,8 @@ public enum Operations { rationale: Swift.String? = nil, suggest: Swift.Bool? = nil, confidence: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.StatePayloadPayload.ConfidencePayload? = nil, - alreadyApplied: Swift.Bool? = nil + ignored: Swift.Bool? = nil, + ignoredReason: Operations.IssuesUpdate.Output.Ok.Body.JsonPayload.Value2Payload.SuggestionsPayload.StatePayloadPayload.IgnoredReasonPayload? = nil ) { self.value = value self.stateReason = stateReason @@ -16882,7 +16934,8 @@ public enum Operations { self.rationale = rationale self.suggest = suggest self.confidence = confidence - self.alreadyApplied = alreadyApplied + self.ignored = ignored + self.ignoredReason = ignoredReason } public enum CodingKeys: String, CodingKey { case value @@ -16891,7 +16944,8 @@ public enum Operations { case rationale case suggest case confidence - case alreadyApplied = "already_applied" + case ignored + case ignoredReason = "ignored_reason" } } /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions/state`. @@ -16930,10 +16984,9 @@ public enum Operations { /// Pending suggestions for each suggestible field (`type`, /// `issue_field_values`, `labels`, `assignees`, `state`) the /// request touched. Omitted for fields not in the request or - /// with no pending suggestions. Items tagged `already_applied` - /// are echoes of the current request's inputs whose target is - /// already applied to the issue; they are not persisted as - /// pending suggestions. + /// with no pending or ignored suggestions. Items tagged + /// `ignored` are echoes of the current request's inputs that + /// were not persisted as pending suggestions. /// /// /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/issues/{issue_number}/PATCH/responses/200/content/json/value2/suggestions`. diff --git a/Sources/meta/Client.swift b/Sources/meta/Client.swift index 299707169f..30f613ba11 100644 --- a/Sources/meta/Client.swift +++ b/Sources/meta/Client.swift @@ -104,7 +104,7 @@ public struct Client: APIProtocol { /// /// Returns meta information about GitHub, including a list of GitHub's IP addresses. For more information, see "[About GitHub's IP addresses](https://docs.github.com/articles/about-github-s-ip-addresses/)." /// - /// The API's response also includes a list of GitHub's domain names. + /// The API's response also includes a list of GitHub's domain names, and the public keys used by GitHub to sign commits made through the web UI. /// /// The values shown in the documentation's response are example values. You must always query the API directly to get the latest values. /// diff --git a/Sources/meta/Types.swift b/Sources/meta/Types.swift index 283ea5537f..c6208adf33 100644 --- a/Sources/meta/Types.swift +++ b/Sources/meta/Types.swift @@ -22,7 +22,7 @@ public protocol APIProtocol: Sendable { /// /// Returns meta information about GitHub, including a list of GitHub's IP addresses. For more information, see "[About GitHub's IP addresses](https://docs.github.com/articles/about-github-s-ip-addresses/)." /// - /// The API's response also includes a list of GitHub's domain names. + /// The API's response also includes a list of GitHub's domain names, and the public keys used by GitHub to sign commits made through the web UI. /// /// The values shown in the documentation's response are example values. You must always query the API directly to get the latest values. /// @@ -70,7 +70,7 @@ extension APIProtocol { /// /// Returns meta information about GitHub, including a list of GitHub's IP addresses. For more information, see "[About GitHub's IP addresses](https://docs.github.com/articles/about-github-s-ip-addresses/)." /// - /// The API's response also includes a list of GitHub's domain names. + /// The API's response also includes a list of GitHub's domain names, and the public keys used by GitHub to sign commits made through the web UI. /// /// The values shown in the documentation's response are example values. You must always query the API directly to get the latest values. /// @@ -470,6 +470,8 @@ public enum Components { public var copilot: [Swift.String]? /// - Remark: Generated from `#/components/schemas/api-overview/domains/packages`. public var packages: [Swift.String]? + /// - Remark: Generated from `#/components/schemas/api-overview/domains/storage`. + public var storage: [Swift.String]? /// - Remark: Generated from `#/components/schemas/api-overview/domains/actions`. public var actions: [Swift.String]? /// - Remark: Generated from `#/components/schemas/api-overview/domains/actions_inbound`. @@ -529,6 +531,7 @@ public enum Components { /// - codespaces: /// - copilot: /// - packages: + /// - storage: /// - actions: /// - actionsInbound: /// - artifactAttestations: @@ -537,6 +540,7 @@ public enum Components { codespaces: [Swift.String]? = nil, copilot: [Swift.String]? = nil, packages: [Swift.String]? = nil, + storage: [Swift.String]? = nil, actions: [Swift.String]? = nil, actionsInbound: Components.Schemas.ApiOverview.DomainsPayload.ActionsInboundPayload? = nil, artifactAttestations: Components.Schemas.ApiOverview.DomainsPayload.ArtifactAttestationsPayload? = nil @@ -545,6 +549,7 @@ public enum Components { self.codespaces = codespaces self.copilot = copilot self.packages = packages + self.storage = storage self.actions = actions self.actionsInbound = actionsInbound self.artifactAttestations = artifactAttestations @@ -554,6 +559,7 @@ public enum Components { case codespaces case copilot case packages + case storage case actions case actionsInbound = "actions_inbound" case artifactAttestations = "artifact_attestations" @@ -804,7 +810,7 @@ public enum Operations { /// /// Returns meta information about GitHub, including a list of GitHub's IP addresses. For more information, see "[About GitHub's IP addresses](https://docs.github.com/articles/about-github-s-ip-addresses/)." /// - /// The API's response also includes a list of GitHub's domain names. + /// The API's response also includes a list of GitHub's domain names, and the public keys used by GitHub to sign commits made through the web UI. /// /// The values shown in the documentation's response are example values. You must always query the API directly to get the latest values. /// diff --git a/Sources/pulls/Client.swift b/Sources/pulls/Client.swift index 8e34d5d357..ccaf22f326 100644 --- a/Sources/pulls/Client.swift +++ b/Sources/pulls/Client.swift @@ -1870,6 +1870,338 @@ public struct Client: APIProtocol { } ) } + /// Merge a pull request asynchronously + /// + /// Merges a pull request into the base branch in the background. Merging in this way allows certain types of errors to be retried, and avoids the risk of timeouts for particularly complex merges. + /// + /// This is the required method for merging stacked PRs, but also supports unstacked PRs. When using this endpoint to merge a stacked pull request, all pull requests in the stack up to and including the requested PR will be merged into the base branch. + /// + /// The response includes a UUID that can be used to fetch the result of the merge. If another asynchronous merge request has already been made for this pull request, the UUID of that request will be returned instead with a 409 response status to indicate that the merge options may be different from those that were requested. If there isn't an existing asynchronous merge request, a 202 response status is used. + /// + /// If the pull request is already merged, the merge commit OID will be returned immediately with a 200 status. + /// + /// If the pull request cannot be merged (e.g. because it is closed, or still a draft) this result will be returned immediately with a 400 response status. Branch protection rules and repository rules are not run at this stage, only basic pull request state checks are performed. + /// + /// - Remark: HTTP `PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge-async`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/put(pulls/merge-async)`. + public func pullsMergeAsync(_ input: Operations.PullsMergeAsync.Input) async throws -> Operations.PullsMergeAsync.Output { + try await client.send( + input: input, + forOperation: Operations.PullsMergeAsync.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/repos/{}/{}/pulls/{}/merge-async", + parameters: [ + input.path.owner, + input.path.repo, + input.path.pullNumber + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .put + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case .none: + body = nil + case let .json(value): + body = try converter.setOptionalRequestBodyAsJSON( + value, + headerFields: &request.headerFields, + contentType: "application/json; charset=utf-8" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 202: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.PullsMergeAsync.Output.Accepted.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.PullRequestMergeAsyncResult.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .accepted(.init(body: body)) + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.PullsMergeAsync.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.PullRequestMergeAsyncResult.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 409: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.PullsMergeAsync.Output.Conflict.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.PullRequestMergeAsyncResult.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .conflict(.init(body: body)) + case 400: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.PullsMergeAsync.Output.BadRequest.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.PullRequestMergeAsyncResult.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .badRequest(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .unprocessableContent(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Get the result of an asynchronous merge + /// + /// Fetches the current result of an asynchronous merge request, identified by the UUID that was returned when the merge was requested. + /// + /// While the merge is still queued, the response includes the UUID, merge method, and expected head SHA of the request. Once the merge has completed, the response reports whether it was merged, including the merge commit OID on success or a message describing why it could not be merged on failure. + /// + /// The result of an asynchronous merge request is retained for 24 hours after its most recent update. After this window the request expires and this endpoint returns a `404` response for its UUID. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/get(pulls/get-merge-async-result)`. + public func pullsGetMergeAsyncResult(_ input: Operations.PullsGetMergeAsyncResult.Input) async throws -> Operations.PullsGetMergeAsyncResult.Output { + try await client.send( + input: input, + forOperation: Operations.PullsGetMergeAsyncResult.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/repos/{}/{}/pulls/{}/merge-async/{}", + parameters: [ + input.path.owner, + input.path.repo, + input.path.pullNumber, + input.path.uuid + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.PullsGetMergeAsyncResult.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.PullRequestMergeAsyncResult.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } /// Get all requested reviewers for a pull request /// /// Gets the users or teams whose review is requested for a pull request. Once a requested reviewer submits a review, they are no longer considered a requested reviewer. Their review will instead be returned by the [List reviews for a pull request](https://docs.github.com/rest/pulls/reviews#list-reviews-for-a-pull-request) operation. diff --git a/Sources/pulls/Types.swift b/Sources/pulls/Types.swift index 7a25b2b599..b712b3f5e1 100644 --- a/Sources/pulls/Types.swift +++ b/Sources/pulls/Types.swift @@ -245,6 +245,32 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge`. /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge/put(pulls/merge)`. func pullsMerge(_ input: Operations.PullsMerge.Input) async throws -> Operations.PullsMerge.Output + /// Merge a pull request asynchronously + /// + /// Merges a pull request into the base branch in the background. Merging in this way allows certain types of errors to be retried, and avoids the risk of timeouts for particularly complex merges. + /// + /// This is the required method for merging stacked PRs, but also supports unstacked PRs. When using this endpoint to merge a stacked pull request, all pull requests in the stack up to and including the requested PR will be merged into the base branch. + /// + /// The response includes a UUID that can be used to fetch the result of the merge. If another asynchronous merge request has already been made for this pull request, the UUID of that request will be returned instead with a 409 response status to indicate that the merge options may be different from those that were requested. If there isn't an existing asynchronous merge request, a 202 response status is used. + /// + /// If the pull request is already merged, the merge commit OID will be returned immediately with a 200 status. + /// + /// If the pull request cannot be merged (e.g. because it is closed, or still a draft) this result will be returned immediately with a 400 response status. Branch protection rules and repository rules are not run at this stage, only basic pull request state checks are performed. + /// + /// - Remark: HTTP `PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge-async`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/put(pulls/merge-async)`. + func pullsMergeAsync(_ input: Operations.PullsMergeAsync.Input) async throws -> Operations.PullsMergeAsync.Output + /// Get the result of an asynchronous merge + /// + /// Fetches the current result of an asynchronous merge request, identified by the UUID that was returned when the merge was requested. + /// + /// While the merge is still queued, the response includes the UUID, merge method, and expected head SHA of the request. Once the merge has completed, the response reports whether it was merged, including the merge commit OID on success or a message describing why it could not be merged on failure. + /// + /// The result of an asynchronous merge request is retained for 24 hours after its most recent update. After this window the request expires and this endpoint returns a `404` response for its UUID. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/get(pulls/get-merge-async-result)`. + func pullsGetMergeAsyncResult(_ input: Operations.PullsGetMergeAsyncResult.Input) async throws -> Operations.PullsGetMergeAsyncResult.Output /// Get all requested reviewers for a pull request /// /// Gets the users or teams whose review is requested for a pull request. Once a requested reviewer submits a review, they are no longer considered a requested reviewer. Their review will instead be returned by the [List reviews for a pull request](https://docs.github.com/rest/pulls/reviews#list-reviews-for-a-pull-request) operation. @@ -816,6 +842,50 @@ extension APIProtocol { body: body )) } + /// Merge a pull request asynchronously + /// + /// Merges a pull request into the base branch in the background. Merging in this way allows certain types of errors to be retried, and avoids the risk of timeouts for particularly complex merges. + /// + /// This is the required method for merging stacked PRs, but also supports unstacked PRs. When using this endpoint to merge a stacked pull request, all pull requests in the stack up to and including the requested PR will be merged into the base branch. + /// + /// The response includes a UUID that can be used to fetch the result of the merge. If another asynchronous merge request has already been made for this pull request, the UUID of that request will be returned instead with a 409 response status to indicate that the merge options may be different from those that were requested. If there isn't an existing asynchronous merge request, a 202 response status is used. + /// + /// If the pull request is already merged, the merge commit OID will be returned immediately with a 200 status. + /// + /// If the pull request cannot be merged (e.g. because it is closed, or still a draft) this result will be returned immediately with a 400 response status. Branch protection rules and repository rules are not run at this stage, only basic pull request state checks are performed. + /// + /// - Remark: HTTP `PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge-async`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/put(pulls/merge-async)`. + public func pullsMergeAsync( + path: Operations.PullsMergeAsync.Input.Path, + headers: Operations.PullsMergeAsync.Input.Headers = .init(), + body: Operations.PullsMergeAsync.Input.Body? = nil + ) async throws -> Operations.PullsMergeAsync.Output { + try await pullsMergeAsync(Operations.PullsMergeAsync.Input( + path: path, + headers: headers, + body: body + )) + } + /// Get the result of an asynchronous merge + /// + /// Fetches the current result of an asynchronous merge request, identified by the UUID that was returned when the merge was requested. + /// + /// While the merge is still queued, the response includes the UUID, merge method, and expected head SHA of the request. Once the merge has completed, the response reports whether it was merged, including the merge commit OID on success or a message describing why it could not be merged on failure. + /// + /// The result of an asynchronous merge request is retained for 24 hours after its most recent update. After this window the request expires and this endpoint returns a `404` response for its UUID. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/get(pulls/get-merge-async-result)`. + public func pullsGetMergeAsyncResult( + path: Operations.PullsGetMergeAsyncResult.Input.Path, + headers: Operations.PullsGetMergeAsyncResult.Input.Headers = .init() + ) async throws -> Operations.PullsGetMergeAsyncResult.Output { + try await pullsGetMergeAsyncResult(Operations.PullsGetMergeAsyncResult.Input( + path: path, + headers: headers + )) + } /// Get all requested reviewers for a pull request /// /// Gets the users or teams whose review is requested for a pull request. Once a requested reviewer submits a review, they are no longer considered a requested reviewer. Their review will instead be returned by the [List reviews for a pull request](https://docs.github.com/rest/pulls/reviews#list-reviews-for-a-pull-request) operation. @@ -5264,6 +5334,259 @@ public enum Components { case message } } + /// Pull Request Merge Async Result + /// + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result`. + public struct PullRequestMergeAsyncResult: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/status`. + @frozen public enum StatusPayload: String, Codable, Hashable, Sendable, CaseIterable { + case pending = "pending" + case merged = "merged" + case enqueued = "enqueued" + case failed = "failed" + } + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/status`. + public var status: Components.Schemas.PullRequestMergeAsyncResult.StatusPayload + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details`. + @frozen public enum DetailsPayload: Codable, Hashable, Sendable { + /// When an asynchronous merge request was created or already existed + /// + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case1`. + public struct Case1Payload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case1/message`. + public var message: Swift.String + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case1/uuid`. + public var uuid: Swift.String + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case1/merge_method`. + @frozen public enum MergeMethodPayload: String, Codable, Hashable, Sendable, CaseIterable { + case _default = "default" + case merge = "merge" + case squash = "squash" + case rebase = "rebase" + } + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case1/merge_method`. + public var mergeMethod: Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload.Case1Payload.MergeMethodPayload + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case1/merge_action`. + @frozen public enum MergeActionPayload: String, Codable, Hashable, Sendable, CaseIterable { + case _default = "default" + case mergeQueue = "merge_queue" + case directMerge = "direct_merge" + } + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case1/merge_action`. + public var mergeAction: Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload.Case1Payload.MergeActionPayload + /// SHA that the pull request head must match for the enqueued merge to proceed. + /// + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case1/expected_head_sha`. + public var expectedHeadSha: Swift.String + /// Creates a new `Case1Payload`. + /// + /// - Parameters: + /// - message: + /// - uuid: + /// - mergeMethod: + /// - mergeAction: + /// - expectedHeadSha: SHA that the pull request head must match for the enqueued merge to proceed. + public init( + message: Swift.String, + uuid: Swift.String, + mergeMethod: Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload.Case1Payload.MergeMethodPayload, + mergeAction: Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload.Case1Payload.MergeActionPayload, + expectedHeadSha: Swift.String + ) { + self.message = message + self.uuid = uuid + self.mergeMethod = mergeMethod + self.mergeAction = mergeAction + self.expectedHeadSha = expectedHeadSha + } + public enum CodingKeys: String, CodingKey { + case message + case uuid + case mergeMethod = "merge_method" + case mergeAction = "merge_action" + case expectedHeadSha = "expected_head_sha" + } + public init(from decoder: any Swift.Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.message = try container.decode( + Swift.String.self, + forKey: .message + ) + self.uuid = try container.decode( + Swift.String.self, + forKey: .uuid + ) + self.mergeMethod = try container.decode( + Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload.Case1Payload.MergeMethodPayload.self, + forKey: .mergeMethod + ) + self.mergeAction = try container.decode( + Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload.Case1Payload.MergeActionPayload.self, + forKey: .mergeAction + ) + self.expectedHeadSha = try container.decode( + Swift.String.self, + forKey: .expectedHeadSha + ) + try decoder.ensureNoAdditionalProperties(knownKeys: [ + "message", + "uuid", + "merge_method", + "merge_action", + "expected_head_sha" + ]) + } + } + /// When an asynchronous merge request was created or already existed + /// + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case1`. + case case1(Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload.Case1Payload) + /// When the pull request cannot be merged + /// + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case2`. + public struct Case2Payload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case2/message`. + public var message: Swift.String + /// Creates a new `Case2Payload`. + /// + /// - Parameters: + /// - message: + public init(message: Swift.String) { + self.message = message + } + public enum CodingKeys: String, CodingKey { + case message + } + public init(from decoder: any Swift.Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.message = try container.decode( + Swift.String.self, + forKey: .message + ) + try decoder.ensureNoAdditionalProperties(knownKeys: [ + "message" + ]) + } + } + /// When the pull request cannot be merged + /// + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case2`. + case case2(Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload.Case2Payload) + /// When the pull request is already merged + /// + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case3`. + public struct Case3Payload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case3/message`. + public var message: Swift.String + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case3/sha`. + public var sha: Swift.String + /// Creates a new `Case3Payload`. + /// + /// - Parameters: + /// - message: + /// - sha: + public init( + message: Swift.String, + sha: Swift.String + ) { + self.message = message + self.sha = sha + } + public enum CodingKeys: String, CodingKey { + case message + case sha + } + public init(from decoder: any Swift.Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.message = try container.decode( + Swift.String.self, + forKey: .message + ) + self.sha = try container.decode( + Swift.String.self, + forKey: .sha + ) + try decoder.ensureNoAdditionalProperties(knownKeys: [ + "message", + "sha" + ]) + } + } + /// When the pull request is already merged + /// + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details/case3`. + case case3(Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload.Case3Payload) + public init(from decoder: any Swift.Decoder) throws { + var errors: [any Swift.Error] = [] + do { + self = .case1(try .init(from: decoder)) + return + } catch { + errors.append(error) + } + do { + self = .case2(try .init(from: decoder)) + return + } catch { + errors.append(error) + } + do { + self = .case3(try .init(from: decoder)) + return + } catch { + errors.append(error) + } + throw Swift.DecodingError.failedToDecodeOneOfSchema( + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + public func encode(to encoder: any Swift.Encoder) throws { + switch self { + case let .case1(value): + try value.encode(to: encoder) + case let .case2(value): + try value.encode(to: encoder) + case let .case3(value): + try value.encode(to: encoder) + } + } + } + /// - Remark: Generated from `#/components/schemas/pull-request-merge-async-result/details`. + public var details: Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload + /// Creates a new `PullRequestMergeAsyncResult`. + /// + /// - Parameters: + /// - status: + /// - details: + public init( + status: Components.Schemas.PullRequestMergeAsyncResult.StatusPayload, + details: Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload + ) { + self.status = status + self.details = details + } + public enum CodingKeys: String, CodingKey { + case status + case details + } + public init(from decoder: any Swift.Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.status = try container.decode( + Components.Schemas.PullRequestMergeAsyncResult.StatusPayload.self, + forKey: .status + ) + self.details = try container.decode( + Components.Schemas.PullRequestMergeAsyncResult.DetailsPayload.self, + forKey: .details + ) + try decoder.ensureNoAdditionalProperties(knownKeys: [ + "status", + "details" + ]) + } + } /// Pull Request Review Request /// /// - Remark: Generated from `#/components/schemas/pull-request-review-request`. @@ -9965,6 +10288,665 @@ public enum Operations { } } } + /// Merge a pull request asynchronously + /// + /// Merges a pull request into the base branch in the background. Merging in this way allows certain types of errors to be retried, and avoids the risk of timeouts for particularly complex merges. + /// + /// This is the required method for merging stacked PRs, but also supports unstacked PRs. When using this endpoint to merge a stacked pull request, all pull requests in the stack up to and including the requested PR will be merged into the base branch. + /// + /// The response includes a UUID that can be used to fetch the result of the merge. If another asynchronous merge request has already been made for this pull request, the UUID of that request will be returned instead with a 409 response status to indicate that the merge options may be different from those that were requested. If there isn't an existing asynchronous merge request, a 202 response status is used. + /// + /// If the pull request is already merged, the merge commit OID will be returned immediately with a 200 status. + /// + /// If the pull request cannot be merged (e.g. because it is closed, or still a draft) this result will be returned immediately with a 400 response status. Branch protection rules and repository rules are not run at this stage, only basic pull request state checks are performed. + /// + /// - Remark: HTTP `PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge-async`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/put(pulls/merge-async)`. + public enum PullsMergeAsync { + public static let id: Swift.String = "pulls/merge-async" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/path`. + public struct Path: Sendable, Hashable { + /// The account owner of the repository. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/path/owner`. + public var owner: Components.Parameters.Owner + /// The name of the repository without the `.git` extension. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/path/repo`. + public var repo: Components.Parameters.Repo + /// The number that identifies the pull request. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/path/pull_number`. + public var pullNumber: Components.Parameters.PullNumber + /// Creates a new `Path`. + /// + /// - Parameters: + /// - owner: The account owner of the repository. The name is not case sensitive. + /// - repo: The name of the repository without the `.git` extension. The name is not case sensitive. + /// - pullNumber: The number that identifies the pull request. + public init( + owner: Components.Parameters.Owner, + repo: Components.Parameters.Repo, + pullNumber: Components.Parameters.PullNumber + ) { + self.owner = owner + self.repo = repo + self.pullNumber = pullNumber + } + } + public var path: Operations.PullsMergeAsync.Input.Path + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.PullsMergeAsync.Input.Headers + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// Title for the automatic commit message. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/requestBody/json/commit_title`. + public var commitTitle: Swift.String? + /// Extra detail to append to automatic commit message. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/requestBody/json/commit_message`. + public var commitMessage: Swift.String? + /// SHA that pull request head must match to allow merge. If not provided, the current head of the PR at the time of the request will be used; if the PR is pushed in between the merge being requested and being executed, the merge will be cancelled. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/requestBody/json/sha`. + public var sha: Swift.String? + /// The merge method to use. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/requestBody/json/merge_method`. + @frozen public enum MergeMethodPayload: String, Codable, Hashable, Sendable, CaseIterable { + case merge = "merge" + case squash = "squash" + case rebase = "rebase" + } + /// The merge method to use. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/requestBody/json/merge_method`. + public var mergeMethod: Operations.PullsMergeAsync.Input.Body.JsonPayload.MergeMethodPayload? + /// The action that will be taken to merge the pull request. `direct_merge` merges the pull request directly without using a merge queue; `merge_queue` adds the pull request to a merge queue; `default` selects the most appropriate option. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/requestBody/json/merge_action`. + @frozen public enum MergeActionPayload: String, Codable, Hashable, Sendable, CaseIterable { + case _default = "default" + case directMerge = "direct_merge" + case mergeQueue = "merge_queue" + } + /// The action that will be taken to merge the pull request. `direct_merge` merges the pull request directly without using a merge queue; `merge_queue` adds the pull request to a merge queue; `default` selects the most appropriate option. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/requestBody/json/merge_action`. + public var mergeAction: Operations.PullsMergeAsync.Input.Body.JsonPayload.MergeActionPayload? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - commitTitle: Title for the automatic commit message. + /// - commitMessage: Extra detail to append to automatic commit message. + /// - sha: SHA that pull request head must match to allow merge. If not provided, the current head of the PR at the time of the request will be used; if the PR is pushed in between the merge being requested and being executed, the merge will be cancelled. + /// - mergeMethod: The merge method to use. + /// - mergeAction: The action that will be taken to merge the pull request. `direct_merge` merges the pull request directly without using a merge queue; `merge_queue` adds the pull request to a merge queue; `default` selects the most appropriate option. + public init( + commitTitle: Swift.String? = nil, + commitMessage: Swift.String? = nil, + sha: Swift.String? = nil, + mergeMethod: Operations.PullsMergeAsync.Input.Body.JsonPayload.MergeMethodPayload? = nil, + mergeAction: Operations.PullsMergeAsync.Input.Body.JsonPayload.MergeActionPayload? = nil + ) { + self.commitTitle = commitTitle + self.commitMessage = commitMessage + self.sha = sha + self.mergeMethod = mergeMethod + self.mergeAction = mergeAction + } + public enum CodingKeys: String, CodingKey { + case commitTitle = "commit_title" + case commitMessage = "commit_message" + case sha + case mergeMethod = "merge_method" + case mergeAction = "merge_action" + } + } + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/requestBody/content/application\/json`. + case json(Operations.PullsMergeAsync.Input.Body.JsonPayload) + } + public var body: Operations.PullsMergeAsync.Input.Body? + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.PullsMergeAsync.Input.Path, + headers: Operations.PullsMergeAsync.Input.Headers = .init(), + body: Operations.PullsMergeAsync.Input.Body? = nil + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Accepted: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/responses/202/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/responses/202/content/application\/json`. + case json(Components.Schemas.PullRequestMergeAsyncResult) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.PullRequestMergeAsyncResult { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.PullsMergeAsync.Output.Accepted.Body + /// Creates a new `Accepted`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.PullsMergeAsync.Output.Accepted.Body) { + self.body = body + } + } + /// if the merge request was accepted and will run in the background + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/put(pulls/merge-async)/responses/202`. + /// + /// HTTP response code: `202 accepted`. + case accepted(Operations.PullsMergeAsync.Output.Accepted) + /// The associated value of the enum case if `self` is `.accepted`. + /// + /// - Throws: An error if `self` is not `.accepted`. + /// - SeeAlso: `.accepted`. + public var accepted: Operations.PullsMergeAsync.Output.Accepted { + get throws { + switch self { + case let .accepted(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "accepted", + response: self + ) + } + } + } + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/responses/200/content/application\/json`. + case json(Components.Schemas.PullRequestMergeAsyncResult) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.PullRequestMergeAsyncResult { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.PullsMergeAsync.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.PullsMergeAsync.Output.Ok.Body) { + self.body = body + } + } + /// if the pull request was already merged, or is already in a merge queue + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/put(pulls/merge-async)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.PullsMergeAsync.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.PullsMergeAsync.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + public struct Conflict: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/responses/409/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/responses/409/content/application\/json`. + case json(Components.Schemas.PullRequestMergeAsyncResult) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.PullRequestMergeAsyncResult { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.PullsMergeAsync.Output.Conflict.Body + /// Creates a new `Conflict`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.PullsMergeAsync.Output.Conflict.Body) { + self.body = body + } + } + /// if there is an existing merge request already enqueued for this pull request + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/put(pulls/merge-async)/responses/409`. + /// + /// HTTP response code: `409 conflict`. + case conflict(Operations.PullsMergeAsync.Output.Conflict) + /// The associated value of the enum case if `self` is `.conflict`. + /// + /// - Throws: An error if `self` is not `.conflict`. + /// - SeeAlso: `.conflict`. + public var conflict: Operations.PullsMergeAsync.Output.Conflict { + get throws { + switch self { + case let .conflict(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "conflict", + response: self + ) + } + } + } + public struct BadRequest: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/responses/400/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/PUT/responses/400/content/application\/json`. + case json(Components.Schemas.PullRequestMergeAsyncResult) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.PullRequestMergeAsyncResult { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.PullsMergeAsync.Output.BadRequest.Body + /// Creates a new `BadRequest`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.PullsMergeAsync.Output.BadRequest.Body) { + self.body = body + } + } + /// if the pull request is not ready to be merged, e.g. because it is closed + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/put(pulls/merge-async)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Operations.PullsMergeAsync.Output.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + public var badRequest: Operations.PullsMergeAsync.Output.BadRequest { + get throws { + switch self { + case let .badRequest(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/put(pulls/merge-async)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/put(pulls/merge-async)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/put(pulls/merge-async)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Get the result of an asynchronous merge + /// + /// Fetches the current result of an asynchronous merge request, identified by the UUID that was returned when the merge was requested. + /// + /// While the merge is still queued, the response includes the UUID, merge method, and expected head SHA of the request. Once the merge has completed, the response reports whether it was merged, including the merge commit OID on success or a message describing why it could not be merged on failure. + /// + /// The result of an asynchronous merge request is retained for 24 hours after its most recent update. After this window the request expires and this endpoint returns a `404` response for its UUID. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/get(pulls/get-merge-async-result)`. + public enum PullsGetMergeAsyncResult { + public static let id: Swift.String = "pulls/get-merge-async-result" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/GET/path`. + public struct Path: Sendable, Hashable { + /// The account owner of the repository. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/GET/path/owner`. + public var owner: Components.Parameters.Owner + /// The name of the repository without the `.git` extension. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/GET/path/repo`. + public var repo: Components.Parameters.Repo + /// The number that identifies the pull request. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/GET/path/pull_number`. + public var pullNumber: Components.Parameters.PullNumber + /// The UUID of the asynchronous merge request, as returned when the merge was requested. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/GET/path/uuid`. + public var uuid: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - owner: The account owner of the repository. The name is not case sensitive. + /// - repo: The name of the repository without the `.git` extension. The name is not case sensitive. + /// - pullNumber: The number that identifies the pull request. + /// - uuid: The UUID of the asynchronous merge request, as returned when the merge was requested. + public init( + owner: Components.Parameters.Owner, + repo: Components.Parameters.Repo, + pullNumber: Components.Parameters.PullNumber, + uuid: Swift.String + ) { + self.owner = owner + self.repo = repo + self.pullNumber = pullNumber + self.uuid = uuid + } + } + public var path: Operations.PullsGetMergeAsyncResult.Input.Path + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.PullsGetMergeAsyncResult.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.PullsGetMergeAsyncResult.Input.Path, + headers: Operations.PullsGetMergeAsyncResult.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/GET/responses/200/content/application\/json`. + case json(Components.Schemas.PullRequestMergeAsyncResult) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.PullRequestMergeAsyncResult { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.PullsGetMergeAsyncResult.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.PullsGetMergeAsyncResult.Output.Ok.Body) { + self.body = body + } + } + /// the current result of the asynchronous merge request + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/get(pulls/get-merge-async-result)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.PullsGetMergeAsyncResult.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.PullsGetMergeAsyncResult.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/get(pulls/get-merge-async-result)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/pulls/{pull_number}/merge-async/{uuid}/get(pulls/get-merge-async-result)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } /// Get all requested reviewers for a pull request /// /// Gets the users or teams whose review is requested for a pull request. Once a requested reviewer submits a review, they are no longer considered a requested reviewer. Their review will instead be returned by the [List reviews for a pull request](https://docs.github.com/rest/pulls/reviews#list-reviews-for-a-pull-request) operation. diff --git a/Sources/teams/Client.swift b/Sources/teams/Client.swift index b39b336875..7db0723e62 100644 --- a/Sources/teams/Client.swift +++ b/Sources/teams/Client.swift @@ -994,6 +994,8 @@ public struct Client: APIProtocol { /// /// Lists a team's repositories visible to the authenticated user. /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` or `repo` scope to use this endpoint. + /// /// > [!NOTE] /// > You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos`. /// diff --git a/Sources/teams/Types.swift b/Sources/teams/Types.swift index d4140bdff9..41d7edb7b2 100644 --- a/Sources/teams/Types.swift +++ b/Sources/teams/Types.swift @@ -135,6 +135,8 @@ public protocol APIProtocol: Sendable { /// /// Lists a team's repositories visible to the authenticated user. /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` or `repo` scope to use this endpoint. + /// /// > [!NOTE] /// > You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos`. /// @@ -627,6 +629,8 @@ extension APIProtocol { /// /// Lists a team's repositories visible to the authenticated user. /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` or `repo` scope to use this endpoint. + /// /// > [!NOTE] /// > You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos`. /// @@ -4921,6 +4925,10 @@ public enum Operations { /// /// - Remark: Generated from `#/paths/orgs/{org}/teams/POST/requestBody/json/parent_team_id`. public var parentTeamId: Swift.Int? + /// The slug of a team to set as the parent team. Ignored when `parent_team_id` is also provided. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/teams/POST/requestBody/json/parent_team_slug`. + public var parentTeamSlug: Swift.String? /// Creates a new `JsonPayload`. /// /// - Parameters: @@ -4932,6 +4940,7 @@ public enum Operations { /// - notificationSetting: The notification setting the team has chosen. The options are: /// - permission: **Closing down notice**. The permission that new repositories will be added to the team with when none is specified. /// - parentTeamId: The ID of a team to set as the parent team. + /// - parentTeamSlug: The slug of a team to set as the parent team. Ignored when `parent_team_id` is also provided. public init( name: Swift.String, description: Swift.String? = nil, @@ -4940,7 +4949,8 @@ public enum Operations { privacy: Operations.TeamsCreate.Input.Body.JsonPayload.PrivacyPayload? = nil, notificationSetting: Operations.TeamsCreate.Input.Body.JsonPayload.NotificationSettingPayload? = nil, permission: Operations.TeamsCreate.Input.Body.JsonPayload.PermissionPayload? = nil, - parentTeamId: Swift.Int? = nil + parentTeamId: Swift.Int? = nil, + parentTeamSlug: Swift.String? = nil ) { self.name = name self.description = description @@ -4950,6 +4960,7 @@ public enum Operations { self.notificationSetting = notificationSetting self.permission = permission self.parentTeamId = parentTeamId + self.parentTeamSlug = parentTeamSlug } public enum CodingKeys: String, CodingKey { case name @@ -4960,6 +4971,7 @@ public enum Operations { case notificationSetting = "notification_setting" case permission case parentTeamId = "parent_team_id" + case parentTeamSlug = "parent_team_slug" } } /// - Remark: Generated from `#/paths/orgs/{org}/teams/POST/requestBody/content/application\/json`. @@ -5390,6 +5402,10 @@ public enum Operations { /// /// - Remark: Generated from `#/paths/orgs/{org}/teams/{team_slug}/PATCH/requestBody/json/parent_team_id`. public var parentTeamId: Swift.Int? + /// The slug of a team to set as the parent team. Ignored when `parent_team_id` is also provided. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/teams/{team_slug}/PATCH/requestBody/json/parent_team_slug`. + public var parentTeamSlug: Swift.String? /// Creates a new `JsonPayload`. /// /// - Parameters: @@ -5399,13 +5415,15 @@ public enum Operations { /// - notificationSetting: The notification setting the team has chosen. Editing teams without specifying this parameter leaves `notification_setting` intact. The options are: /// - permission: **Closing down notice**. The permission that new repositories will be added to the team with when none is specified. /// - parentTeamId: The ID of a team to set as the parent team. + /// - parentTeamSlug: The slug of a team to set as the parent team. Ignored when `parent_team_id` is also provided. public init( name: Swift.String? = nil, description: Swift.String? = nil, privacy: Operations.TeamsUpdateInOrg.Input.Body.JsonPayload.PrivacyPayload? = nil, notificationSetting: Operations.TeamsUpdateInOrg.Input.Body.JsonPayload.NotificationSettingPayload? = nil, permission: Operations.TeamsUpdateInOrg.Input.Body.JsonPayload.PermissionPayload? = nil, - parentTeamId: Swift.Int? = nil + parentTeamId: Swift.Int? = nil, + parentTeamSlug: Swift.String? = nil ) { self.name = name self.description = description @@ -5413,6 +5431,7 @@ public enum Operations { self.notificationSetting = notificationSetting self.permission = permission self.parentTeamId = parentTeamId + self.parentTeamSlug = parentTeamSlug } public enum CodingKeys: String, CodingKey { case name @@ -5421,6 +5440,7 @@ public enum Operations { case notificationSetting = "notification_setting" case permission case parentTeamId = "parent_team_id" + case parentTeamSlug = "parent_team_slug" } } /// - Remark: Generated from `#/paths/orgs/{org}/teams/{team_slug}/PATCH/requestBody/content/application\/json`. @@ -6783,6 +6803,8 @@ public enum Operations { /// /// Lists a team's repositories visible to the authenticated user. /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` or `repo` scope to use this endpoint. + /// /// > [!NOTE] /// > You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos`. /// @@ -7885,6 +7907,10 @@ public enum Operations { /// /// - Remark: Generated from `#/paths/teams/{team_id}/PATCH/requestBody/json/parent_team_id`. public var parentTeamId: Swift.Int? + /// The slug of a team to set as the parent team. Ignored when `parent_team_id` is also provided. + /// + /// - Remark: Generated from `#/paths/teams/{team_id}/PATCH/requestBody/json/parent_team_slug`. + public var parentTeamSlug: Swift.String? /// Creates a new `JsonPayload`. /// /// - Parameters: @@ -7894,13 +7920,15 @@ public enum Operations { /// - notificationSetting: The notification setting the team has chosen. Editing teams without specifying this parameter leaves `notification_setting` intact. The options are: /// - permission: **Closing down notice**. The permission that new repositories will be added to the team with when none is specified. /// - parentTeamId: The ID of a team to set as the parent team. + /// - parentTeamSlug: The slug of a team to set as the parent team. Ignored when `parent_team_id` is also provided. public init( name: Swift.String, description: Swift.String? = nil, privacy: Operations.TeamsUpdateLegacy.Input.Body.JsonPayload.PrivacyPayload? = nil, notificationSetting: Operations.TeamsUpdateLegacy.Input.Body.JsonPayload.NotificationSettingPayload? = nil, permission: Operations.TeamsUpdateLegacy.Input.Body.JsonPayload.PermissionPayload? = nil, - parentTeamId: Swift.Int? = nil + parentTeamId: Swift.Int? = nil, + parentTeamSlug: Swift.String? = nil ) { self.name = name self.description = description @@ -7908,6 +7936,7 @@ public enum Operations { self.notificationSetting = notificationSetting self.permission = permission self.parentTeamId = parentTeamId + self.parentTeamSlug = parentTeamSlug } public enum CodingKeys: String, CodingKey { case name @@ -7916,6 +7945,7 @@ public enum Operations { case notificationSetting = "notification_setting" case permission case parentTeamId = "parent_team_id" + case parentTeamSlug = "parent_team_slug" } } /// - Remark: Generated from `#/paths/teams/{team_id}/PATCH/requestBody/content/application\/json`. diff --git a/Submodule/github/rest-api-description b/Submodule/github/rest-api-description index 768a056f8e..e50419c4bb 160000 --- a/Submodule/github/rest-api-description +++ b/Submodule/github/rest-api-description @@ -1 +1 @@ -Subproject commit 768a056f8e09a337a050da627073cc3c99ba1607 +Subproject commit e50419c4bb8f2d1d34735044bb3b410863dc0a10