Skip to content

Commit 6964a64

Browse files
Merge pull request #59 from Wei18/dependabot/submodules/Submodule/github/rest-api-description-d2303fd
Bump Submodule/github/rest-api-description from `62b23af` to `d2303fd`
2 parents 10dea55 + 23e884c commit 6964a64

File tree

16 files changed

+12131
-4873
lines changed

16 files changed

+12131
-4873
lines changed

Sources/actions/Types.swift

+245-245
Large diffs are not rendered by default.

Sources/code-security/Client.swift

+1,019
Large diffs are not rendered by default.

Sources/code-security/Types.swift

+3,654-5
Large diffs are not rendered by default.

Sources/copilot/Client.swift

+184
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,190 @@ public struct Client: APIProtocol {
3838
private var converter: Converter {
3939
client.converter
4040
}
41+
/// List all Copilot seat assignments for an enterprise
42+
///
43+
/// **Note**: This endpoint is in beta and is subject to change.
44+
///
45+
/// Lists all active Copilot seats across organizations or enterprise teams for an enterprise with a Copilot Business or Copilot Enterprise subscription.
46+
///
47+
/// Users with access through multiple organizations or enterprise teams will only be counted toward `total_seats` once.
48+
///
49+
/// For each organization or enterprise team which grants Copilot access to a user, a seat detail object will appear in the `seats` array.
50+
///
51+
/// Only enterprise owners and billing managers can view assigned Copilot seats across their child organizations or enterprise teams.
52+
///
53+
/// Personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint.
54+
///
55+
/// - Remark: HTTP `GET /enterprises/{enterprise}/copilot/billing/seats`.
56+
/// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/billing/seats/get(copilot/list-copilot-seats-for-enterprise)`.
57+
public func copilot_sol_list_hyphen_copilot_hyphen_seats_hyphen_for_hyphen_enterprise(_ input: Operations.copilot_sol_list_hyphen_copilot_hyphen_seats_hyphen_for_hyphen_enterprise.Input) async throws -> Operations.copilot_sol_list_hyphen_copilot_hyphen_seats_hyphen_for_hyphen_enterprise.Output {
58+
try await client.send(
59+
input: input,
60+
forOperation: Operations.copilot_sol_list_hyphen_copilot_hyphen_seats_hyphen_for_hyphen_enterprise.id,
61+
serializer: { input in
62+
let path = try converter.renderedPath(
63+
template: "/enterprises/{}/copilot/billing/seats",
64+
parameters: [
65+
input.path.enterprise
66+
]
67+
)
68+
var request: HTTPTypes.HTTPRequest = .init(
69+
soar_path: path,
70+
method: .get
71+
)
72+
suppressMutabilityWarning(&request)
73+
try converter.setQueryItemAsURI(
74+
in: &request,
75+
style: .form,
76+
explode: true,
77+
name: "page",
78+
value: input.query.page
79+
)
80+
try converter.setQueryItemAsURI(
81+
in: &request,
82+
style: .form,
83+
explode: true,
84+
name: "per_page",
85+
value: input.query.per_page
86+
)
87+
converter.setAcceptHeader(
88+
in: &request.headerFields,
89+
contentTypes: input.headers.accept
90+
)
91+
return (request, nil)
92+
},
93+
deserializer: { response, responseBody in
94+
switch response.status.code {
95+
case 200:
96+
let headers: Operations.copilot_sol_list_hyphen_copilot_hyphen_seats_hyphen_for_hyphen_enterprise.Output.Ok.Headers = .init(Link: try converter.getOptionalHeaderFieldAsURI(
97+
in: response.headerFields,
98+
name: "Link",
99+
as: Components.Headers.link.self
100+
))
101+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
102+
let body: Operations.copilot_sol_list_hyphen_copilot_hyphen_seats_hyphen_for_hyphen_enterprise.Output.Ok.Body
103+
let chosenContentType = try converter.bestContentType(
104+
received: contentType,
105+
options: [
106+
"application/json"
107+
]
108+
)
109+
switch chosenContentType {
110+
case "application/json":
111+
body = try await converter.getResponseBodyAsJSON(
112+
Operations.copilot_sol_list_hyphen_copilot_hyphen_seats_hyphen_for_hyphen_enterprise.Output.Ok.Body.jsonPayload.self,
113+
from: responseBody,
114+
transforming: { value in
115+
.json(value)
116+
}
117+
)
118+
default:
119+
preconditionFailure("bestContentType chose an invalid content type.")
120+
}
121+
return .ok(.init(
122+
headers: headers,
123+
body: body
124+
))
125+
case 500:
126+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
127+
let body: Components.Responses.internal_error.Body
128+
let chosenContentType = try converter.bestContentType(
129+
received: contentType,
130+
options: [
131+
"application/json"
132+
]
133+
)
134+
switch chosenContentType {
135+
case "application/json":
136+
body = try await converter.getResponseBodyAsJSON(
137+
Components.Schemas.basic_hyphen_error.self,
138+
from: responseBody,
139+
transforming: { value in
140+
.json(value)
141+
}
142+
)
143+
default:
144+
preconditionFailure("bestContentType chose an invalid content type.")
145+
}
146+
return .internalServerError(.init(body: body))
147+
case 401:
148+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
149+
let body: Components.Responses.requires_authentication.Body
150+
let chosenContentType = try converter.bestContentType(
151+
received: contentType,
152+
options: [
153+
"application/json"
154+
]
155+
)
156+
switch chosenContentType {
157+
case "application/json":
158+
body = try await converter.getResponseBodyAsJSON(
159+
Components.Schemas.basic_hyphen_error.self,
160+
from: responseBody,
161+
transforming: { value in
162+
.json(value)
163+
}
164+
)
165+
default:
166+
preconditionFailure("bestContentType chose an invalid content type.")
167+
}
168+
return .unauthorized(.init(body: body))
169+
case 403:
170+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
171+
let body: Components.Responses.forbidden.Body
172+
let chosenContentType = try converter.bestContentType(
173+
received: contentType,
174+
options: [
175+
"application/json"
176+
]
177+
)
178+
switch chosenContentType {
179+
case "application/json":
180+
body = try await converter.getResponseBodyAsJSON(
181+
Components.Schemas.basic_hyphen_error.self,
182+
from: responseBody,
183+
transforming: { value in
184+
.json(value)
185+
}
186+
)
187+
default:
188+
preconditionFailure("bestContentType chose an invalid content type.")
189+
}
190+
return .forbidden(.init(body: body))
191+
case 404:
192+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
193+
let body: Components.Responses.not_found.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.basic_hyphen_error.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+
default:
214+
return .undocumented(
215+
statusCode: response.status.code,
216+
.init(
217+
headerFields: response.headerFields,
218+
body: responseBody
219+
)
220+
)
221+
}
222+
}
223+
)
224+
}
41225
/// Get a summary of Copilot usage for enterprise members
42226
///
43227
/// **Note**: This endpoint is in beta and is subject to change.

0 commit comments

Comments
 (0)