Skip to content

Commit 124eb8b

Browse files
Commit via running: make Sources/secret-scanning
1 parent 5289371 commit 124eb8b

File tree

2 files changed

+31
-588
lines changed

2 files changed

+31
-588
lines changed

Sources/secret-scanning/Client.swift

Lines changed: 3 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -38,212 +38,6 @@ public struct Client: APIProtocol {
3838
private var converter: Converter {
3939
client.converter
4040
}
41-
/// List secret scanning alerts for an enterprise
42-
///
43-
/// Lists secret scanning alerts for eligible repositories in an enterprise, from newest to oldest.
44-
///
45-
/// Alerts are only returned for organizations in the enterprise for which the authenticated user is an organization owner or a [security manager](https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).
46-
///
47-
/// The authenticated user must be a member of the enterprise in order to use this endpoint.
48-
///
49-
/// OAuth app tokens and personal access tokens (classic) need the `repo` scope or `security_events` scope to use this endpoint.
50-
///
51-
/// - Remark: HTTP `GET /enterprises/{enterprise}/secret-scanning/alerts`.
52-
/// - Remark: Generated from `#/paths//enterprises/{enterprise}/secret-scanning/alerts/get(secret-scanning/list-alerts-for-enterprise)`.
53-
public func secretScanningListAlertsForEnterprise(_ input: Operations.SecretScanningListAlertsForEnterprise.Input) async throws -> Operations.SecretScanningListAlertsForEnterprise.Output {
54-
try await client.send(
55-
input: input,
56-
forOperation: Operations.SecretScanningListAlertsForEnterprise.id,
57-
serializer: { input in
58-
let path = try converter.renderedPath(
59-
template: "/enterprises/{}/secret-scanning/alerts",
60-
parameters: [
61-
input.path.enterprise
62-
]
63-
)
64-
var request: HTTPTypes.HTTPRequest = .init(
65-
soar_path: path,
66-
method: .get
67-
)
68-
suppressMutabilityWarning(&request)
69-
try converter.setQueryItemAsURI(
70-
in: &request,
71-
style: .form,
72-
explode: true,
73-
name: "state",
74-
value: input.query.state
75-
)
76-
try converter.setQueryItemAsURI(
77-
in: &request,
78-
style: .form,
79-
explode: true,
80-
name: "secret_type",
81-
value: input.query.secretType
82-
)
83-
try converter.setQueryItemAsURI(
84-
in: &request,
85-
style: .form,
86-
explode: true,
87-
name: "resolution",
88-
value: input.query.resolution
89-
)
90-
try converter.setQueryItemAsURI(
91-
in: &request,
92-
style: .form,
93-
explode: true,
94-
name: "sort",
95-
value: input.query.sort
96-
)
97-
try converter.setQueryItemAsURI(
98-
in: &request,
99-
style: .form,
100-
explode: true,
101-
name: "direction",
102-
value: input.query.direction
103-
)
104-
try converter.setQueryItemAsURI(
105-
in: &request,
106-
style: .form,
107-
explode: true,
108-
name: "per_page",
109-
value: input.query.perPage
110-
)
111-
try converter.setQueryItemAsURI(
112-
in: &request,
113-
style: .form,
114-
explode: true,
115-
name: "before",
116-
value: input.query.before
117-
)
118-
try converter.setQueryItemAsURI(
119-
in: &request,
120-
style: .form,
121-
explode: true,
122-
name: "after",
123-
value: input.query.after
124-
)
125-
try converter.setQueryItemAsURI(
126-
in: &request,
127-
style: .form,
128-
explode: true,
129-
name: "validity",
130-
value: input.query.validity
131-
)
132-
try converter.setQueryItemAsURI(
133-
in: &request,
134-
style: .form,
135-
explode: true,
136-
name: "is_publicly_leaked",
137-
value: input.query.isPubliclyLeaked
138-
)
139-
try converter.setQueryItemAsURI(
140-
in: &request,
141-
style: .form,
142-
explode: true,
143-
name: "is_multi_repo",
144-
value: input.query.isMultiRepo
145-
)
146-
try converter.setQueryItemAsURI(
147-
in: &request,
148-
style: .form,
149-
explode: true,
150-
name: "hide_secret",
151-
value: input.query.hideSecret
152-
)
153-
converter.setAcceptHeader(
154-
in: &request.headerFields,
155-
contentTypes: input.headers.accept
156-
)
157-
return (request, nil)
158-
},
159-
deserializer: { response, responseBody in
160-
switch response.status.code {
161-
case 200:
162-
let headers: Operations.SecretScanningListAlertsForEnterprise.Output.Ok.Headers = .init(link: try converter.getOptionalHeaderFieldAsURI(
163-
in: response.headerFields,
164-
name: "Link",
165-
as: Components.Headers.Link.self
166-
))
167-
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
168-
let body: Operations.SecretScanningListAlertsForEnterprise.Output.Ok.Body
169-
let chosenContentType = try converter.bestContentType(
170-
received: contentType,
171-
options: [
172-
"application/json"
173-
]
174-
)
175-
switch chosenContentType {
176-
case "application/json":
177-
body = try await converter.getResponseBodyAsJSON(
178-
[Components.Schemas.OrganizationSecretScanningAlert].self,
179-
from: responseBody,
180-
transforming: { value in
181-
.json(value)
182-
}
183-
)
184-
default:
185-
preconditionFailure("bestContentType chose an invalid content type.")
186-
}
187-
return .ok(.init(
188-
headers: headers,
189-
body: body
190-
))
191-
case 404:
192-
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
193-
let body: Components.Responses.NotFound.Body
194-
let chosenContentType = try converter.bestContentType(
195-
received: contentType,
196-
options: [
197-
"application/json"
198-
]
199-
)
200-
switch chosenContentType {
201-
case "application/json":
202-
body = try await converter.getResponseBodyAsJSON(
203-
Components.Schemas.BasicError.self,
204-
from: responseBody,
205-
transforming: { value in
206-
.json(value)
207-
}
208-
)
209-
default:
210-
preconditionFailure("bestContentType chose an invalid content type.")
211-
}
212-
return .notFound(.init(body: body))
213-
case 503:
214-
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
215-
let body: Components.Responses.ServiceUnavailable.Body
216-
let chosenContentType = try converter.bestContentType(
217-
received: contentType,
218-
options: [
219-
"application/json"
220-
]
221-
)
222-
switch chosenContentType {
223-
case "application/json":
224-
body = try await converter.getResponseBodyAsJSON(
225-
Components.Responses.ServiceUnavailable.Body.JsonPayload.self,
226-
from: responseBody,
227-
transforming: { value in
228-
.json(value)
229-
}
230-
)
231-
default:
232-
preconditionFailure("bestContentType chose an invalid content type.")
233-
}
234-
return .serviceUnavailable(.init(body: body))
235-
default:
236-
return .undocumented(
237-
statusCode: response.status.code,
238-
.init(
239-
headerFields: response.headerFields,
240-
body: responseBody
241-
)
242-
)
243-
}
244-
}
245-
)
246-
}
24741
/// List secret scanning alerts for an organization
24842
///
24943
/// Lists secret scanning alerts for eligible repositories in an organization, from newest to oldest.
@@ -1379,6 +1173,9 @@ public struct Client: APIProtocol {
13791173
///
13801174
/// Lists the latest default incremental and backfill scans by type for a repository. Scans from Copilot Secret Scanning are not included.
13811175
///
1176+
/// > [!NOTE]
1177+
/// > This endpoint requires [GitHub Advanced Security](https://docs.github.com/get-started/learning-about-github/about-github-advanced-security)."
1178+
///
13821179
/// 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.
13831180
///
13841181
/// - Remark: HTTP `GET /repos/{owner}/{repo}/secret-scanning/scan-history`.

0 commit comments

Comments
 (0)