Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 532759b

Browse files
Merge pull request #116 from wei18/dependabot/submodules/Submodule/github/rest-api-description-467f6a9
Bump Submodule/github/rest-api-description from `7291aeb` to `467f6a9`
2 parents 89e0dd0 + 4505848 commit 532759b

File tree

8 files changed

+1205
-2
lines changed

8 files changed

+1205
-2
lines changed

‎.spi.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ builder:
1414
- GitHubRestAPICodes_Of_Conduct
1515
- GitHubRestAPICodespaces
1616
- GitHubRestAPICopilot
17+
- GitHubRestAPICredentials
1718
- GitHubRestAPIDependabot
1819
- GitHubRestAPIDependency_Graph
1920
- GitHubRestAPIDesktop

‎Package.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ let package = Package(
2323
.library(name: "GitHubRestAPICodes_Of_Conduct", targets: ["GitHubRestAPICodes_Of_Conduct"]),
2424
.library(name: "GitHubRestAPICodespaces", targets: ["GitHubRestAPICodespaces"]),
2525
.library(name: "GitHubRestAPICopilot", targets: ["GitHubRestAPICopilot"]),
26+
.library(name: "GitHubRestAPICredentials", targets: ["GitHubRestAPICredentials"]),
2627
.library(name: "GitHubRestAPIDependabot", targets: ["GitHubRestAPIDependabot"]),
2728
.library(name: "GitHubRestAPIDependency_Graph", targets: ["GitHubRestAPIDependency_Graph"]),
2829
.library(name: "GitHubRestAPIDesktop", targets: ["GitHubRestAPIDesktop"]),
@@ -155,6 +156,14 @@ let package = Package(
155156
],
156157
path: "Sources/copilot"
157158
),
159+
.target(
160+
name: "GitHubRestAPICredentials",
161+
dependencies: [
162+
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
163+
.product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"),
164+
],
165+
path: "Sources/credentials"
166+
),
158167
.target(
159168
name: "GitHubRestAPIDependabot",
160169
dependencies: [

‎Sources/billing/Client.swift

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,4 +637,195 @@ public struct Client: APIProtocol {
637637
}
638638
)
639639
}
640+
/// Get billing usage report for a user
641+
///
642+
/// Gets a report of the total usage for a user.
643+
///
644+
/// **Note:** This endpoint is only available to users with access to the enhanced billing platform.
645+
///
646+
/// - Remark: HTTP `GET /users/{username}/settings/billing/usage`.
647+
/// - Remark: Generated from `#/paths//users/{username}/settings/billing/usage/get(billing/get-github-billing-usage-report-user)`.
648+
public func billingGetGithubBillingUsageReportUser(_ input: Operations.BillingGetGithubBillingUsageReportUser.Input) async throws -> Operations.BillingGetGithubBillingUsageReportUser.Output {
649+
try await client.send(
650+
input: input,
651+
forOperation: Operations.BillingGetGithubBillingUsageReportUser.id,
652+
serializer: { input in
653+
let path = try converter.renderedPath(
654+
template: "/users/{}/settings/billing/usage",
655+
parameters: [
656+
input.path.username
657+
]
658+
)
659+
var request: HTTPTypes.HTTPRequest = .init(
660+
soar_path: path,
661+
method: .get
662+
)
663+
suppressMutabilityWarning(&request)
664+
try converter.setQueryItemAsURI(
665+
in: &request,
666+
style: .form,
667+
explode: true,
668+
name: "year",
669+
value: input.query.year
670+
)
671+
try converter.setQueryItemAsURI(
672+
in: &request,
673+
style: .form,
674+
explode: true,
675+
name: "month",
676+
value: input.query.month
677+
)
678+
try converter.setQueryItemAsURI(
679+
in: &request,
680+
style: .form,
681+
explode: true,
682+
name: "day",
683+
value: input.query.day
684+
)
685+
try converter.setQueryItemAsURI(
686+
in: &request,
687+
style: .form,
688+
explode: true,
689+
name: "hour",
690+
value: input.query.hour
691+
)
692+
converter.setAcceptHeader(
693+
in: &request.headerFields,
694+
contentTypes: input.headers.accept
695+
)
696+
return (request, nil)
697+
},
698+
deserializer: { response, responseBody in
699+
switch response.status.code {
700+
case 200:
701+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
702+
let body: Components.Responses.BillingUsageReportUser.Body
703+
let chosenContentType = try converter.bestContentType(
704+
received: contentType,
705+
options: [
706+
"application/json"
707+
]
708+
)
709+
switch chosenContentType {
710+
case "application/json":
711+
body = try await converter.getResponseBodyAsJSON(
712+
Components.Schemas.BillingUsageReportUser.self,
713+
from: responseBody,
714+
transforming: { value in
715+
.json(value)
716+
}
717+
)
718+
default:
719+
preconditionFailure("bestContentType chose an invalid content type.")
720+
}
721+
return .ok(.init(body: body))
722+
case 400:
723+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
724+
let body: Components.Responses.BadRequest.Body
725+
let chosenContentType = try converter.bestContentType(
726+
received: contentType,
727+
options: [
728+
"application/json",
729+
"application/scim+json"
730+
]
731+
)
732+
switch chosenContentType {
733+
case "application/json":
734+
body = try await converter.getResponseBodyAsJSON(
735+
Components.Schemas.BasicError.self,
736+
from: responseBody,
737+
transforming: { value in
738+
.json(value)
739+
}
740+
)
741+
case "application/scim+json":
742+
body = try await converter.getResponseBodyAsJSON(
743+
Components.Schemas.ScimError.self,
744+
from: responseBody,
745+
transforming: { value in
746+
.applicationScimJson(value)
747+
}
748+
)
749+
default:
750+
preconditionFailure("bestContentType chose an invalid content type.")
751+
}
752+
return .badRequest(.init(body: body))
753+
case 403:
754+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
755+
let body: Components.Responses.Forbidden.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.BasicError.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 .forbidden(.init(body: body))
775+
case 500:
776+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
777+
let body: Components.Responses.InternalError.Body
778+
let chosenContentType = try converter.bestContentType(
779+
received: contentType,
780+
options: [
781+
"application/json"
782+
]
783+
)
784+
switch chosenContentType {
785+
case "application/json":
786+
body = try await converter.getResponseBodyAsJSON(
787+
Components.Schemas.BasicError.self,
788+
from: responseBody,
789+
transforming: { value in
790+
.json(value)
791+
}
792+
)
793+
default:
794+
preconditionFailure("bestContentType chose an invalid content type.")
795+
}
796+
return .internalServerError(.init(body: body))
797+
case 503:
798+
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
799+
let body: Components.Responses.ServiceUnavailable.Body
800+
let chosenContentType = try converter.bestContentType(
801+
received: contentType,
802+
options: [
803+
"application/json"
804+
]
805+
)
806+
switch chosenContentType {
807+
case "application/json":
808+
body = try await converter.getResponseBodyAsJSON(
809+
Components.Responses.ServiceUnavailable.Body.JsonPayload.self,
810+
from: responseBody,
811+
transforming: { value in
812+
.json(value)
813+
}
814+
)
815+
default:
816+
preconditionFailure("bestContentType chose an invalid content type.")
817+
}
818+
return .serviceUnavailable(.init(body: body))
819+
default:
820+
return .undocumented(
821+
statusCode: response.status.code,
822+
.init(
823+
headerFields: response.headerFields,
824+
body: responseBody
825+
)
826+
)
827+
}
828+
}
829+
)
830+
}
640831
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /