Skip to content

Commit 055eefe

Browse files
Commit via running ake Sources/code-scanning
1 parent bd5e1e8 commit 055eefe

File tree

2 files changed

+343
-8
lines changed

2 files changed

+343
-8
lines changed

Sources/code-scanning/Client.swift

Lines changed: 116 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ public struct Client: APIProtocol {
14931493
///
14941494
/// Lists the CodeQL databases that are available in a repository.
14951495
///
1496-
/// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.
1496+
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.
14971497
///
14981498
/// - Remark: HTTP `GET /repos/{owner}/{repo}/code-scanning/codeql/databases`.
14991499
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/code-scanning/codeql/databases/get(code-scanning/list-codeql-databases)`.
@@ -1632,7 +1632,7 @@ public struct Client: APIProtocol {
16321632
/// your HTTP client is configured to follow redirects or use the `Location` header
16331633
/// to make a second request to get the redirect URL.
16341634
///
1635-
/// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.
1635+
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.
16361636
///
16371637
/// - Remark: HTTP `GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}`.
16381638
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/code-scanning/codeql/databases/{language}/get(code-scanning/get-codeql-database)`.
@@ -1764,6 +1764,120 @@ public struct Client: APIProtocol {
17641764
}
17651765
)
17661766
}
1767+
/// Delete a CodeQL database
1768+
///
1769+
/// Deletes a CodeQL database for a language in a repository.
1770+
///
1771+
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.
1772+
///
1773+
/// - Remark: HTTP `DELETE /repos/{owner}/{repo}/code-scanning/codeql/databases/{language}`.
1774+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/code-scanning/codeql/databases/{language}/delete(code-scanning/delete-codeql-database)`.
1775+
public func code_hyphen_scanning_sol_delete_hyphen_codeql_hyphen_database(_ input: Operations.code_hyphen_scanning_sol_delete_hyphen_codeql_hyphen_database.Input) async throws -> Operations.code_hyphen_scanning_sol_delete_hyphen_codeql_hyphen_database.Output {
1776+
try await client.send(
1777+
input: input,
1778+
forOperation: Operations.code_hyphen_scanning_sol_delete_hyphen_codeql_hyphen_database.id,
1779+
serializer: { input in
1780+
let path = try converter.renderedPath(
1781+
template: "/repos/{}/{}/code-scanning/codeql/databases/{}",
1782+
parameters: [
1783+
input.path.owner,
1784+
input.path.repo,
1785+
input.path.language
1786+
]
1787+
)
1788+
var request: HTTPTypes.HTTPRequest = .init(
1789+
soar_path: path,
1790+
method: .delete
1791+
)
1792+
suppressMutabilityWarning(&request)
1793+
converter.setAcceptHeader(
1794+
in: &request.headerFields,
1795+
contentTypes: input.headers.accept
1796+
)
1797+
return (request, nil)
1798+
},
1799+
deserializer: { response, responseBody in
1800+
switch response.status.code {
1801+
case 204:
1802+
return .noContent(.init())
1803+
case 403:
1804+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1805+
let body: Components.Responses.code_scanning_forbidden_write.Body
1806+
let chosenContentType = try converter.bestContentType(
1807+
received: contentType,
1808+
options: [
1809+
"application/json"
1810+
]
1811+
)
1812+
switch chosenContentType {
1813+
case "application/json":
1814+
body = try await converter.getResponseBodyAsJSON(
1815+
Components.Schemas.basic_hyphen_error.self,
1816+
from: responseBody,
1817+
transforming: { value in
1818+
.json(value)
1819+
}
1820+
)
1821+
default:
1822+
preconditionFailure("bestContentType chose an invalid content type.")
1823+
}
1824+
return .forbidden(.init(body: body))
1825+
case 404:
1826+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1827+
let body: Components.Responses.not_found.Body
1828+
let chosenContentType = try converter.bestContentType(
1829+
received: contentType,
1830+
options: [
1831+
"application/json"
1832+
]
1833+
)
1834+
switch chosenContentType {
1835+
case "application/json":
1836+
body = try await converter.getResponseBodyAsJSON(
1837+
Components.Schemas.basic_hyphen_error.self,
1838+
from: responseBody,
1839+
transforming: { value in
1840+
.json(value)
1841+
}
1842+
)
1843+
default:
1844+
preconditionFailure("bestContentType chose an invalid content type.")
1845+
}
1846+
return .notFound(.init(body: body))
1847+
case 503:
1848+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1849+
let body: Components.Responses.service_unavailable.Body
1850+
let chosenContentType = try converter.bestContentType(
1851+
received: contentType,
1852+
options: [
1853+
"application/json"
1854+
]
1855+
)
1856+
switch chosenContentType {
1857+
case "application/json":
1858+
body = try await converter.getResponseBodyAsJSON(
1859+
Components.Responses.service_unavailable.Body.jsonPayload.self,
1860+
from: responseBody,
1861+
transforming: { value in
1862+
.json(value)
1863+
}
1864+
)
1865+
default:
1866+
preconditionFailure("bestContentType chose an invalid content type.")
1867+
}
1868+
return .serviceUnavailable(.init(body: body))
1869+
default:
1870+
return .undocumented(
1871+
statusCode: response.status.code,
1872+
.init(
1873+
headerFields: response.headerFields,
1874+
body: responseBody
1875+
)
1876+
)
1877+
}
1878+
}
1879+
)
1880+
}
17671881
/// Create a CodeQL variant analysis
17681882
///
17691883
/// Creates a new CodeQL variant analysis, which will run a CodeQL query against one or more repositories.

0 commit comments

Comments
 (0)