Skip to content

Commit 668a0ee

Browse files
Commit via running ake Sources/users
1 parent 76ae341 commit 668a0ee

File tree

2 files changed

+320
-2
lines changed

2 files changed

+320
-2
lines changed

Sources/users/Client.swift

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4362,6 +4362,96 @@ public struct Client: APIProtocol {
43624362
}
43634363
)
43644364
}
4365+
/// Get a user using their ID
4366+
///
4367+
/// Provides publicly available information about someone with a GitHub account. This method takes their durable user `ID` instead of their `login`, which can change over time.
4368+
///
4369+
/// The `email` key in the following response is the publicly visible email address from your GitHub [profile page](https://github.com/settings/profile). When setting up your profile, you can select a primary email address to be “public” which provides an email entry for this endpoint. If you do not set a public email address for `email`, then it will have a value of `null`. You only see publicly visible email addresses when authenticated with GitHub. For more information, see [Authentication](https://docs.github.com/rest/guides/getting-started-with-the-rest-api#authentication).
4370+
///
4371+
/// The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see "[Emails API](https://docs.github.com/rest/users/emails)".
4372+
///
4373+
/// - Remark: HTTP `GET /user/{account_id}`.
4374+
/// - Remark: Generated from `#/paths//user/{account_id}/get(users/get-by-id)`.
4375+
public func users_sol_get_hyphen_by_hyphen_id(_ input: Operations.users_sol_get_hyphen_by_hyphen_id.Input) async throws -> Operations.users_sol_get_hyphen_by_hyphen_id.Output {
4376+
try await client.send(
4377+
input: input,
4378+
forOperation: Operations.users_sol_get_hyphen_by_hyphen_id.id,
4379+
serializer: { input in
4380+
let path = try converter.renderedPath(
4381+
template: "/user/{}",
4382+
parameters: [
4383+
input.path.account_id
4384+
]
4385+
)
4386+
var request: HTTPTypes.HTTPRequest = .init(
4387+
soar_path: path,
4388+
method: .get
4389+
)
4390+
suppressMutabilityWarning(&request)
4391+
converter.setAcceptHeader(
4392+
in: &request.headerFields,
4393+
contentTypes: input.headers.accept
4394+
)
4395+
return (request, nil)
4396+
},
4397+
deserializer: { response, responseBody in
4398+
switch response.status.code {
4399+
case 200:
4400+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4401+
let body: Operations.users_sol_get_hyphen_by_hyphen_id.Output.Ok.Body
4402+
let chosenContentType = try converter.bestContentType(
4403+
received: contentType,
4404+
options: [
4405+
"application/json"
4406+
]
4407+
)
4408+
switch chosenContentType {
4409+
case "application/json":
4410+
body = try await converter.getResponseBodyAsJSON(
4411+
Operations.users_sol_get_hyphen_by_hyphen_id.Output.Ok.Body.jsonPayload.self,
4412+
from: responseBody,
4413+
transforming: { value in
4414+
.json(value)
4415+
}
4416+
)
4417+
default:
4418+
preconditionFailure("bestContentType chose an invalid content type.")
4419+
}
4420+
return .ok(.init(body: body))
4421+
case 404:
4422+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4423+
let body: Components.Responses.not_found.Body
4424+
let chosenContentType = try converter.bestContentType(
4425+
received: contentType,
4426+
options: [
4427+
"application/json"
4428+
]
4429+
)
4430+
switch chosenContentType {
4431+
case "application/json":
4432+
body = try await converter.getResponseBodyAsJSON(
4433+
Components.Schemas.basic_hyphen_error.self,
4434+
from: responseBody,
4435+
transforming: { value in
4436+
.json(value)
4437+
}
4438+
)
4439+
default:
4440+
preconditionFailure("bestContentType chose an invalid content type.")
4441+
}
4442+
return .notFound(.init(body: body))
4443+
default:
4444+
return .undocumented(
4445+
statusCode: response.status.code,
4446+
.init(
4447+
headerFields: response.headerFields,
4448+
body: responseBody
4449+
)
4450+
)
4451+
}
4452+
}
4453+
)
4454+
}
43654455
/// List users
43664456
///
43674457
/// Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts.

0 commit comments

Comments
 (0)