Skip to content

Commit 2e20194

Browse files
Commit via running ake Sources/git
1 parent ce74e29 commit 2e20194

File tree

2 files changed

+575
-19
lines changed

2 files changed

+575
-19
lines changed

Sources/git/Client.swift

Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,28 @@ public struct Client: APIProtocol {
333333
preconditionFailure("bestContentType chose an invalid content type.")
334334
}
335335
return .forbidden(.init(body: body))
336+
case 409:
337+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
338+
let body: Components.Responses.conflict.Body
339+
let chosenContentType = try converter.bestContentType(
340+
received: contentType,
341+
options: [
342+
"application/json"
343+
]
344+
)
345+
switch chosenContentType {
346+
case "application/json":
347+
body = try await converter.getResponseBodyAsJSON(
348+
Components.Schemas.basic_hyphen_error.self,
349+
from: responseBody,
350+
transforming: { value in
351+
.json(value)
352+
}
353+
)
354+
default:
355+
preconditionFailure("bestContentType chose an invalid content type.")
356+
}
357+
return .conflict(.init(body: body))
336358
default:
337359
return .undocumented(
338360
statusCode: response.status.code,
@@ -488,6 +510,28 @@ public struct Client: APIProtocol {
488510
preconditionFailure("bestContentType chose an invalid content type.")
489511
}
490512
return .notFound(.init(body: body))
513+
case 409:
514+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
515+
let body: Components.Responses.conflict.Body
516+
let chosenContentType = try converter.bestContentType(
517+
received: contentType,
518+
options: [
519+
"application/json"
520+
]
521+
)
522+
switch chosenContentType {
523+
case "application/json":
524+
body = try await converter.getResponseBodyAsJSON(
525+
Components.Schemas.basic_hyphen_error.self,
526+
from: responseBody,
527+
transforming: { value in
528+
.json(value)
529+
}
530+
)
531+
default:
532+
preconditionFailure("bestContentType chose an invalid content type.")
533+
}
534+
return .conflict(.init(body: body))
491535
default:
492536
return .undocumented(
493537
statusCode: response.status.code,
@@ -607,6 +651,28 @@ public struct Client: APIProtocol {
607651
preconditionFailure("bestContentType chose an invalid content type.")
608652
}
609653
return .notFound(.init(body: body))
654+
case 409:
655+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
656+
let body: Components.Responses.conflict.Body
657+
let chosenContentType = try converter.bestContentType(
658+
received: contentType,
659+
options: [
660+
"application/json"
661+
]
662+
)
663+
switch chosenContentType {
664+
case "application/json":
665+
body = try await converter.getResponseBodyAsJSON(
666+
Components.Schemas.basic_hyphen_error.self,
667+
from: responseBody,
668+
transforming: { value in
669+
.json(value)
670+
}
671+
)
672+
default:
673+
preconditionFailure("bestContentType chose an invalid content type.")
674+
}
675+
return .conflict(.init(body: body))
610676
default:
611677
return .undocumented(
612678
statusCode: response.status.code,
@@ -687,6 +753,28 @@ public struct Client: APIProtocol {
687753
headers: headers,
688754
body: body
689755
))
756+
case 409:
757+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
758+
let body: Components.Responses.conflict.Body
759+
let chosenContentType = try converter.bestContentType(
760+
received: contentType,
761+
options: [
762+
"application/json"
763+
]
764+
)
765+
switch chosenContentType {
766+
case "application/json":
767+
body = try await converter.getResponseBodyAsJSON(
768+
Components.Schemas.basic_hyphen_error.self,
769+
from: responseBody,
770+
transforming: { value in
771+
.json(value)
772+
}
773+
)
774+
default:
775+
preconditionFailure("bestContentType chose an invalid content type.")
776+
}
777+
return .conflict(.init(body: body))
690778
default:
691779
return .undocumented(
692780
statusCode: response.status.code,
@@ -777,6 +865,28 @@ public struct Client: APIProtocol {
777865
preconditionFailure("bestContentType chose an invalid content type.")
778866
}
779867
return .notFound(.init(body: body))
868+
case 409:
869+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
870+
let body: Components.Responses.conflict.Body
871+
let chosenContentType = try converter.bestContentType(
872+
received: contentType,
873+
options: [
874+
"application/json"
875+
]
876+
)
877+
switch chosenContentType {
878+
case "application/json":
879+
body = try await converter.getResponseBodyAsJSON(
880+
Components.Schemas.basic_hyphen_error.self,
881+
from: responseBody,
882+
transforming: { value in
883+
.json(value)
884+
}
885+
)
886+
default:
887+
preconditionFailure("bestContentType chose an invalid content type.")
888+
}
889+
return .conflict(.init(body: body))
780890
default:
781891
return .undocumented(
782892
statusCode: response.status.code,
@@ -881,6 +991,28 @@ public struct Client: APIProtocol {
881991
preconditionFailure("bestContentType chose an invalid content type.")
882992
}
883993
return .unprocessableContent(.init(body: body))
994+
case 409:
995+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
996+
let body: Components.Responses.conflict.Body
997+
let chosenContentType = try converter.bestContentType(
998+
received: contentType,
999+
options: [
1000+
"application/json"
1001+
]
1002+
)
1003+
switch chosenContentType {
1004+
case "application/json":
1005+
body = try await converter.getResponseBodyAsJSON(
1006+
Components.Schemas.basic_hyphen_error.self,
1007+
from: responseBody,
1008+
transforming: { value in
1009+
.json(value)
1010+
}
1011+
)
1012+
default:
1013+
preconditionFailure("bestContentType chose an invalid content type.")
1014+
}
1015+
return .conflict(.init(body: body))
8841016
default:
8851017
return .undocumented(
8861018
statusCode: response.status.code,
@@ -895,6 +1027,8 @@ public struct Client: APIProtocol {
8951027
}
8961028
/// Update a reference
8971029
///
1030+
/// Updates the provided reference to point to a new SHA. For more information, see "[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)" in the Git documentation.
1031+
///
8981032
/// - Remark: HTTP `PATCH /repos/{owner}/{repo}/git/refs/{ref}`.
8991033
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/git/refs/{ref}/patch(git/update-ref)`.
9001034
public func git_sol_update_hyphen_ref(_ input: Operations.git_sol_update_hyphen_ref.Input) async throws -> Operations.git_sol_update_hyphen_ref.Output {
@@ -976,6 +1110,28 @@ public struct Client: APIProtocol {
9761110
preconditionFailure("bestContentType chose an invalid content type.")
9771111
}
9781112
return .unprocessableContent(.init(body: body))
1113+
case 409:
1114+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1115+
let body: Components.Responses.conflict.Body
1116+
let chosenContentType = try converter.bestContentType(
1117+
received: contentType,
1118+
options: [
1119+
"application/json"
1120+
]
1121+
)
1122+
switch chosenContentType {
1123+
case "application/json":
1124+
body = try await converter.getResponseBodyAsJSON(
1125+
Components.Schemas.basic_hyphen_error.self,
1126+
from: responseBody,
1127+
transforming: { value in
1128+
.json(value)
1129+
}
1130+
)
1131+
default:
1132+
preconditionFailure("bestContentType chose an invalid content type.")
1133+
}
1134+
return .conflict(.init(body: body))
9791135
default:
9801136
return .undocumented(
9811137
statusCode: response.status.code,
@@ -990,6 +1146,8 @@ public struct Client: APIProtocol {
9901146
}
9911147
/// Delete a reference
9921148
///
1149+
/// Deletes the provided reference.
1150+
///
9931151
/// - Remark: HTTP `DELETE /repos/{owner}/{repo}/git/refs/{ref}`.
9941152
/// - Remark: Generated from `#/paths//repos/{owner}/{repo}/git/refs/{ref}/delete(git/delete-ref)`.
9951153
public func git_sol_delete_hyphen_ref(_ input: Operations.git_sol_delete_hyphen_ref.Input) async throws -> Operations.git_sol_delete_hyphen_ref.Output {
@@ -1042,6 +1200,28 @@ public struct Client: APIProtocol {
10421200
preconditionFailure("bestContentType chose an invalid content type.")
10431201
}
10441202
return .unprocessableContent(.init(body: body))
1203+
case 409:
1204+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1205+
let body: Components.Responses.conflict.Body
1206+
let chosenContentType = try converter.bestContentType(
1207+
received: contentType,
1208+
options: [
1209+
"application/json"
1210+
]
1211+
)
1212+
switch chosenContentType {
1213+
case "application/json":
1214+
body = try await converter.getResponseBodyAsJSON(
1215+
Components.Schemas.basic_hyphen_error.self,
1216+
from: responseBody,
1217+
transforming: { value in
1218+
.json(value)
1219+
}
1220+
)
1221+
default:
1222+
preconditionFailure("bestContentType chose an invalid content type.")
1223+
}
1224+
return .conflict(.init(body: body))
10451225
default:
10461226
return .undocumented(
10471227
statusCode: response.status.code,
@@ -1175,6 +1355,28 @@ public struct Client: APIProtocol {
11751355
preconditionFailure("bestContentType chose an invalid content type.")
11761356
}
11771357
return .unprocessableContent(.init(body: body))
1358+
case 409:
1359+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1360+
let body: Components.Responses.conflict.Body
1361+
let chosenContentType = try converter.bestContentType(
1362+
received: contentType,
1363+
options: [
1364+
"application/json"
1365+
]
1366+
)
1367+
switch chosenContentType {
1368+
case "application/json":
1369+
body = try await converter.getResponseBodyAsJSON(
1370+
Components.Schemas.basic_hyphen_error.self,
1371+
from: responseBody,
1372+
transforming: { value in
1373+
.json(value)
1374+
}
1375+
)
1376+
default:
1377+
preconditionFailure("bestContentType chose an invalid content type.")
1378+
}
1379+
return .conflict(.init(body: body))
11781380
default:
11791381
return .undocumented(
11801382
statusCode: response.status.code,
@@ -1290,6 +1492,28 @@ public struct Client: APIProtocol {
12901492
preconditionFailure("bestContentType chose an invalid content type.")
12911493
}
12921494
return .notFound(.init(body: body))
1495+
case 409:
1496+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1497+
let body: Components.Responses.conflict.Body
1498+
let chosenContentType = try converter.bestContentType(
1499+
received: contentType,
1500+
options: [
1501+
"application/json"
1502+
]
1503+
)
1504+
switch chosenContentType {
1505+
case "application/json":
1506+
body = try await converter.getResponseBodyAsJSON(
1507+
Components.Schemas.basic_hyphen_error.self,
1508+
from: responseBody,
1509+
transforming: { value in
1510+
.json(value)
1511+
}
1512+
)
1513+
default:
1514+
preconditionFailure("bestContentType chose an invalid content type.")
1515+
}
1516+
return .conflict(.init(body: body))
12931517
default:
12941518
return .undocumented(
12951519
statusCode: response.status.code,
@@ -1442,6 +1666,28 @@ public struct Client: APIProtocol {
14421666
preconditionFailure("bestContentType chose an invalid content type.")
14431667
}
14441668
return .forbidden(.init(body: body))
1669+
case 409:
1670+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1671+
let body: Components.Responses.conflict.Body
1672+
let chosenContentType = try converter.bestContentType(
1673+
received: contentType,
1674+
options: [
1675+
"application/json"
1676+
]
1677+
)
1678+
switch chosenContentType {
1679+
case "application/json":
1680+
body = try await converter.getResponseBodyAsJSON(
1681+
Components.Schemas.basic_hyphen_error.self,
1682+
from: responseBody,
1683+
transforming: { value in
1684+
.json(value)
1685+
}
1686+
)
1687+
default:
1688+
preconditionFailure("bestContentType chose an invalid content type.")
1689+
}
1690+
return .conflict(.init(body: body))
14451691
default:
14461692
return .undocumented(
14471693
statusCode: response.status.code,
@@ -1564,6 +1810,28 @@ public struct Client: APIProtocol {
15641810
preconditionFailure("bestContentType chose an invalid content type.")
15651811
}
15661812
return .notFound(.init(body: body))
1813+
case 409:
1814+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
1815+
let body: Components.Responses.conflict.Body
1816+
let chosenContentType = try converter.bestContentType(
1817+
received: contentType,
1818+
options: [
1819+
"application/json"
1820+
]
1821+
)
1822+
switch chosenContentType {
1823+
case "application/json":
1824+
body = try await converter.getResponseBodyAsJSON(
1825+
Components.Schemas.basic_hyphen_error.self,
1826+
from: responseBody,
1827+
transforming: { value in
1828+
.json(value)
1829+
}
1830+
)
1831+
default:
1832+
preconditionFailure("bestContentType chose an invalid content type.")
1833+
}
1834+
return .conflict(.init(body: body))
15671835
default:
15681836
return .undocumented(
15691837
statusCode: response.status.code,

0 commit comments

Comments
 (0)