Skip to content

Commit d79c183

Browse files
Commit via running: make Sources/interactions
1 parent e34e281 commit d79c183

2 files changed

Lines changed: 1325 additions & 0 deletions

File tree

Sources/interactions/Client.swift

Lines changed: 363 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,369 @@ public struct Client: APIProtocol {
421421
}
422422
)
423423
}
424+
/// Get pull request creation cap bypass list for a repository
425+
///
426+
/// Lists the users that are on the pull request creation cap bypass list for a
427+
/// repository. Users on this list can create pull requests regardless of any
428+
/// configured pull request creation cap.
429+
///
430+
/// Only repository admins can view the bypass list.
431+
///
432+
/// - Remark: HTTP `GET /repos/{owner}/{repo}/interaction-limits/pulls/bypass-list`.
433+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/interaction-limits/pulls/bypass-list/get(interactions/get-pull-request-bypass-list-for-repo)`.
434+
public func interactionsGetPullRequestBypassListForRepo(_ input: Operations.InteractionsGetPullRequestBypassListForRepo.Input) async throws -> Operations.InteractionsGetPullRequestBypassListForRepo.Output {
435+
try await client.send(
436+
input: input,
437+
forOperation: Operations.InteractionsGetPullRequestBypassListForRepo.id,
438+
serializer: { input in
439+
let path = try converter.renderedPath(
440+
template: "/repos/{}/{}/interaction-limits/pulls/bypass-list",
441+
parameters: [
442+
input.path.owner,
443+
input.path.repo
444+
]
445+
)
446+
var request: HTTPTypes.HTTPRequest = .init(
447+
soar_path: path,
448+
method: .get
449+
)
450+
suppressMutabilityWarning(&request)
451+
converter.setAcceptHeader(
452+
in: &request.headerFields,
453+
contentTypes: input.headers.accept
454+
)
455+
return (request, nil)
456+
},
457+
deserializer: { response, responseBody in
458+
switch response.status.code {
459+
case 200:
460+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
461+
let body: Operations.InteractionsGetPullRequestBypassListForRepo.Output.Ok.Body
462+
let chosenContentType = try converter.bestContentType(
463+
received: contentType,
464+
options: [
465+
"application/json"
466+
]
467+
)
468+
switch chosenContentType {
469+
case "application/json":
470+
body = try await converter.getResponseBodyAsJSON(
471+
[Components.Schemas.SimpleUser].self,
472+
from: responseBody,
473+
transforming: { value in
474+
.json(value)
475+
}
476+
)
477+
default:
478+
preconditionFailure("bestContentType chose an invalid content type.")
479+
}
480+
return .ok(.init(body: body))
481+
case 403:
482+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
483+
let body: Components.Responses.Forbidden.Body
484+
let chosenContentType = try converter.bestContentType(
485+
received: contentType,
486+
options: [
487+
"application/json"
488+
]
489+
)
490+
switch chosenContentType {
491+
case "application/json":
492+
body = try await converter.getResponseBodyAsJSON(
493+
Components.Schemas.BasicError.self,
494+
from: responseBody,
495+
transforming: { value in
496+
.json(value)
497+
}
498+
)
499+
default:
500+
preconditionFailure("bestContentType chose an invalid content type.")
501+
}
502+
return .forbidden(.init(body: body))
503+
case 404:
504+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
505+
let body: Components.Responses.NotFound.Body
506+
let chosenContentType = try converter.bestContentType(
507+
received: contentType,
508+
options: [
509+
"application/json"
510+
]
511+
)
512+
switch chosenContentType {
513+
case "application/json":
514+
body = try await converter.getResponseBodyAsJSON(
515+
Components.Schemas.BasicError.self,
516+
from: responseBody,
517+
transforming: { value in
518+
.json(value)
519+
}
520+
)
521+
default:
522+
preconditionFailure("bestContentType chose an invalid content type.")
523+
}
524+
return .notFound(.init(body: body))
525+
default:
526+
return .undocumented(
527+
statusCode: response.status.code,
528+
.init(
529+
headerFields: response.headerFields,
530+
body: responseBody
531+
)
532+
)
533+
}
534+
}
535+
)
536+
}
537+
/// Add users to the pull request creation cap bypass list for a repository
538+
///
539+
/// Adds users to the pull request creation cap bypass list for a repository.
540+
/// Users on this list can create pull requests regardless of any configured
541+
/// pull request creation cap.
542+
///
543+
/// Only repository admins can modify the bypass list.
544+
/// You can add a maximum of 100 users per request.
545+
/// The bypass list can only hold a maximum of 100 users.
546+
///
547+
/// - Remark: HTTP `PUT /repos/{owner}/{repo}/interaction-limits/pulls/bypass-list`.
548+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/interaction-limits/pulls/bypass-list/put(interactions/set-pull-request-bypass-list-for-repo)`.
549+
public func interactionsSetPullRequestBypassListForRepo(_ input: Operations.InteractionsSetPullRequestBypassListForRepo.Input) async throws -> Operations.InteractionsSetPullRequestBypassListForRepo.Output {
550+
try await client.send(
551+
input: input,
552+
forOperation: Operations.InteractionsSetPullRequestBypassListForRepo.id,
553+
serializer: { input in
554+
let path = try converter.renderedPath(
555+
template: "/repos/{}/{}/interaction-limits/pulls/bypass-list",
556+
parameters: [
557+
input.path.owner,
558+
input.path.repo
559+
]
560+
)
561+
var request: HTTPTypes.HTTPRequest = .init(
562+
soar_path: path,
563+
method: .put
564+
)
565+
suppressMutabilityWarning(&request)
566+
converter.setAcceptHeader(
567+
in: &request.headerFields,
568+
contentTypes: input.headers.accept
569+
)
570+
let body: OpenAPIRuntime.HTTPBody?
571+
switch input.body {
572+
case let .json(value):
573+
body = try converter.setRequiredRequestBodyAsJSON(
574+
value,
575+
headerFields: &request.headerFields,
576+
contentType: "application/json; charset=utf-8"
577+
)
578+
}
579+
return (request, body)
580+
},
581+
deserializer: { response, responseBody in
582+
switch response.status.code {
583+
case 204:
584+
return .noContent(.init())
585+
case 403:
586+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
587+
let body: Components.Responses.Forbidden.Body
588+
let chosenContentType = try converter.bestContentType(
589+
received: contentType,
590+
options: [
591+
"application/json"
592+
]
593+
)
594+
switch chosenContentType {
595+
case "application/json":
596+
body = try await converter.getResponseBodyAsJSON(
597+
Components.Schemas.BasicError.self,
598+
from: responseBody,
599+
transforming: { value in
600+
.json(value)
601+
}
602+
)
603+
default:
604+
preconditionFailure("bestContentType chose an invalid content type.")
605+
}
606+
return .forbidden(.init(body: body))
607+
case 404:
608+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
609+
let body: Components.Responses.NotFound.Body
610+
let chosenContentType = try converter.bestContentType(
611+
received: contentType,
612+
options: [
613+
"application/json"
614+
]
615+
)
616+
switch chosenContentType {
617+
case "application/json":
618+
body = try await converter.getResponseBodyAsJSON(
619+
Components.Schemas.BasicError.self,
620+
from: responseBody,
621+
transforming: { value in
622+
.json(value)
623+
}
624+
)
625+
default:
626+
preconditionFailure("bestContentType chose an invalid content type.")
627+
}
628+
return .notFound(.init(body: body))
629+
case 422:
630+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
631+
let body: Components.Responses.ValidationFailed.Body
632+
let chosenContentType = try converter.bestContentType(
633+
received: contentType,
634+
options: [
635+
"application/json"
636+
]
637+
)
638+
switch chosenContentType {
639+
case "application/json":
640+
body = try await converter.getResponseBodyAsJSON(
641+
Components.Schemas.ValidationError.self,
642+
from: responseBody,
643+
transforming: { value in
644+
.json(value)
645+
}
646+
)
647+
default:
648+
preconditionFailure("bestContentType chose an invalid content type.")
649+
}
650+
return .unprocessableContent(.init(body: body))
651+
default:
652+
return .undocumented(
653+
statusCode: response.status.code,
654+
.init(
655+
headerFields: response.headerFields,
656+
body: responseBody
657+
)
658+
)
659+
}
660+
}
661+
)
662+
}
663+
/// Remove users from the pull request creation cap bypass list for a repository
664+
///
665+
/// Removes users from the pull request creation cap bypass list for a repository.
666+
/// Removed users will be subject to any configured pull request creation cap.
667+
///
668+
/// Only repository admins can modify the bypass list.
669+
/// You can remove a maximum of 100 users per request.
670+
///
671+
/// - Remark: HTTP `DELETE /repos/{owner}/{repo}/interaction-limits/pulls/bypass-list`.
672+
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/interaction-limits/pulls/bypass-list/delete(interactions/remove-pull-request-bypass-list-for-repo)`.
673+
public func interactionsRemovePullRequestBypassListForRepo(_ input: Operations.InteractionsRemovePullRequestBypassListForRepo.Input) async throws -> Operations.InteractionsRemovePullRequestBypassListForRepo.Output {
674+
try await client.send(
675+
input: input,
676+
forOperation: Operations.InteractionsRemovePullRequestBypassListForRepo.id,
677+
serializer: { input in
678+
let path = try converter.renderedPath(
679+
template: "/repos/{}/{}/interaction-limits/pulls/bypass-list",
680+
parameters: [
681+
input.path.owner,
682+
input.path.repo
683+
]
684+
)
685+
var request: HTTPTypes.HTTPRequest = .init(
686+
soar_path: path,
687+
method: .delete
688+
)
689+
suppressMutabilityWarning(&request)
690+
converter.setAcceptHeader(
691+
in: &request.headerFields,
692+
contentTypes: input.headers.accept
693+
)
694+
let body: OpenAPIRuntime.HTTPBody?
695+
switch input.body {
696+
case let .json(value):
697+
body = try converter.setRequiredRequestBodyAsJSON(
698+
value,
699+
headerFields: &request.headerFields,
700+
contentType: "application/json; charset=utf-8"
701+
)
702+
}
703+
return (request, body)
704+
},
705+
deserializer: { response, responseBody in
706+
switch response.status.code {
707+
case 204:
708+
return .noContent(.init())
709+
case 403:
710+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
711+
let body: Components.Responses.Forbidden.Body
712+
let chosenContentType = try converter.bestContentType(
713+
received: contentType,
714+
options: [
715+
"application/json"
716+
]
717+
)
718+
switch chosenContentType {
719+
case "application/json":
720+
body = try await converter.getResponseBodyAsJSON(
721+
Components.Schemas.BasicError.self,
722+
from: responseBody,
723+
transforming: { value in
724+
.json(value)
725+
}
726+
)
727+
default:
728+
preconditionFailure("bestContentType chose an invalid content type.")
729+
}
730+
return .forbidden(.init(body: body))
731+
case 404:
732+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
733+
let body: Components.Responses.NotFound.Body
734+
let chosenContentType = try converter.bestContentType(
735+
received: contentType,
736+
options: [
737+
"application/json"
738+
]
739+
)
740+
switch chosenContentType {
741+
case "application/json":
742+
body = try await converter.getResponseBodyAsJSON(
743+
Components.Schemas.BasicError.self,
744+
from: responseBody,
745+
transforming: { value in
746+
.json(value)
747+
}
748+
)
749+
default:
750+
preconditionFailure("bestContentType chose an invalid content type.")
751+
}
752+
return .notFound(.init(body: body))
753+
case 422:
754+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
755+
let body: Components.Responses.ValidationFailed.Body
756+
let chosenContentType = try converter.bestContentType(
757+
received: contentType,
758+
options: [
759+
"application/json"
760+
]
761+
)
762+
switch chosenContentType {
763+
case "application/json":
764+
body = try await converter.getResponseBodyAsJSON(
765+
Components.Schemas.ValidationError.self,
766+
from: responseBody,
767+
transforming: { value in
768+
.json(value)
769+
}
770+
)
771+
default:
772+
preconditionFailure("bestContentType chose an invalid content type.")
773+
}
774+
return .unprocessableContent(.init(body: body))
775+
default:
776+
return .undocumented(
777+
statusCode: response.status.code,
778+
.init(
779+
headerFields: response.headerFields,
780+
body: responseBody
781+
)
782+
)
783+
}
784+
}
785+
)
786+
}
424787
/// Get interaction restrictions for your public repositories
425788
///
426789
/// Shows which type of GitHub user can interact with your public repositories and when the restriction expires.

0 commit comments

Comments
 (0)