Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Sources/activity/Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3292,11 +3292,15 @@ public enum Components {
/// - Remark: Generated from `#/components/schemas/issue/performed_via_github_app`.
public var performedViaGithubApp: Components.Schemas.NullableIntegration?
/// - Remark: Generated from `#/components/schemas/issue/author_association`.
public var authorAssociation: Components.Schemas.AuthorAssociation
public var authorAssociation: Components.Schemas.AuthorAssociation?
/// - Remark: Generated from `#/components/schemas/issue/reactions`.
public var reactions: Components.Schemas.ReactionRollup?
/// - Remark: Generated from `#/components/schemas/issue/sub_issues_summary`.
public var subIssuesSummary: Components.Schemas.SubIssuesSummary?
/// URL to get the parent issue of this issue, if it is a sub-issue
///
/// - Remark: Generated from `#/components/schemas/issue/parent_issue_url`.
public var parentIssueUrl: Swift.String?
/// - Remark: Generated from `#/components/schemas/issue/issue_dependencies_summary`.
public var issueDependenciesSummary: Components.Schemas.IssueDependenciesSummary?
/// - Remark: Generated from `#/components/schemas/issue/issue_field_values`.
Expand Down Expand Up @@ -3340,6 +3344,7 @@ public enum Components {
/// - authorAssociation:
/// - reactions:
/// - subIssuesSummary:
/// - parentIssueUrl: URL to get the parent issue of this issue, if it is a sub-issue
/// - issueDependenciesSummary:
/// - issueFieldValues:
public init(
Expand Down Expand Up @@ -3376,9 +3381,10 @@ public enum Components {
_type: Components.Schemas.IssueType? = nil,
repository: Components.Schemas.Repository? = nil,
performedViaGithubApp: Components.Schemas.NullableIntegration? = nil,
authorAssociation: Components.Schemas.AuthorAssociation,
authorAssociation: Components.Schemas.AuthorAssociation? = nil,
reactions: Components.Schemas.ReactionRollup? = nil,
subIssuesSummary: Components.Schemas.SubIssuesSummary? = nil,
parentIssueUrl: Swift.String? = nil,
issueDependenciesSummary: Components.Schemas.IssueDependenciesSummary? = nil,
issueFieldValues: [Components.Schemas.IssueFieldValue]? = nil
) {
Expand Down Expand Up @@ -3418,6 +3424,7 @@ public enum Components {
self.authorAssociation = authorAssociation
self.reactions = reactions
self.subIssuesSummary = subIssuesSummary
self.parentIssueUrl = parentIssueUrl
self.issueDependenciesSummary = issueDependenciesSummary
self.issueFieldValues = issueFieldValues
}
Expand Down Expand Up @@ -3458,6 +3465,7 @@ public enum Components {
case authorAssociation = "author_association"
case reactions
case subIssuesSummary = "sub_issues_summary"
case parentIssueUrl = "parent_issue_url"
case issueDependenciesSummary = "issue_dependencies_summary"
case issueFieldValues = "issue_field_values"
}
Expand Down
139 changes: 139 additions & 0 deletions Sources/issues/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4450,6 +4450,145 @@ public struct Client: APIProtocol {
}
)
}
/// Get parent issue
///
/// You can use the REST API to get the parent issue of a sub-issue.
///
/// This endpoint supports the following custom media types. For more information, see [Media types](https://docs.github.com/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types).
///
/// - **`application/vnd.github.raw+json`**: Returns the raw markdown body. Response will include `body`. This is the default if you do not pass any specific media type.
/// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
/// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
/// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
///
/// - Remark: HTTP `GET /repos/{owner}/{repo}/issues/{issue_number}/parent`.
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/issues/{issue_number}/parent/get(issues/get-parent)`.
public func issuesGetParent(_ input: Operations.IssuesGetParent.Input) async throws -> Operations.IssuesGetParent.Output {
try await client.send(
input: input,
forOperation: Operations.IssuesGetParent.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/repos/{}/{}/issues/{}/parent",
parameters: [
input.path.owner,
input.path.repo,
input.path.issueNumber
]
)
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.IssuesGetParent.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.Issue.self,
from: responseBody,
transforming: { value in
.json(value)
}
)
default:
preconditionFailure("bestContentType chose an invalid content type.")
}
return .ok(.init(body: body))
case 301:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Components.Responses.MovedPermanently.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 .movedPermanently(.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 410:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Components.Responses.Gone.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 .gone(.init(body: body))
default:
return .undocumented(
statusCode: response.status.code,
.init(
headerFields: response.headerFields,
body: responseBody
)
)
}
}
)
}
/// Remove sub-issue
///
/// You can use the REST API to remove a sub-issue from an issue.
Expand Down
Loading