Skip to content

Commit 982292f

Browse files
Commit via running: make Sources/dependabot
1 parent a3b7056 commit 982292f

File tree

2 files changed

+705
-0
lines changed

2 files changed

+705
-0
lines changed

Sources/dependabot/Client.swift

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,219 @@ public struct Client: APIProtocol {
274274
}
275275
)
276276
}
277+
/// Lists repositories that organization admins have allowed Dependabot to access when updating dependencies.
278+
///
279+
/// > [!NOTE]
280+
/// > This operation supports both server-to-server and user-to-server access.
281+
/// Unauthorized users will not see the existence of this endpoint.
282+
///
283+
/// - Remark: HTTP `GET /organizations/{org}/dependabot/repository-access`.
284+
/// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)`.
285+
public func dependabotRepositoryAccessForOrg(_ input: Operations.DependabotRepositoryAccessForOrg.Input) async throws -> Operations.DependabotRepositoryAccessForOrg.Output {
286+
try await client.send(
287+
input: input,
288+
forOperation: Operations.DependabotRepositoryAccessForOrg.id,
289+
serializer: { input in
290+
let path = try converter.renderedPath(
291+
template: "/organizations/{}/dependabot/repository-access",
292+
parameters: [
293+
input.path.org
294+
]
295+
)
296+
var request: HTTPTypes.HTTPRequest = .init(
297+
soar_path: path,
298+
method: .get
299+
)
300+
suppressMutabilityWarning(&request)
301+
converter.setAcceptHeader(
302+
in: &request.headerFields,
303+
contentTypes: input.headers.accept
304+
)
305+
return (request, nil)
306+
},
307+
deserializer: { response, responseBody in
308+
switch response.status.code {
309+
case 200:
310+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
311+
let body: Operations.DependabotRepositoryAccessForOrg.Output.Ok.Body
312+
let chosenContentType = try converter.bestContentType(
313+
received: contentType,
314+
options: [
315+
"application/json"
316+
]
317+
)
318+
switch chosenContentType {
319+
case "application/json":
320+
body = try await converter.getResponseBodyAsJSON(
321+
Components.Schemas.DependabotRepositoryAccessDetails.self,
322+
from: responseBody,
323+
transforming: { value in
324+
.json(value)
325+
}
326+
)
327+
default:
328+
preconditionFailure("bestContentType chose an invalid content type.")
329+
}
330+
return .ok(.init(body: body))
331+
case 403:
332+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
333+
let body: Components.Responses.Forbidden.Body
334+
let chosenContentType = try converter.bestContentType(
335+
received: contentType,
336+
options: [
337+
"application/json"
338+
]
339+
)
340+
switch chosenContentType {
341+
case "application/json":
342+
body = try await converter.getResponseBodyAsJSON(
343+
Components.Schemas.BasicError.self,
344+
from: responseBody,
345+
transforming: { value in
346+
.json(value)
347+
}
348+
)
349+
default:
350+
preconditionFailure("bestContentType chose an invalid content type.")
351+
}
352+
return .forbidden(.init(body: body))
353+
case 404:
354+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
355+
let body: Components.Responses.NotFound.Body
356+
let chosenContentType = try converter.bestContentType(
357+
received: contentType,
358+
options: [
359+
"application/json"
360+
]
361+
)
362+
switch chosenContentType {
363+
case "application/json":
364+
body = try await converter.getResponseBodyAsJSON(
365+
Components.Schemas.BasicError.self,
366+
from: responseBody,
367+
transforming: { value in
368+
.json(value)
369+
}
370+
)
371+
default:
372+
preconditionFailure("bestContentType chose an invalid content type.")
373+
}
374+
return .notFound(.init(body: body))
375+
default:
376+
return .undocumented(
377+
statusCode: response.status.code,
378+
.init(
379+
headerFields: response.headerFields,
380+
body: responseBody
381+
)
382+
)
383+
}
384+
}
385+
)
386+
}
387+
/// Set the default repository access level for Dependabot
388+
///
389+
/// > [!NOTE]
390+
/// > This operation supports both server-to-server and user-to-server access.
391+
/// Sets the default level of repository access Dependabot will have while performing an update. Available values are:
392+
/// - 'public' - Dependabot will only have access to public repositories, unless access is explicitly granted to non-public repositories.
393+
/// - 'internal' - Dependabot will only have access to public and internal repositories, unless access is explicitly granted to private repositories.
394+
///
395+
/// Unauthorized users will not see the existence of this endpoint.
396+
///
397+
/// - Remark: HTTP `PUT /organizations/{org}/dependabot/repository-access/default-level`.
398+
/// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)`.
399+
public func dependabotSetRepositoryAccessDefaultLevel(_ input: Operations.DependabotSetRepositoryAccessDefaultLevel.Input) async throws -> Operations.DependabotSetRepositoryAccessDefaultLevel.Output {
400+
try await client.send(
401+
input: input,
402+
forOperation: Operations.DependabotSetRepositoryAccessDefaultLevel.id,
403+
serializer: { input in
404+
let path = try converter.renderedPath(
405+
template: "/organizations/{}/dependabot/repository-access/default-level",
406+
parameters: [
407+
input.path.org
408+
]
409+
)
410+
var request: HTTPTypes.HTTPRequest = .init(
411+
soar_path: path,
412+
method: .put
413+
)
414+
suppressMutabilityWarning(&request)
415+
converter.setAcceptHeader(
416+
in: &request.headerFields,
417+
contentTypes: input.headers.accept
418+
)
419+
let body: OpenAPIRuntime.HTTPBody?
420+
switch input.body {
421+
case let .json(value):
422+
body = try converter.setRequiredRequestBodyAsJSON(
423+
value,
424+
headerFields: &request.headerFields,
425+
contentType: "application/json; charset=utf-8"
426+
)
427+
}
428+
return (request, body)
429+
},
430+
deserializer: { response, responseBody in
431+
switch response.status.code {
432+
case 204:
433+
return .noContent(.init())
434+
case 403:
435+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
436+
let body: Components.Responses.Forbidden.Body
437+
let chosenContentType = try converter.bestContentType(
438+
received: contentType,
439+
options: [
440+
"application/json"
441+
]
442+
)
443+
switch chosenContentType {
444+
case "application/json":
445+
body = try await converter.getResponseBodyAsJSON(
446+
Components.Schemas.BasicError.self,
447+
from: responseBody,
448+
transforming: { value in
449+
.json(value)
450+
}
451+
)
452+
default:
453+
preconditionFailure("bestContentType chose an invalid content type.")
454+
}
455+
return .forbidden(.init(body: body))
456+
case 404:
457+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
458+
let body: Components.Responses.NotFound.Body
459+
let chosenContentType = try converter.bestContentType(
460+
received: contentType,
461+
options: [
462+
"application/json"
463+
]
464+
)
465+
switch chosenContentType {
466+
case "application/json":
467+
body = try await converter.getResponseBodyAsJSON(
468+
Components.Schemas.BasicError.self,
469+
from: responseBody,
470+
transforming: { value in
471+
.json(value)
472+
}
473+
)
474+
default:
475+
preconditionFailure("bestContentType chose an invalid content type.")
476+
}
477+
return .notFound(.init(body: body))
478+
default:
479+
return .undocumented(
480+
statusCode: response.status.code,
481+
.init(
482+
headerFields: response.headerFields,
483+
body: responseBody
484+
)
485+
)
486+
}
487+
}
488+
)
489+
}
277490
/// List Dependabot alerts for an organization
278491
///
279492
/// Lists Dependabot alerts for an organization.

0 commit comments

Comments
 (0)