Skip to content

Commit 45d558b

Browse files
Commit via running ake Sources/secret-scanning
1 parent 426ebc7 commit 45d558b

File tree

2 files changed

+470
-6
lines changed

2 files changed

+470
-6
lines changed

Sources/secret-scanning/Client.swift

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,4 +895,110 @@ public struct Client: APIProtocol {
895895
}
896896
)
897897
}
898+
/// Create a push protection bypass
899+
///
900+
/// Creates a bypass for a previously push protected secret.
901+
///
902+
/// The authenticated user must be the original author of the committed secret.
903+
///
904+
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.
905+
///
906+
/// - Remark: HTTP `POST /repos/{owner}/{repo}/secret-scanning/push-protection-bypasses`.
907+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/secret-scanning/push-protection-bypasses/post(secret-scanning/create-push-protection-bypass)`.
908+
public func secret_hyphen_scanning_sol_create_hyphen_push_hyphen_protection_hyphen_bypass(_ input: Operations.secret_hyphen_scanning_sol_create_hyphen_push_hyphen_protection_hyphen_bypass.Input) async throws -> Operations.secret_hyphen_scanning_sol_create_hyphen_push_hyphen_protection_hyphen_bypass.Output {
909+
try await client.send(
910+
input: input,
911+
forOperation: Operations.secret_hyphen_scanning_sol_create_hyphen_push_hyphen_protection_hyphen_bypass.id,
912+
serializer: { input in
913+
let path = try converter.renderedPath(
914+
template: "/repos/{}/{}/secret-scanning/push-protection-bypasses",
915+
parameters: [
916+
input.path.owner,
917+
input.path.repo
918+
]
919+
)
920+
var request: HTTPTypes.HTTPRequest = .init(
921+
soar_path: path,
922+
method: .post
923+
)
924+
suppressMutabilityWarning(&request)
925+
converter.setAcceptHeader(
926+
in: &request.headerFields,
927+
contentTypes: input.headers.accept
928+
)
929+
let body: OpenAPIRuntime.HTTPBody?
930+
switch input.body {
931+
case let .json(value):
932+
body = try converter.setRequiredRequestBodyAsJSON(
933+
value,
934+
headerFields: &request.headerFields,
935+
contentType: "application/json; charset=utf-8"
936+
)
937+
}
938+
return (request, body)
939+
},
940+
deserializer: { response, responseBody in
941+
switch response.status.code {
942+
case 200:
943+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
944+
let body: Operations.secret_hyphen_scanning_sol_create_hyphen_push_hyphen_protection_hyphen_bypass.Output.Ok.Body
945+
let chosenContentType = try converter.bestContentType(
946+
received: contentType,
947+
options: [
948+
"application/json"
949+
]
950+
)
951+
switch chosenContentType {
952+
case "application/json":
953+
body = try await converter.getResponseBodyAsJSON(
954+
Components.Schemas.secret_hyphen_scanning_hyphen_push_hyphen_protection_hyphen_bypass.self,
955+
from: responseBody,
956+
transforming: { value in
957+
.json(value)
958+
}
959+
)
960+
default:
961+
preconditionFailure("bestContentType chose an invalid content type.")
962+
}
963+
return .ok(.init(body: body))
964+
case 403:
965+
return .forbidden(.init())
966+
case 404:
967+
return .notFound(.init())
968+
case 422:
969+
return .unprocessableContent(.init())
970+
case 503:
971+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
972+
let body: Components.Responses.service_unavailable.Body
973+
let chosenContentType = try converter.bestContentType(
974+
received: contentType,
975+
options: [
976+
"application/json"
977+
]
978+
)
979+
switch chosenContentType {
980+
case "application/json":
981+
body = try await converter.getResponseBodyAsJSON(
982+
Components.Responses.service_unavailable.Body.jsonPayload.self,
983+
from: responseBody,
984+
transforming: { value in
985+
.json(value)
986+
}
987+
)
988+
default:
989+
preconditionFailure("bestContentType chose an invalid content type.")
990+
}
991+
return .serviceUnavailable(.init(body: body))
992+
default:
993+
return .undocumented(
994+
statusCode: response.status.code,
995+
.init(
996+
headerFields: response.headerFields,
997+
body: responseBody
998+
)
999+
)
1000+
}
1001+
}
1002+
)
1003+
}
8981004
}

0 commit comments

Comments
 (0)