@@ -38,4 +38,345 @@ public struct Client: APIProtocol {
3838 private var converter : Converter {
3939 client. converter
4040 }
41+ /// Get a code quality setup configuration
42+ ///
43+ /// Gets a code quality setup configuration.
44+ ///
45+ /// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.
46+ ///
47+ /// - Remark: HTTP `GET /repos/{owner}/{repo}/code-quality/setup`.
48+ /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/code-quality/setup/get(code-quality/get-setup)`.
49+ public func codeQualityGetSetup( _ input: Operations . CodeQualityGetSetup . Input ) async throws -> Operations . CodeQualityGetSetup . Output {
50+ try await client. send (
51+ input: input,
52+ forOperation: Operations . CodeQualityGetSetup. id,
53+ serializer: { input in
54+ let path = try converter. renderedPath (
55+ template: " /repos/{}/{}/code-quality/setup " ,
56+ parameters: [
57+ input. path. owner,
58+ input. path. repo
59+ ]
60+ )
61+ var request : HTTPTypes . HTTPRequest = . init(
62+ soar_path: path,
63+ method: . get
64+ )
65+ suppressMutabilityWarning ( & request)
66+ converter. setAcceptHeader (
67+ in: & request. headerFields,
68+ contentTypes: input. headers. accept
69+ )
70+ return ( request, nil )
71+ } ,
72+ deserializer: { response, responseBody in
73+ switch response. status. code {
74+ case 200 :
75+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
76+ let body : Operations . CodeQualityGetSetup . Output . Ok . Body
77+ let chosenContentType = try converter. bestContentType (
78+ received: contentType,
79+ options: [
80+ " application/json "
81+ ]
82+ )
83+ switch chosenContentType {
84+ case " application/json " :
85+ body = try await converter. getResponseBodyAsJSON (
86+ Components . Schemas. CodeQualitySetup. self,
87+ from: responseBody,
88+ transforming: { value in
89+ . json( value)
90+ }
91+ )
92+ default :
93+ preconditionFailure ( " bestContentType chose an invalid content type. " )
94+ }
95+ return . ok( . init( body: body) )
96+ case 403 :
97+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
98+ let body : Components . Responses . CodeQualityForbiddenRead . Body
99+ let chosenContentType = try converter. bestContentType (
100+ received: contentType,
101+ options: [
102+ " application/json "
103+ ]
104+ )
105+ switch chosenContentType {
106+ case " application/json " :
107+ body = try await converter. getResponseBodyAsJSON (
108+ Components . Schemas. BasicError. self,
109+ from: responseBody,
110+ transforming: { value in
111+ . json( value)
112+ }
113+ )
114+ default :
115+ preconditionFailure ( " bestContentType chose an invalid content type. " )
116+ }
117+ return . forbidden( . init( body: body) )
118+ case 404 :
119+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
120+ let body : Components . Responses . NotFound . Body
121+ let chosenContentType = try converter. bestContentType (
122+ received: contentType,
123+ options: [
124+ " application/json "
125+ ]
126+ )
127+ switch chosenContentType {
128+ case " application/json " :
129+ body = try await converter. getResponseBodyAsJSON (
130+ Components . Schemas. BasicError. self,
131+ from: responseBody,
132+ transforming: { value in
133+ . json( value)
134+ }
135+ )
136+ default :
137+ preconditionFailure ( " bestContentType chose an invalid content type. " )
138+ }
139+ return . notFound( . init( body: body) )
140+ case 503 :
141+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
142+ let body : Components . Responses . ServiceUnavailable . Body
143+ let chosenContentType = try converter. bestContentType (
144+ received: contentType,
145+ options: [
146+ " application/json "
147+ ]
148+ )
149+ switch chosenContentType {
150+ case " application/json " :
151+ body = try await converter. getResponseBodyAsJSON (
152+ Components . Responses. ServiceUnavailable. Body. JsonPayload. self,
153+ from: responseBody,
154+ transforming: { value in
155+ . json( value)
156+ }
157+ )
158+ default :
159+ preconditionFailure ( " bestContentType chose an invalid content type. " )
160+ }
161+ return . serviceUnavailable( . init( body: body) )
162+ default :
163+ return . undocumented(
164+ statusCode: response. status. code,
165+ . init(
166+ headerFields: response. headerFields,
167+ body: responseBody
168+ )
169+ )
170+ }
171+ }
172+ )
173+ }
174+ /// Update a code quality setup configuration
175+ ///
176+ /// Updates a code quality setup configuration.
177+ ///
178+ /// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.
179+ ///
180+ /// - Remark: HTTP `PATCH /repos/{owner}/{repo}/code-quality/setup`.
181+ /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/code-quality/setup/patch(code-quality/update-setup)`.
182+ public func codeQualityUpdateSetup( _ input: Operations . CodeQualityUpdateSetup . Input ) async throws -> Operations . CodeQualityUpdateSetup . Output {
183+ try await client. send (
184+ input: input,
185+ forOperation: Operations . CodeQualityUpdateSetup. id,
186+ serializer: { input in
187+ let path = try converter. renderedPath (
188+ template: " /repos/{}/{}/code-quality/setup " ,
189+ parameters: [
190+ input. path. owner,
191+ input. path. repo
192+ ]
193+ )
194+ var request : HTTPTypes . HTTPRequest = . init(
195+ soar_path: path,
196+ method: . patch
197+ )
198+ suppressMutabilityWarning ( & request)
199+ converter. setAcceptHeader (
200+ in: & request. headerFields,
201+ contentTypes: input. headers. accept
202+ )
203+ let body : OpenAPIRuntime . HTTPBody ?
204+ switch input. body {
205+ case let . json( value) :
206+ body = try converter. setRequiredRequestBodyAsJSON (
207+ value,
208+ headerFields: & request. headerFields,
209+ contentType: " application/json; charset=utf-8 "
210+ )
211+ }
212+ return ( request, body)
213+ } ,
214+ deserializer: { response, responseBody in
215+ switch response. status. code {
216+ case 200 :
217+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
218+ let body : Operations . CodeQualityUpdateSetup . Output . Ok . Body
219+ let chosenContentType = try converter. bestContentType (
220+ received: contentType,
221+ options: [
222+ " application/json "
223+ ]
224+ )
225+ switch chosenContentType {
226+ case " application/json " :
227+ body = try await converter. getResponseBodyAsJSON (
228+ Components . Schemas. EmptyObject. self,
229+ from: responseBody,
230+ transforming: { value in
231+ . json( value)
232+ }
233+ )
234+ default :
235+ preconditionFailure ( " bestContentType chose an invalid content type. " )
236+ }
237+ return . ok( . init( body: body) )
238+ case 202 :
239+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
240+ let body : Operations . CodeQualityUpdateSetup . Output . Accepted . Body
241+ let chosenContentType = try converter. bestContentType (
242+ received: contentType,
243+ options: [
244+ " application/json "
245+ ]
246+ )
247+ switch chosenContentType {
248+ case " application/json " :
249+ body = try await converter. getResponseBodyAsJSON (
250+ Components . Schemas. CodeQualitySetupUpdateResponse. self,
251+ from: responseBody,
252+ transforming: { value in
253+ . json( value)
254+ }
255+ )
256+ default :
257+ preconditionFailure ( " bestContentType chose an invalid content type. " )
258+ }
259+ return . accepted( . init( body: body) )
260+ case 403 :
261+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
262+ let body : Components . Responses . CodeQualityForbiddenWrite . Body
263+ let chosenContentType = try converter. bestContentType (
264+ received: contentType,
265+ options: [
266+ " application/json "
267+ ]
268+ )
269+ switch chosenContentType {
270+ case " application/json " :
271+ body = try await converter. getResponseBodyAsJSON (
272+ Components . Schemas. BasicError. self,
273+ from: responseBody,
274+ transforming: { value in
275+ . json( value)
276+ }
277+ )
278+ default :
279+ preconditionFailure ( " bestContentType chose an invalid content type. " )
280+ }
281+ return . forbidden( . init( body: body) )
282+ case 404 :
283+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
284+ let body : Components . Responses . NotFound . Body
285+ let chosenContentType = try converter. bestContentType (
286+ received: contentType,
287+ options: [
288+ " application/json "
289+ ]
290+ )
291+ switch chosenContentType {
292+ case " application/json " :
293+ body = try await converter. getResponseBodyAsJSON (
294+ Components . Schemas. BasicError. self,
295+ from: responseBody,
296+ transforming: { value in
297+ . json( value)
298+ }
299+ )
300+ default :
301+ preconditionFailure ( " bestContentType chose an invalid content type. " )
302+ }
303+ return . notFound( . init( body: body) )
304+ case 409 :
305+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
306+ let body : Components . Responses . CodeQualityConflict . Body
307+ let chosenContentType = try converter. bestContentType (
308+ received: contentType,
309+ options: [
310+ " application/json "
311+ ]
312+ )
313+ switch chosenContentType {
314+ case " application/json " :
315+ body = try await converter. getResponseBodyAsJSON (
316+ Components . Schemas. BasicError. self,
317+ from: responseBody,
318+ transforming: { value in
319+ . json( value)
320+ }
321+ )
322+ default :
323+ preconditionFailure ( " bestContentType chose an invalid content type. " )
324+ }
325+ return . conflict( . init( body: body) )
326+ case 422 :
327+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
328+ let body : Components . Responses . CodeQualityInvalidState . Body
329+ let chosenContentType = try converter. bestContentType (
330+ received: contentType,
331+ options: [
332+ " application/json "
333+ ]
334+ )
335+ switch chosenContentType {
336+ case " application/json " :
337+ body = try await converter. getResponseBodyAsJSON (
338+ Components . Schemas. BasicError. self,
339+ from: responseBody,
340+ transforming: { value in
341+ . json( value)
342+ }
343+ )
344+ default :
345+ preconditionFailure ( " bestContentType chose an invalid content type. " )
346+ }
347+ return . unprocessableContent( . init( body: body) )
348+ case 503 :
349+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
350+ let body : Components . Responses . ServiceUnavailable . Body
351+ let chosenContentType = try converter. bestContentType (
352+ received: contentType,
353+ options: [
354+ " application/json "
355+ ]
356+ )
357+ switch chosenContentType {
358+ case " application/json " :
359+ body = try await converter. getResponseBodyAsJSON (
360+ Components . Responses. ServiceUnavailable. Body. JsonPayload. self,
361+ from: responseBody,
362+ transforming: { value in
363+ . json( value)
364+ }
365+ )
366+ default :
367+ preconditionFailure ( " bestContentType chose an invalid content type. " )
368+ }
369+ return . serviceUnavailable( . init( body: body) )
370+ default :
371+ return . undocumented(
372+ statusCode: response. status. code,
373+ . init(
374+ headerFields: response. headerFields,
375+ body: responseBody
376+ )
377+ )
378+ }
379+ }
380+ )
381+ }
41382}
0 commit comments