Skip to content

Commit b8336f8

Browse files
Commit via running ake Sources/code-security
1 parent a8af028 commit b8336f8

File tree

2 files changed

+581
-0
lines changed

2 files changed

+581
-0
lines changed

Sources/code-security/Client.swift

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,4 +1212,121 @@ public struct Client: APIProtocol {
12121212
}
12131213
)
12141214
}
1215+
/// Get the code security configuration associated with a repository
1216+
///
1217+
/// Get the code security configuration that manages a repository's code security settings.
1218+
///
1219+
/// The authenticated user must be an administrator or security manager for the organization to use this endpoint.
1220+
///
1221+
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
1222+
///
1223+
/// - Remark: HTTP `GET /repos/{owner}/{repo}/code-security-configuration`.
1224+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/code-security-configuration/get(code-security/get-configuration-for-repository)`.
1225+
public func code_hyphen_security_sol_get_hyphen_configuration_hyphen_for_hyphen_repository(_ input: Operations.code_hyphen_security_sol_get_hyphen_configuration_hyphen_for_hyphen_repository.Input) async throws -> Operations.code_hyphen_security_sol_get_hyphen_configuration_hyphen_for_hyphen_repository.Output {
1226+
try await client.send(
1227+
input: input,
1228+
forOperation: Operations.code_hyphen_security_sol_get_hyphen_configuration_hyphen_for_hyphen_repository.id,
1229+
serializer: { input in
1230+
let path = try converter.renderedPath(
1231+
template: "/repos/{}/{}/code-security-configuration",
1232+
parameters: [
1233+
input.path.owner,
1234+
input.path.repo
1235+
]
1236+
)
1237+
var request: HTTPTypes.HTTPRequest = .init(
1238+
soar_path: path,
1239+
method: .get
1240+
)
1241+
suppressMutabilityWarning(&request)
1242+
converter.setAcceptHeader(
1243+
in: &request.headerFields,
1244+
contentTypes: input.headers.accept
1245+
)
1246+
return (request, nil)
1247+
},
1248+
deserializer: { response, responseBody in
1249+
switch response.status.code {
1250+
case 200:
1251+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1252+
let body: Operations.code_hyphen_security_sol_get_hyphen_configuration_hyphen_for_hyphen_repository.Output.Ok.Body
1253+
let chosenContentType = try converter.bestContentType(
1254+
received: contentType,
1255+
options: [
1256+
"application/json"
1257+
]
1258+
)
1259+
switch chosenContentType {
1260+
case "application/json":
1261+
body = try await converter.getResponseBodyAsJSON(
1262+
Components.Schemas.code_hyphen_security_hyphen_configuration_hyphen_for_hyphen_repository.self,
1263+
from: responseBody,
1264+
transforming: { value in
1265+
.json(value)
1266+
}
1267+
)
1268+
default:
1269+
preconditionFailure("bestContentType chose an invalid content type.")
1270+
}
1271+
return .ok(.init(body: body))
1272+
case 204:
1273+
return .noContent(.init())
1274+
case 304:
1275+
return .notModified(.init())
1276+
case 403:
1277+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1278+
let body: Components.Responses.forbidden.Body
1279+
let chosenContentType = try converter.bestContentType(
1280+
received: contentType,
1281+
options: [
1282+
"application/json"
1283+
]
1284+
)
1285+
switch chosenContentType {
1286+
case "application/json":
1287+
body = try await converter.getResponseBodyAsJSON(
1288+
Components.Schemas.basic_hyphen_error.self,
1289+
from: responseBody,
1290+
transforming: { value in
1291+
.json(value)
1292+
}
1293+
)
1294+
default:
1295+
preconditionFailure("bestContentType chose an invalid content type.")
1296+
}
1297+
return .forbidden(.init(body: body))
1298+
case 404:
1299+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1300+
let body: Components.Responses.not_found.Body
1301+
let chosenContentType = try converter.bestContentType(
1302+
received: contentType,
1303+
options: [
1304+
"application/json"
1305+
]
1306+
)
1307+
switch chosenContentType {
1308+
case "application/json":
1309+
body = try await converter.getResponseBodyAsJSON(
1310+
Components.Schemas.basic_hyphen_error.self,
1311+
from: responseBody,
1312+
transforming: { value in
1313+
.json(value)
1314+
}
1315+
)
1316+
default:
1317+
preconditionFailure("bestContentType chose an invalid content type.")
1318+
}
1319+
return .notFound(.init(body: body))
1320+
default:
1321+
return .undocumented(
1322+
statusCode: response.status.code,
1323+
.init(
1324+
headerFields: response.headerFields,
1325+
body: responseBody
1326+
)
1327+
)
1328+
}
1329+
}
1330+
)
1331+
}
12151332
}

0 commit comments

Comments
 (0)