Skip to content

Commit fbc2a62

Browse files
Commit via running ake Sources/secret-scanning
1 parent d3b0a69 commit fbc2a62

File tree

2 files changed

+446
-0
lines changed

2 files changed

+446
-0
lines changed

Sources/secret-scanning/Client.swift

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,4 +1043,95 @@ public struct Client: APIProtocol {
10431043
}
10441044
)
10451045
}
1046+
/// Get secret scanning scan history for a repository
1047+
///
1048+
/// Lists the latest incremental and backfill scans by type for a repository.
1049+
///
1050+
/// OAuth app tokens and personal access tokens (classic) need the `repo` or `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead.
1051+
///
1052+
/// - Remark: HTTP `GET /repos/{owner}/{repo}/secret-scanning/scan-history`.
1053+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/secret-scanning/scan-history/get(secret-scanning/get-scan-history)`.
1054+
public func secret_hyphen_scanning_sol_get_hyphen_scan_hyphen_history(_ input: Operations.secret_hyphen_scanning_sol_get_hyphen_scan_hyphen_history.Input) async throws -> Operations.secret_hyphen_scanning_sol_get_hyphen_scan_hyphen_history.Output {
1055+
try await client.send(
1056+
input: input,
1057+
forOperation: Operations.secret_hyphen_scanning_sol_get_hyphen_scan_hyphen_history.id,
1058+
serializer: { input in
1059+
let path = try converter.renderedPath(
1060+
template: "/repos/{}/{}/secret-scanning/scan-history",
1061+
parameters: [
1062+
input.path.owner,
1063+
input.path.repo
1064+
]
1065+
)
1066+
var request: HTTPTypes.HTTPRequest = .init(
1067+
soar_path: path,
1068+
method: .get
1069+
)
1070+
suppressMutabilityWarning(&request)
1071+
converter.setAcceptHeader(
1072+
in: &request.headerFields,
1073+
contentTypes: input.headers.accept
1074+
)
1075+
return (request, nil)
1076+
},
1077+
deserializer: { response, responseBody in
1078+
switch response.status.code {
1079+
case 404:
1080+
return .notFound(.init())
1081+
case 503:
1082+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1083+
let body: Components.Responses.service_unavailable.Body
1084+
let chosenContentType = try converter.bestContentType(
1085+
received: contentType,
1086+
options: [
1087+
"application/json"
1088+
]
1089+
)
1090+
switch chosenContentType {
1091+
case "application/json":
1092+
body = try await converter.getResponseBodyAsJSON(
1093+
Components.Responses.service_unavailable.Body.jsonPayload.self,
1094+
from: responseBody,
1095+
transforming: { value in
1096+
.json(value)
1097+
}
1098+
)
1099+
default:
1100+
preconditionFailure("bestContentType chose an invalid content type.")
1101+
}
1102+
return .serviceUnavailable(.init(body: body))
1103+
case 200:
1104+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1105+
let body: Operations.secret_hyphen_scanning_sol_get_hyphen_scan_hyphen_history.Output.Ok.Body
1106+
let chosenContentType = try converter.bestContentType(
1107+
received: contentType,
1108+
options: [
1109+
"application/json"
1110+
]
1111+
)
1112+
switch chosenContentType {
1113+
case "application/json":
1114+
body = try await converter.getResponseBodyAsJSON(
1115+
Components.Schemas.secret_hyphen_scanning_hyphen_scan_hyphen_history.self,
1116+
from: responseBody,
1117+
transforming: { value in
1118+
.json(value)
1119+
}
1120+
)
1121+
default:
1122+
preconditionFailure("bestContentType chose an invalid content type.")
1123+
}
1124+
return .ok(.init(body: body))
1125+
default:
1126+
return .undocumented(
1127+
statusCode: response.status.code,
1128+
.init(
1129+
headerFields: response.headerFields,
1130+
body: responseBody
1131+
)
1132+
)
1133+
}
1134+
}
1135+
)
1136+
}
10461137
}

0 commit comments

Comments
 (0)