@@ -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