Skip to content

Commit 43b3621

Browse files
Merge pull request #142 from wei18/dependabot/submodules/Submodule/github/rest-api-description-f0dc156
Bump Submodule/github/rest-api-description from `883ec92` to `f0dc156`
2 parents 9924e16 + ee46b0b commit 43b3621

File tree

13 files changed

+1340
-3392
lines changed

13 files changed

+1340
-3392
lines changed

Sources/activity/Types.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3292,11 +3292,15 @@ public enum Components {
32923292
/// - Remark: Generated from `#/components/schemas/issue/performed_via_github_app`.
32933293
public var performedViaGithubApp: Components.Schemas.NullableIntegration?
32943294
/// - Remark: Generated from `#/components/schemas/issue/author_association`.
3295-
public var authorAssociation: Components.Schemas.AuthorAssociation
3295+
public var authorAssociation: Components.Schemas.AuthorAssociation?
32963296
/// - Remark: Generated from `#/components/schemas/issue/reactions`.
32973297
public var reactions: Components.Schemas.ReactionRollup?
32983298
/// - Remark: Generated from `#/components/schemas/issue/sub_issues_summary`.
32993299
public var subIssuesSummary: Components.Schemas.SubIssuesSummary?
3300+
/// URL to get the parent issue of this issue, if it is a sub-issue
3301+
///
3302+
/// - Remark: Generated from `#/components/schemas/issue/parent_issue_url`.
3303+
public var parentIssueUrl: Swift.String?
33003304
/// - Remark: Generated from `#/components/schemas/issue/issue_dependencies_summary`.
33013305
public var issueDependenciesSummary: Components.Schemas.IssueDependenciesSummary?
33023306
/// - Remark: Generated from `#/components/schemas/issue/issue_field_values`.
@@ -3340,6 +3344,7 @@ public enum Components {
33403344
/// - authorAssociation:
33413345
/// - reactions:
33423346
/// - subIssuesSummary:
3347+
/// - parentIssueUrl: URL to get the parent issue of this issue, if it is a sub-issue
33433348
/// - issueDependenciesSummary:
33443349
/// - issueFieldValues:
33453350
public init(
@@ -3376,9 +3381,10 @@ public enum Components {
33763381
_type: Components.Schemas.IssueType? = nil,
33773382
repository: Components.Schemas.Repository? = nil,
33783383
performedViaGithubApp: Components.Schemas.NullableIntegration? = nil,
3379-
authorAssociation: Components.Schemas.AuthorAssociation,
3384+
authorAssociation: Components.Schemas.AuthorAssociation? = nil,
33803385
reactions: Components.Schemas.ReactionRollup? = nil,
33813386
subIssuesSummary: Components.Schemas.SubIssuesSummary? = nil,
3387+
parentIssueUrl: Swift.String? = nil,
33823388
issueDependenciesSummary: Components.Schemas.IssueDependenciesSummary? = nil,
33833389
issueFieldValues: [Components.Schemas.IssueFieldValue]? = nil
33843390
) {
@@ -3418,6 +3424,7 @@ public enum Components {
34183424
self.authorAssociation = authorAssociation
34193425
self.reactions = reactions
34203426
self.subIssuesSummary = subIssuesSummary
3427+
self.parentIssueUrl = parentIssueUrl
34213428
self.issueDependenciesSummary = issueDependenciesSummary
34223429
self.issueFieldValues = issueFieldValues
34233430
}
@@ -3458,6 +3465,7 @@ public enum Components {
34583465
case authorAssociation = "author_association"
34593466
case reactions
34603467
case subIssuesSummary = "sub_issues_summary"
3468+
case parentIssueUrl = "parent_issue_url"
34613469
case issueDependenciesSummary = "issue_dependencies_summary"
34623470
case issueFieldValues = "issue_field_values"
34633471
}

Sources/issues/Client.swift

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4450,6 +4450,145 @@ public struct Client: APIProtocol {
44504450
}
44514451
)
44524452
}
4453+
/// Get parent issue
4454+
///
4455+
/// You can use the REST API to get the parent issue of a sub-issue.
4456+
///
4457+
/// 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).
4458+
///
4459+
/// - **`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.
4460+
/// - **`application/vnd.github.text+json`**: Returns a text only representation of the markdown body. Response will include `body_text`.
4461+
/// - **`application/vnd.github.html+json`**: Returns HTML rendered from the body's markdown. Response will include `body_html`.
4462+
/// - **`application/vnd.github.full+json`**: Returns raw, text, and HTML representations. Response will include `body`, `body_text`, and `body_html`.
4463+
///
4464+
/// - Remark: HTTP `GET /repos/{owner}/{repo}/issues/{issue_number}/parent`.
4465+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/issues/{issue_number}/parent/get(issues/get-parent)`.
4466+
public func issuesGetParent(_ input: Operations.IssuesGetParent.Input) async throws -> Operations.IssuesGetParent.Output {
4467+
try await client.send(
4468+
input: input,
4469+
forOperation: Operations.IssuesGetParent.id,
4470+
serializer: { input in
4471+
let path = try converter.renderedPath(
4472+
template: "/repos/{}/{}/issues/{}/parent",
4473+
parameters: [
4474+
input.path.owner,
4475+
input.path.repo,
4476+
input.path.issueNumber
4477+
]
4478+
)
4479+
var request: HTTPTypes.HTTPRequest = .init(
4480+
soar_path: path,
4481+
method: .get
4482+
)
4483+
suppressMutabilityWarning(&request)
4484+
converter.setAcceptHeader(
4485+
in: &request.headerFields,
4486+
contentTypes: input.headers.accept
4487+
)
4488+
return (request, nil)
4489+
},
4490+
deserializer: { response, responseBody in
4491+
switch response.status.code {
4492+
case 200:
4493+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4494+
let body: Operations.IssuesGetParent.Output.Ok.Body
4495+
let chosenContentType = try converter.bestContentType(
4496+
received: contentType,
4497+
options: [
4498+
"application/json"
4499+
]
4500+
)
4501+
switch chosenContentType {
4502+
case "application/json":
4503+
body = try await converter.getResponseBodyAsJSON(
4504+
Components.Schemas.Issue.self,
4505+
from: responseBody,
4506+
transforming: { value in
4507+
.json(value)
4508+
}
4509+
)
4510+
default:
4511+
preconditionFailure("bestContentType chose an invalid content type.")
4512+
}
4513+
return .ok(.init(body: body))
4514+
case 301:
4515+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4516+
let body: Components.Responses.MovedPermanently.Body
4517+
let chosenContentType = try converter.bestContentType(
4518+
received: contentType,
4519+
options: [
4520+
"application/json"
4521+
]
4522+
)
4523+
switch chosenContentType {
4524+
case "application/json":
4525+
body = try await converter.getResponseBodyAsJSON(
4526+
Components.Schemas.BasicError.self,
4527+
from: responseBody,
4528+
transforming: { value in
4529+
.json(value)
4530+
}
4531+
)
4532+
default:
4533+
preconditionFailure("bestContentType chose an invalid content type.")
4534+
}
4535+
return .movedPermanently(.init(body: body))
4536+
case 404:
4537+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4538+
let body: Components.Responses.NotFound.Body
4539+
let chosenContentType = try converter.bestContentType(
4540+
received: contentType,
4541+
options: [
4542+
"application/json"
4543+
]
4544+
)
4545+
switch chosenContentType {
4546+
case "application/json":
4547+
body = try await converter.getResponseBodyAsJSON(
4548+
Components.Schemas.BasicError.self,
4549+
from: responseBody,
4550+
transforming: { value in
4551+
.json(value)
4552+
}
4553+
)
4554+
default:
4555+
preconditionFailure("bestContentType chose an invalid content type.")
4556+
}
4557+
return .notFound(.init(body: body))
4558+
case 410:
4559+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4560+
let body: Components.Responses.Gone.Body
4561+
let chosenContentType = try converter.bestContentType(
4562+
received: contentType,
4563+
options: [
4564+
"application/json"
4565+
]
4566+
)
4567+
switch chosenContentType {
4568+
case "application/json":
4569+
body = try await converter.getResponseBodyAsJSON(
4570+
Components.Schemas.BasicError.self,
4571+
from: responseBody,
4572+
transforming: { value in
4573+
.json(value)
4574+
}
4575+
)
4576+
default:
4577+
preconditionFailure("bestContentType chose an invalid content type.")
4578+
}
4579+
return .gone(.init(body: body))
4580+
default:
4581+
return .undocumented(
4582+
statusCode: response.status.code,
4583+
.init(
4584+
headerFields: response.headerFields,
4585+
body: responseBody
4586+
)
4587+
)
4588+
}
4589+
}
4590+
)
4591+
}
44534592
/// Remove sub-issue
44544593
///
44554594
/// You can use the REST API to remove a sub-issue from an issue.

0 commit comments

Comments
 (0)