Skip to content

Commit 4214664

Browse files
Commit via running: make Sources/issues
1 parent 167d178 commit 4214664

File tree

2 files changed

+419
-4
lines changed

2 files changed

+419
-4
lines changed

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)