Skip to content

Commit d0cf52c

Browse files
Commit via running ake Sources/users
1 parent 1ba216e commit d0cf52c

File tree

2 files changed

+760
-0
lines changed

2 files changed

+760
-0
lines changed

Sources/users/Client.swift

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4540,6 +4540,142 @@ public struct Client: APIProtocol {
45404540
}
45414541
)
45424542
}
4543+
/// List attestations
4544+
///
4545+
/// List a collection of artifact attestations with a given subject digest that are associated with repositories owned by a user.
4546+
///
4547+
/// The collection of attestations returned by this endpoint is filtered according to the authenticated user's permissions; if the authenticated user cannot read a repository, the attestations associated with that repository will not be included in the response. In addition, when using a fine-grained access token the `attestations:read` permission is required.
4548+
///
4549+
/// **Please note:** in order to offer meaningful security benefits, an attestation's signature and timestamps **must** be cryptographically verified, and the identity of the attestation signer **must** be validated. Attestations can be verified using the [GitHub CLI `attestation verify` command](https://cli.github.com/manual/gh_attestation_verify). For more information, see [our guide on how to use artifact attestations to establish a build's provenance](https://docs.github.com/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
4550+
///
4551+
/// - Remark: HTTP `GET /users/{username}/attestations/{subject_digest}`.
4552+
/// - Remark: Generated from `#/paths//users/{username}/attestations/{subject_digest}/get(users/list-attestations)`.
4553+
public func users_sol_list_hyphen_attestations(_ input: Operations.users_sol_list_hyphen_attestations.Input) async throws -> Operations.users_sol_list_hyphen_attestations.Output {
4554+
try await client.send(
4555+
input: input,
4556+
forOperation: Operations.users_sol_list_hyphen_attestations.id,
4557+
serializer: { input in
4558+
let path = try converter.renderedPath(
4559+
template: "/users/{}/attestations/{}",
4560+
parameters: [
4561+
input.path.username,
4562+
input.path.subject_digest
4563+
]
4564+
)
4565+
var request: HTTPTypes.HTTPRequest = .init(
4566+
soar_path: path,
4567+
method: .get
4568+
)
4569+
suppressMutabilityWarning(&request)
4570+
try converter.setQueryItemAsURI(
4571+
in: &request,
4572+
style: .form,
4573+
explode: true,
4574+
name: "per_page",
4575+
value: input.query.per_page
4576+
)
4577+
try converter.setQueryItemAsURI(
4578+
in: &request,
4579+
style: .form,
4580+
explode: true,
4581+
name: "before",
4582+
value: input.query.before
4583+
)
4584+
try converter.setQueryItemAsURI(
4585+
in: &request,
4586+
style: .form,
4587+
explode: true,
4588+
name: "after",
4589+
value: input.query.after
4590+
)
4591+
converter.setAcceptHeader(
4592+
in: &request.headerFields,
4593+
contentTypes: input.headers.accept
4594+
)
4595+
return (request, nil)
4596+
},
4597+
deserializer: { response, responseBody in
4598+
switch response.status.code {
4599+
case 200:
4600+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4601+
let body: Operations.users_sol_list_hyphen_attestations.Output.Ok.Body
4602+
let chosenContentType = try converter.bestContentType(
4603+
received: contentType,
4604+
options: [
4605+
"application/json"
4606+
]
4607+
)
4608+
switch chosenContentType {
4609+
case "application/json":
4610+
body = try await converter.getResponseBodyAsJSON(
4611+
Operations.users_sol_list_hyphen_attestations.Output.Ok.Body.jsonPayload.self,
4612+
from: responseBody,
4613+
transforming: { value in
4614+
.json(value)
4615+
}
4616+
)
4617+
default:
4618+
preconditionFailure("bestContentType chose an invalid content type.")
4619+
}
4620+
return .ok(.init(body: body))
4621+
case 201:
4622+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4623+
let body: Operations.users_sol_list_hyphen_attestations.Output.Created.Body
4624+
let chosenContentType = try converter.bestContentType(
4625+
received: contentType,
4626+
options: [
4627+
"application/json"
4628+
]
4629+
)
4630+
switch chosenContentType {
4631+
case "application/json":
4632+
body = try await converter.getResponseBodyAsJSON(
4633+
Components.Schemas.empty_hyphen_object.self,
4634+
from: responseBody,
4635+
transforming: { value in
4636+
.json(value)
4637+
}
4638+
)
4639+
default:
4640+
preconditionFailure("bestContentType chose an invalid content type.")
4641+
}
4642+
return .created(.init(body: body))
4643+
case 204:
4644+
return .noContent(.init())
4645+
case 404:
4646+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
4647+
let body: Components.Responses.not_found.Body
4648+
let chosenContentType = try converter.bestContentType(
4649+
received: contentType,
4650+
options: [
4651+
"application/json"
4652+
]
4653+
)
4654+
switch chosenContentType {
4655+
case "application/json":
4656+
body = try await converter.getResponseBodyAsJSON(
4657+
Components.Schemas.basic_hyphen_error.self,
4658+
from: responseBody,
4659+
transforming: { value in
4660+
.json(value)
4661+
}
4662+
)
4663+
default:
4664+
preconditionFailure("bestContentType chose an invalid content type.")
4665+
}
4666+
return .notFound(.init(body: body))
4667+
default:
4668+
return .undocumented(
4669+
statusCode: response.status.code,
4670+
.init(
4671+
headerFields: response.headerFields,
4672+
body: responseBody
4673+
)
4674+
)
4675+
}
4676+
}
4677+
)
4678+
}
45434679
/// List followers of a user
45444680
///
45454681
/// Lists the people following the specified user.

0 commit comments

Comments
 (0)