@@ -38,6 +38,197 @@ public struct Client: APIProtocol {
38
38
private var converter : Converter {
39
39
client. converter
40
40
}
41
+ /// Get billing usage report for an organization
42
+ ///
43
+ /// Gets a report of the total usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account.
44
+ ///
45
+ /// **Note:** This endpoint is only available to organizations with access to the enhanced billing platform. For more information, see "[About the enhanced billing platform](https://docs.github.com/billing/using-the-new-billing-platform)."
46
+ ///
47
+ /// - Remark: HTTP `GET /organizations/{org}/settings/billing/usage`.
48
+ /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/usage/get(billing/get-github-billing-usage-report-org)`.
49
+ public func billing_sol_get_hyphen_github_hyphen_billing_hyphen_usage_hyphen_report_hyphen_org( _ input: Operations . billing_sol_get_hyphen_github_hyphen_billing_hyphen_usage_hyphen_report_hyphen_org . Input ) async throws -> Operations . billing_sol_get_hyphen_github_hyphen_billing_hyphen_usage_hyphen_report_hyphen_org . Output {
50
+ try await client. send (
51
+ input: input,
52
+ forOperation: Operations . billing_sol_get_hyphen_github_hyphen_billing_hyphen_usage_hyphen_report_hyphen_org. id,
53
+ serializer: { input in
54
+ let path = try converter. renderedPath (
55
+ template: " /organizations/{}/settings/billing/usage " ,
56
+ parameters: [
57
+ input. path. org
58
+ ]
59
+ )
60
+ var request : HTTPTypes . HTTPRequest = . init(
61
+ soar_path: path,
62
+ method: . get
63
+ )
64
+ suppressMutabilityWarning ( & request)
65
+ try converter. setQueryItemAsURI (
66
+ in: & request,
67
+ style: . form,
68
+ explode: true ,
69
+ name: " year " ,
70
+ value: input. query. year
71
+ )
72
+ try converter. setQueryItemAsURI (
73
+ in: & request,
74
+ style: . form,
75
+ explode: true ,
76
+ name: " month " ,
77
+ value: input. query. month
78
+ )
79
+ try converter. setQueryItemAsURI (
80
+ in: & request,
81
+ style: . form,
82
+ explode: true ,
83
+ name: " day " ,
84
+ value: input. query. day
85
+ )
86
+ try converter. setQueryItemAsURI (
87
+ in: & request,
88
+ style: . form,
89
+ explode: true ,
90
+ name: " hour " ,
91
+ value: input. query. hour
92
+ )
93
+ converter. setAcceptHeader (
94
+ in: & request. headerFields,
95
+ contentTypes: input. headers. accept
96
+ )
97
+ return ( request, nil )
98
+ } ,
99
+ deserializer: { response, responseBody in
100
+ switch response. status. code {
101
+ case 200 :
102
+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
103
+ let body : Components . Responses . billing_usage_report_org . Body
104
+ let chosenContentType = try converter. bestContentType (
105
+ received: contentType,
106
+ options: [
107
+ " application/json "
108
+ ]
109
+ )
110
+ switch chosenContentType {
111
+ case " application/json " :
112
+ body = try await converter. getResponseBodyAsJSON (
113
+ Components . Schemas. billing_hyphen_usage_hyphen_report. self,
114
+ from: responseBody,
115
+ transforming: { value in
116
+ . json( value)
117
+ }
118
+ )
119
+ default :
120
+ preconditionFailure ( " bestContentType chose an invalid content type. " )
121
+ }
122
+ return . ok( . init( body: body) )
123
+ case 400 :
124
+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
125
+ let body : Components . Responses . bad_request . Body
126
+ let chosenContentType = try converter. bestContentType (
127
+ received: contentType,
128
+ options: [
129
+ " application/json " ,
130
+ " application/scim+json "
131
+ ]
132
+ )
133
+ switch chosenContentType {
134
+ case " application/json " :
135
+ body = try await converter. getResponseBodyAsJSON (
136
+ Components . Schemas. basic_hyphen_error. self,
137
+ from: responseBody,
138
+ transforming: { value in
139
+ . json( value)
140
+ }
141
+ )
142
+ case " application/scim+json " :
143
+ body = try await converter. getResponseBodyAsJSON (
144
+ Components . Schemas. scim_hyphen_error. self,
145
+ from: responseBody,
146
+ transforming: { value in
147
+ . application_scim_plus_json( value)
148
+ }
149
+ )
150
+ default :
151
+ preconditionFailure ( " bestContentType chose an invalid content type. " )
152
+ }
153
+ return . badRequest( . init( body: body) )
154
+ case 403 :
155
+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
156
+ let body : Components . Responses . forbidden . Body
157
+ let chosenContentType = try converter. bestContentType (
158
+ received: contentType,
159
+ options: [
160
+ " application/json "
161
+ ]
162
+ )
163
+ switch chosenContentType {
164
+ case " application/json " :
165
+ body = try await converter. getResponseBodyAsJSON (
166
+ Components . Schemas. basic_hyphen_error. self,
167
+ from: responseBody,
168
+ transforming: { value in
169
+ . json( value)
170
+ }
171
+ )
172
+ default :
173
+ preconditionFailure ( " bestContentType chose an invalid content type. " )
174
+ }
175
+ return . forbidden( . init( body: body) )
176
+ case 500 :
177
+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
178
+ let body : Components . Responses . internal_error . Body
179
+ let chosenContentType = try converter. bestContentType (
180
+ received: contentType,
181
+ options: [
182
+ " application/json "
183
+ ]
184
+ )
185
+ switch chosenContentType {
186
+ case " application/json " :
187
+ body = try await converter. getResponseBodyAsJSON (
188
+ Components . Schemas. basic_hyphen_error. self,
189
+ from: responseBody,
190
+ transforming: { value in
191
+ . json( value)
192
+ }
193
+ )
194
+ default :
195
+ preconditionFailure ( " bestContentType chose an invalid content type. " )
196
+ }
197
+ return . internalServerError( . init( body: body) )
198
+ case 503 :
199
+ let contentType = converter. extractContentTypeIfPresent ( in: response. headerFields)
200
+ let body : Components . Responses . service_unavailable . Body
201
+ let chosenContentType = try converter. bestContentType (
202
+ received: contentType,
203
+ options: [
204
+ " application/json "
205
+ ]
206
+ )
207
+ switch chosenContentType {
208
+ case " application/json " :
209
+ body = try await converter. getResponseBodyAsJSON (
210
+ Components . Responses. service_unavailable. Body. jsonPayload. self,
211
+ from: responseBody,
212
+ transforming: { value in
213
+ . json( value)
214
+ }
215
+ )
216
+ default :
217
+ preconditionFailure ( " bestContentType chose an invalid content type. " )
218
+ }
219
+ return . serviceUnavailable( . init( body: body) )
220
+ default :
221
+ return . undocumented(
222
+ statusCode: response. status. code,
223
+ . init(
224
+ headerFields: response. headerFields,
225
+ body: responseBody
226
+ )
227
+ )
228
+ }
229
+ }
230
+ )
231
+ }
41
232
/// Get GitHub Actions billing for an organization
42
233
///
43
234
/// Gets the summary of the free and paid GitHub Actions minutes used.
0 commit comments