Skip to content

Commit ebd6402

Browse files
Commit via running ake Sources/repos
1 parent 29fdc74 commit ebd6402

File tree

2 files changed

+1946
-1069
lines changed

2 files changed

+1946
-1069
lines changed

Sources/repos/Client.swift

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,219 @@ public struct Client: APIProtocol {
16591659
}
16601660
)
16611661
}
1662+
/// Create an attestation
1663+
///
1664+
/// Store an artifact attestation and associate it with a repository.
1665+
///
1666+
/// The authenticated user must have write permission to the repository and, if using a fine-grained access token the `attestations:write` permission is required.
1667+
///
1668+
/// Artifact attestations are meant to be created using the [attest action](https://github.com/actions/attest). For amore information, see our guide on [using artifact attestations to establish a build's provenance](https://docs.github.com/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
1669+
///
1670+
/// - Remark: HTTP `POST /repos/{owner}/{repo}/attestations`.
1671+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/attestations/post(repos/create-attestation)`.
1672+
public func repos_sol_create_hyphen_attestation(_ input: Operations.repos_sol_create_hyphen_attestation.Input) async throws -> Operations.repos_sol_create_hyphen_attestation.Output {
1673+
try await client.send(
1674+
input: input,
1675+
forOperation: Operations.repos_sol_create_hyphen_attestation.id,
1676+
serializer: { input in
1677+
let path = try converter.renderedPath(
1678+
template: "/repos/{}/{}/attestations",
1679+
parameters: [
1680+
input.path.owner,
1681+
input.path.repo
1682+
]
1683+
)
1684+
var request: HTTPTypes.HTTPRequest = .init(
1685+
soar_path: path,
1686+
method: .post
1687+
)
1688+
suppressMutabilityWarning(&request)
1689+
converter.setAcceptHeader(
1690+
in: &request.headerFields,
1691+
contentTypes: input.headers.accept
1692+
)
1693+
let body: OpenAPIRuntime.HTTPBody?
1694+
switch input.body {
1695+
case let .json(value):
1696+
body = try converter.setRequiredRequestBodyAsJSON(
1697+
value,
1698+
headerFields: &request.headerFields,
1699+
contentType: "application/json; charset=utf-8"
1700+
)
1701+
}
1702+
return (request, body)
1703+
},
1704+
deserializer: { response, responseBody in
1705+
switch response.status.code {
1706+
case 201:
1707+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1708+
let body: Operations.repos_sol_create_hyphen_attestation.Output.Created.Body
1709+
let chosenContentType = try converter.bestContentType(
1710+
received: contentType,
1711+
options: [
1712+
"application/json"
1713+
]
1714+
)
1715+
switch chosenContentType {
1716+
case "application/json":
1717+
body = try await converter.getResponseBodyAsJSON(
1718+
Operations.repos_sol_create_hyphen_attestation.Output.Created.Body.jsonPayload.self,
1719+
from: responseBody,
1720+
transforming: { value in
1721+
.json(value)
1722+
}
1723+
)
1724+
default:
1725+
preconditionFailure("bestContentType chose an invalid content type.")
1726+
}
1727+
return .created(.init(body: body))
1728+
case 403:
1729+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1730+
let body: Components.Responses.forbidden.Body
1731+
let chosenContentType = try converter.bestContentType(
1732+
received: contentType,
1733+
options: [
1734+
"application/json"
1735+
]
1736+
)
1737+
switch chosenContentType {
1738+
case "application/json":
1739+
body = try await converter.getResponseBodyAsJSON(
1740+
Components.Schemas.basic_hyphen_error.self,
1741+
from: responseBody,
1742+
transforming: { value in
1743+
.json(value)
1744+
}
1745+
)
1746+
default:
1747+
preconditionFailure("bestContentType chose an invalid content type.")
1748+
}
1749+
return .forbidden(.init(body: body))
1750+
case 422:
1751+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1752+
let body: Components.Responses.validation_failed.Body
1753+
let chosenContentType = try converter.bestContentType(
1754+
received: contentType,
1755+
options: [
1756+
"application/json"
1757+
]
1758+
)
1759+
switch chosenContentType {
1760+
case "application/json":
1761+
body = try await converter.getResponseBodyAsJSON(
1762+
Components.Schemas.validation_hyphen_error.self,
1763+
from: responseBody,
1764+
transforming: { value in
1765+
.json(value)
1766+
}
1767+
)
1768+
default:
1769+
preconditionFailure("bestContentType chose an invalid content type.")
1770+
}
1771+
return .unprocessableContent(.init(body: body))
1772+
default:
1773+
return .undocumented(
1774+
statusCode: response.status.code,
1775+
.init(
1776+
headerFields: response.headerFields,
1777+
body: responseBody
1778+
)
1779+
)
1780+
}
1781+
}
1782+
)
1783+
}
1784+
/// List attestations
1785+
///
1786+
/// List a collection of artifact attestations with a given subject digest that are associated with a repository.
1787+
///
1788+
/// The authenticated user making the request must have read access to the repository. In addition, when using a fine-grained access token the `attestations:read` permission is required.
1789+
///
1790+
/// **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).
1791+
///
1792+
/// - Remark: HTTP `GET /repos/{owner}/{repo}/attestations/{subject_digest}`.
1793+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/attestations/{subject_digest}/get(repos/list-attestations)`.
1794+
public func repos_sol_list_hyphen_attestations(_ input: Operations.repos_sol_list_hyphen_attestations.Input) async throws -> Operations.repos_sol_list_hyphen_attestations.Output {
1795+
try await client.send(
1796+
input: input,
1797+
forOperation: Operations.repos_sol_list_hyphen_attestations.id,
1798+
serializer: { input in
1799+
let path = try converter.renderedPath(
1800+
template: "/repos/{}/{}/attestations/{}",
1801+
parameters: [
1802+
input.path.owner,
1803+
input.path.repo,
1804+
input.path.subject_digest
1805+
]
1806+
)
1807+
var request: HTTPTypes.HTTPRequest = .init(
1808+
soar_path: path,
1809+
method: .get
1810+
)
1811+
suppressMutabilityWarning(&request)
1812+
try converter.setQueryItemAsURI(
1813+
in: &request,
1814+
style: .form,
1815+
explode: true,
1816+
name: "per_page",
1817+
value: input.query.per_page
1818+
)
1819+
try converter.setQueryItemAsURI(
1820+
in: &request,
1821+
style: .form,
1822+
explode: true,
1823+
name: "before",
1824+
value: input.query.before
1825+
)
1826+
try converter.setQueryItemAsURI(
1827+
in: &request,
1828+
style: .form,
1829+
explode: true,
1830+
name: "after",
1831+
value: input.query.after
1832+
)
1833+
converter.setAcceptHeader(
1834+
in: &request.headerFields,
1835+
contentTypes: input.headers.accept
1836+
)
1837+
return (request, nil)
1838+
},
1839+
deserializer: { response, responseBody in
1840+
switch response.status.code {
1841+
case 200:
1842+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1843+
let body: Operations.repos_sol_list_hyphen_attestations.Output.Ok.Body
1844+
let chosenContentType = try converter.bestContentType(
1845+
received: contentType,
1846+
options: [
1847+
"application/json"
1848+
]
1849+
)
1850+
switch chosenContentType {
1851+
case "application/json":
1852+
body = try await converter.getResponseBodyAsJSON(
1853+
Operations.repos_sol_list_hyphen_attestations.Output.Ok.Body.jsonPayload.self,
1854+
from: responseBody,
1855+
transforming: { value in
1856+
.json(value)
1857+
}
1858+
)
1859+
default:
1860+
preconditionFailure("bestContentType chose an invalid content type.")
1861+
}
1862+
return .ok(.init(body: body))
1863+
default:
1864+
return .undocumented(
1865+
statusCode: response.status.code,
1866+
.init(
1867+
headerFields: response.headerFields,
1868+
body: responseBody
1869+
)
1870+
)
1871+
}
1872+
}
1873+
)
1874+
}
16621875
/// Get all autolinks of a repository
16631876
///
16641877
/// Gets all autolinks that are configured for a repository.

0 commit comments

Comments
 (0)