diff --git a/Sources/billing/Client.swift b/Sources/billing/Client.swift index 3ee2570c21..6aebf40234 100644 --- a/Sources/billing/Client.swift +++ b/Sources/billing/Client.swift @@ -38,6 +38,231 @@ public struct Client: APIProtocol { private var converter: Converter { client.converter } + /// Get billing premium request usage report for an organization + /// + /// Gets a report of premium request usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account. + /// + /// - Remark: HTTP `GET /organizations/{org}/settings/billing/premium_request/usage`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-org)`. + public func billingGetGithubBillingPremiumRequestUsageReportOrg(_ input: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input) async throws -> Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Output { + try await client.send( + input: input, + forOperation: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/organizations/{}/settings/billing/premium_request/usage", + parameters: [ + input.path.org + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "year", + value: input.query.year + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "month", + value: input.query.month + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "day", + value: input.query.day + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "user", + value: input.query.user + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "model", + value: input.query.model + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "product", + value: input.query.product + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.BillingPremiumRequestUsageReportOrg.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BillingPremiumRequestUsageReportOrg.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 400: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.BadRequest.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json", + "application/scim+json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + case "application/scim+json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ScimError.self, + from: responseBody, + transforming: { value in + .applicationScimJson(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .badRequest(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 500: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.InternalError.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .internalServerError(.init(body: body)) + case 503: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ServiceUnavailable.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Responses.ServiceUnavailable.Body.JsonPayload.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .serviceUnavailable(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } /// Get billing usage report for an organization /// /// 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. @@ -569,6 +794,224 @@ public struct Client: APIProtocol { } ) } + /// Get billing premium request usage report for a user + /// + /// Gets a report of premium request usage for a user. + /// + /// - Remark: HTTP `GET /users/{username}/settings/billing/premium_request/usage`. + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-user)`. + public func billingGetGithubBillingPremiumRequestUsageReportUser(_ input: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input) async throws -> Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Output { + try await client.send( + input: input, + forOperation: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/settings/billing/premium_request/usage", + parameters: [ + input.path.username + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "year", + value: input.query.year + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "month", + value: input.query.month + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "day", + value: input.query.day + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "model", + value: input.query.model + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "product", + value: input.query.product + ) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.BillingPremiumRequestUsageReportUser.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BillingPremiumRequestUsageReportUser.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 400: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.BadRequest.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json", + "application/scim+json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + case "application/scim+json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ScimError.self, + from: responseBody, + transforming: { value in + .applicationScimJson(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .badRequest(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 500: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.InternalError.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .internalServerError(.init(body: body)) + case 503: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ServiceUnavailable.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Responses.ServiceUnavailable.Body.JsonPayload.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .serviceUnavailable(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } /// Get shared storage billing for a user /// /// Gets the estimated paid and estimated total storage used for GitHub Actions and GitHub Packages. diff --git a/Sources/billing/Types.swift b/Sources/billing/Types.swift index 6ee6c143a9..3a2e0454e0 100644 --- a/Sources/billing/Types.swift +++ b/Sources/billing/Types.swift @@ -11,6 +11,13 @@ import struct Foundation.Date #endif /// A type that performs HTTP operations defined by the OpenAPI document. public protocol APIProtocol: Sendable { + /// Get billing premium request usage report for an organization + /// + /// Gets a report of premium request usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account. + /// + /// - Remark: HTTP `GET /organizations/{org}/settings/billing/premium_request/usage`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-org)`. + func billingGetGithubBillingPremiumRequestUsageReportOrg(_ input: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input) async throws -> Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Output /// Get billing usage report for an organization /// /// 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. @@ -75,6 +82,13 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `GET /users/{username}/settings/billing/packages`. /// - Remark: Generated from `#/paths//users/{username}/settings/billing/packages/get(billing/get-github-packages-billing-user)`. func billingGetGithubPackagesBillingUser(_ input: Operations.BillingGetGithubPackagesBillingUser.Input) async throws -> Operations.BillingGetGithubPackagesBillingUser.Output + /// Get billing premium request usage report for a user + /// + /// Gets a report of premium request usage for a user. + /// + /// - Remark: HTTP `GET /users/{username}/settings/billing/premium_request/usage`. + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-user)`. + func billingGetGithubBillingPremiumRequestUsageReportUser(_ input: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input) async throws -> Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Output /// Get shared storage billing for a user /// /// Gets the estimated paid and estimated total storage used for GitHub Actions and GitHub Packages. @@ -99,6 +113,23 @@ public protocol APIProtocol: Sendable { /// Convenience overloads for operation inputs. extension APIProtocol { + /// Get billing premium request usage report for an organization + /// + /// Gets a report of premium request usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account. + /// + /// - Remark: HTTP `GET /organizations/{org}/settings/billing/premium_request/usage`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-org)`. + public func billingGetGithubBillingPremiumRequestUsageReportOrg( + path: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input.Path, + query: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input.Query = .init(), + headers: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input.Headers = .init() + ) async throws -> Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Output { + try await billingGetGithubBillingPremiumRequestUsageReportOrg(Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input( + path: path, + query: query, + headers: headers + )) + } /// Get billing usage report for an organization /// /// 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. @@ -213,6 +244,23 @@ extension APIProtocol { headers: headers )) } + /// Get billing premium request usage report for a user + /// + /// Gets a report of premium request usage for a user. + /// + /// - Remark: HTTP `GET /users/{username}/settings/billing/premium_request/usage`. + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-user)`. + public func billingGetGithubBillingPremiumRequestUsageReportUser( + path: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input.Path, + query: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input.Query = .init(), + headers: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input.Headers = .init() + ) async throws -> Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Output { + try await billingGetGithubBillingPremiumRequestUsageReportUser(Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input( + path: path, + query: query, + headers: headers + )) + } /// Get shared storage billing for a user /// /// Gets the estimated paid and estimated total storage used for GitHub Actions and GitHub Packages. @@ -362,6 +410,197 @@ public enum Components { case schemas } } + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org`. + public struct BillingPremiumRequestUsageReportOrg: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/timePeriod`. + public struct TimePeriodPayload: Codable, Hashable, Sendable { + /// The year for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/timePeriod/year`. + public var year: Swift.Int + /// The month for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/timePeriod/month`. + public var month: Swift.Int? + /// The day for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/timePeriod/day`. + public var day: Swift.Int? + /// Creates a new `TimePeriodPayload`. + /// + /// - Parameters: + /// - year: The year for the usage report. + /// - month: The month for the usage report. + /// - day: The day for the usage report. + public init( + year: Swift.Int, + month: Swift.Int? = nil, + day: Swift.Int? = nil + ) { + self.year = year + self.month = month + self.day = day + } + public enum CodingKeys: String, CodingKey { + case year + case month + case day + } + } + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/timePeriod`. + public var timePeriod: Components.Schemas.BillingPremiumRequestUsageReportOrg.TimePeriodPayload + /// The unique identifier of the organization. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/organization`. + public var organization: Swift.String + /// The name of the user for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/user`. + public var user: Swift.String? + /// The product for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/product`. + public var product: Swift.String? + /// The model for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/model`. + public var model: Swift.String? + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload`. + public struct UsageItemsPayloadPayload: Codable, Hashable, Sendable { + /// Product name. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload/product`. + public var product: Swift.String + /// SKU name. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload/sku`. + public var sku: Swift.String + /// Model name. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload/model`. + public var model: Swift.String + /// Unit type of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload/unitType`. + public var unitType: Swift.String + /// Price per unit of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload/pricePerUnit`. + public var pricePerUnit: Swift.Double + /// Gross quantity of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload/grossQuantity`. + public var grossQuantity: Swift.Int + /// Gross amount of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload/grossAmount`. + public var grossAmount: Swift.Double + /// Discount quantity of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload/discountQuantity`. + public var discountQuantity: Swift.Int + /// Discount amount of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload/discountAmount`. + public var discountAmount: Swift.Double + /// Net quantity of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload/netQuantity`. + public var netQuantity: Swift.Int + /// Net amount of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/UsageItemsPayload/netAmount`. + public var netAmount: Swift.Double + /// Creates a new `UsageItemsPayloadPayload`. + /// + /// - Parameters: + /// - product: Product name. + /// - sku: SKU name. + /// - model: Model name. + /// - unitType: Unit type of the usage line item. + /// - pricePerUnit: Price per unit of the usage line item. + /// - grossQuantity: Gross quantity of the usage line item. + /// - grossAmount: Gross amount of the usage line item. + /// - discountQuantity: Discount quantity of the usage line item. + /// - discountAmount: Discount amount of the usage line item. + /// - netQuantity: Net quantity of the usage line item. + /// - netAmount: Net amount of the usage line item. + public init( + product: Swift.String, + sku: Swift.String, + model: Swift.String, + unitType: Swift.String, + pricePerUnit: Swift.Double, + grossQuantity: Swift.Int, + grossAmount: Swift.Double, + discountQuantity: Swift.Int, + discountAmount: Swift.Double, + netQuantity: Swift.Int, + netAmount: Swift.Double + ) { + self.product = product + self.sku = sku + self.model = model + self.unitType = unitType + self.pricePerUnit = pricePerUnit + self.grossQuantity = grossQuantity + self.grossAmount = grossAmount + self.discountQuantity = discountQuantity + self.discountAmount = discountAmount + self.netQuantity = netQuantity + self.netAmount = netAmount + } + public enum CodingKeys: String, CodingKey { + case product + case sku + case model + case unitType + case pricePerUnit + case grossQuantity + case grossAmount + case discountQuantity + case discountAmount + case netQuantity + case netAmount + } + } + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/usageItems`. + public typealias UsageItemsPayload = [Components.Schemas.BillingPremiumRequestUsageReportOrg.UsageItemsPayloadPayload] + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-org/usageItems`. + public var usageItems: Components.Schemas.BillingPremiumRequestUsageReportOrg.UsageItemsPayload + /// Creates a new `BillingPremiumRequestUsageReportOrg`. + /// + /// - Parameters: + /// - timePeriod: + /// - organization: The unique identifier of the organization. + /// - user: The name of the user for the usage report. + /// - product: The product for the usage report. + /// - model: The model for the usage report. + /// - usageItems: + public init( + timePeriod: Components.Schemas.BillingPremiumRequestUsageReportOrg.TimePeriodPayload, + organization: Swift.String, + user: Swift.String? = nil, + product: Swift.String? = nil, + model: Swift.String? = nil, + usageItems: Components.Schemas.BillingPremiumRequestUsageReportOrg.UsageItemsPayload + ) { + self.timePeriod = timePeriod + self.organization = organization + self.user = user + self.product = product + self.model = model + self.usageItems = usageItems + } + public enum CodingKeys: String, CodingKey { + case timePeriod + case organization + case user + case product + case model + case usageItems + } + } /// - Remark: Generated from `#/components/schemas/billing-usage-report`. public struct BillingUsageReport: Codable, Hashable, Sendable { /// - Remark: Generated from `#/components/schemas/billing-usage-report/UsageItemsPayload`. @@ -720,6 +959,189 @@ public enum Components { case estimatedStorageForMonth = "estimated_storage_for_month" } } + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user`. + public struct BillingPremiumRequestUsageReportUser: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/timePeriod`. + public struct TimePeriodPayload: Codable, Hashable, Sendable { + /// The year for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/timePeriod/year`. + public var year: Swift.Int + /// The month for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/timePeriod/month`. + public var month: Swift.Int? + /// The day for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/timePeriod/day`. + public var day: Swift.Int? + /// Creates a new `TimePeriodPayload`. + /// + /// - Parameters: + /// - year: The year for the usage report. + /// - month: The month for the usage report. + /// - day: The day for the usage report. + public init( + year: Swift.Int, + month: Swift.Int? = nil, + day: Swift.Int? = nil + ) { + self.year = year + self.month = month + self.day = day + } + public enum CodingKeys: String, CodingKey { + case year + case month + case day + } + } + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/timePeriod`. + public var timePeriod: Components.Schemas.BillingPremiumRequestUsageReportUser.TimePeriodPayload + /// The unique identifier of the user. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/user`. + public var user: Swift.String + /// The product for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/product`. + public var product: Swift.String? + /// The model for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/model`. + public var model: Swift.String? + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload`. + public struct UsageItemsPayloadPayload: Codable, Hashable, Sendable { + /// Product name. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/product`. + public var product: Swift.String + /// SKU name. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/sku`. + public var sku: Swift.String + /// Model name. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/model`. + public var model: Swift.String + /// Unit type of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/unitType`. + public var unitType: Swift.String + /// Price per unit of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/pricePerUnit`. + public var pricePerUnit: Swift.Double + /// Gross quantity of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/grossQuantity`. + public var grossQuantity: Swift.Int + /// Gross amount of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/grossAmount`. + public var grossAmount: Swift.Double + /// Discount quantity of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/discountQuantity`. + public var discountQuantity: Swift.Int + /// Discount amount of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/discountAmount`. + public var discountAmount: Swift.Double + /// Net quantity of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/netQuantity`. + public var netQuantity: Swift.Int + /// Net amount of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/netAmount`. + public var netAmount: Swift.Double + /// Creates a new `UsageItemsPayloadPayload`. + /// + /// - Parameters: + /// - product: Product name. + /// - sku: SKU name. + /// - model: Model name. + /// - unitType: Unit type of the usage line item. + /// - pricePerUnit: Price per unit of the usage line item. + /// - grossQuantity: Gross quantity of the usage line item. + /// - grossAmount: Gross amount of the usage line item. + /// - discountQuantity: Discount quantity of the usage line item. + /// - discountAmount: Discount amount of the usage line item. + /// - netQuantity: Net quantity of the usage line item. + /// - netAmount: Net amount of the usage line item. + public init( + product: Swift.String, + sku: Swift.String, + model: Swift.String, + unitType: Swift.String, + pricePerUnit: Swift.Double, + grossQuantity: Swift.Int, + grossAmount: Swift.Double, + discountQuantity: Swift.Int, + discountAmount: Swift.Double, + netQuantity: Swift.Int, + netAmount: Swift.Double + ) { + self.product = product + self.sku = sku + self.model = model + self.unitType = unitType + self.pricePerUnit = pricePerUnit + self.grossQuantity = grossQuantity + self.grossAmount = grossAmount + self.discountQuantity = discountQuantity + self.discountAmount = discountAmount + self.netQuantity = netQuantity + self.netAmount = netAmount + } + public enum CodingKeys: String, CodingKey { + case product + case sku + case model + case unitType + case pricePerUnit + case grossQuantity + case grossAmount + case discountQuantity + case discountAmount + case netQuantity + case netAmount + } + } + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/usageItems`. + public typealias UsageItemsPayload = [Components.Schemas.BillingPremiumRequestUsageReportUser.UsageItemsPayloadPayload] + /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/usageItems`. + public var usageItems: Components.Schemas.BillingPremiumRequestUsageReportUser.UsageItemsPayload + /// Creates a new `BillingPremiumRequestUsageReportUser`. + /// + /// - Parameters: + /// - timePeriod: + /// - user: The unique identifier of the user. + /// - product: The product for the usage report. + /// - model: The model for the usage report. + /// - usageItems: + public init( + timePeriod: Components.Schemas.BillingPremiumRequestUsageReportUser.TimePeriodPayload, + user: Swift.String, + product: Swift.String? = nil, + model: Swift.String? = nil, + usageItems: Components.Schemas.BillingPremiumRequestUsageReportUser.UsageItemsPayload + ) { + self.timePeriod = timePeriod + self.user = user + self.product = product + self.model = model + self.usageItems = usageItems + } + public enum CodingKeys: String, CodingKey { + case timePeriod + case user + case product + case model + case usageItems + } + } /// - Remark: Generated from `#/components/schemas/billing-usage-report-user`. public struct BillingUsageReportUser: Codable, Hashable, Sendable { /// - Remark: Generated from `#/components/schemas/billing-usage-report-user/UsageItemsPayload`. @@ -843,14 +1265,30 @@ public enum Components { /// /// - Remark: Generated from `#/components/parameters/billing-usage-report-year`. public typealias BillingUsageReportYear = Swift.Int - /// If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. If no year is specified the default `year` is used. + /// If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. Default value is the current month. If no year is specified the default `year` is used. /// - /// - Remark: Generated from `#/components/parameters/billing-usage-report-month`. - public typealias BillingUsageReportMonth = Swift.Int + /// - Remark: Generated from `#/components/parameters/billing-usage-report-month-default`. + public typealias BillingUsageReportMonthDefault = Swift.Int /// If specified, only return results for a single day. The value of `day` is an integer between `1` and `31`. If no `year` or `month` is specified, the default `year` and `month` are used. /// /// - Remark: Generated from `#/components/parameters/billing-usage-report-day`. public typealias BillingUsageReportDay = Swift.Int + /// The user name to query usage for. The name is not case sensitive. + /// + /// - Remark: Generated from `#/components/parameters/billing-usage-report-user`. + public typealias BillingUsageReportUser = Swift.String + /// The model name to query usage for. The name is not case sensitive. + /// + /// - Remark: Generated from `#/components/parameters/billing-usage-report-model`. + public typealias BillingUsageReportModel = Swift.String + /// The product name to query usage for. The name is not case sensitive. + /// + /// - Remark: Generated from `#/components/parameters/billing-usage-report-product`. + public typealias BillingUsageReportProduct = Swift.String + /// If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. If no year is specified the default `year` is used. + /// + /// - Remark: Generated from `#/components/parameters/billing-usage-report-month`. + public typealias BillingUsageReportMonth = Swift.Int /// If specified, only return results for a single hour. The value of `hour` is an integer between `0` and `23`. If no `year`, `month`, or `day` is specified, the default `year`, `month`, and `day` are used. /// /// - Remark: Generated from `#/components/parameters/billing-usage-report-hour`. @@ -860,6 +1298,34 @@ public enum Components { public enum RequestBodies {} /// Types generated from the `#/components/responses` section of the OpenAPI document. public enum Responses { + public struct NotFound: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/not_found/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/not_found/content/application\/json`. + case json(Components.Schemas.BasicError) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.BasicError { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Components.Responses.NotFound.Body + /// Creates a new `NotFound`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Components.Responses.NotFound.Body) { + self.body = body + } + } public struct BadRequest: Sendable, Hashable { /// - Remark: Generated from `#/components/responses/bad_request/content`. @frozen public enum Body: Sendable, Hashable { @@ -1025,6 +1491,34 @@ public enum Components { self.body = body } } + public struct BillingPremiumRequestUsageReportOrg: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/billing_premium_request_usage_report_org/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/billing_premium_request_usage_report_org/content/application\/json`. + case json(Components.Schemas.BillingPremiumRequestUsageReportOrg) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.BillingPremiumRequestUsageReportOrg { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Components.Responses.BillingPremiumRequestUsageReportOrg.Body + /// Creates a new `BillingPremiumRequestUsageReportOrg`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Components.Responses.BillingPremiumRequestUsageReportOrg.Body) { + self.body = body + } + } public struct BillingUsageReportOrg: Sendable, Hashable { /// - Remark: Generated from `#/components/responses/billing_usage_report_org/content`. @frozen public enum Body: Sendable, Hashable { @@ -1053,16 +1547,16 @@ public enum Components { self.body = body } } - public struct BillingUsageReportUser: Sendable, Hashable { - /// - Remark: Generated from `#/components/responses/billing_usage_report_user/content`. + public struct BillingPremiumRequestUsageReportUser: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/billing_premium_request_usage_report_user/content`. @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/components/responses/billing_usage_report_user/content/application\/json`. - case json(Components.Schemas.BillingUsageReportUser) + /// - Remark: Generated from `#/components/responses/billing_premium_request_usage_report_user/content/application\/json`. + case json(Components.Schemas.BillingPremiumRequestUsageReportUser) /// The associated value of the enum case if `self` is `.json`. /// /// - Throws: An error if `self` is not `.json`. /// - SeeAlso: `.json`. - public var json: Components.Schemas.BillingUsageReportUser { + public var json: Components.Schemas.BillingPremiumRequestUsageReportUser { get throws { switch self { case let .json(body): @@ -1072,22 +1566,330 @@ public enum Components { } } /// Received HTTP response body - public var body: Components.Responses.BillingUsageReportUser.Body - /// Creates a new `BillingUsageReportUser`. + public var body: Components.Responses.BillingPremiumRequestUsageReportUser.Body + /// Creates a new `BillingPremiumRequestUsageReportUser`. /// /// - Parameters: /// - body: Received HTTP response body - public init(body: Components.Responses.BillingUsageReportUser.Body) { + public init(body: Components.Responses.BillingPremiumRequestUsageReportUser.Body) { self.body = body } } - } + public struct BillingUsageReportUser: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/billing_usage_report_user/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/billing_usage_report_user/content/application\/json`. + case json(Components.Schemas.BillingUsageReportUser) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.BillingUsageReportUser { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Components.Responses.BillingUsageReportUser.Body + /// Creates a new `BillingUsageReportUser`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Components.Responses.BillingUsageReportUser.Body) { + self.body = body + } + } + } /// Types generated from the `#/components/headers` section of the OpenAPI document. public enum Headers {} } /// API operations, with input and output types, generated from `#/paths` in the OpenAPI document. public enum Operations { + /// Get billing premium request usage report for an organization + /// + /// Gets a report of premium request usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account. + /// + /// - Remark: HTTP `GET /organizations/{org}/settings/billing/premium_request/usage`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-org)`. + public enum BillingGetGithubBillingPremiumRequestUsageReportOrg { + public static let id: Swift.String = "billing/get-github-billing-premium-request-usage-report-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/premium_request/usage/GET/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/premium_request/usage/GET/path/org`. + public var org: Components.Parameters.Org + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + public init(org: Components.Parameters.Org) { + self.org = org + } + } + public var path: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input.Path + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/premium_request/usage/GET/query`. + public struct Query: Sendable, Hashable { + /// If specified, only return results for a single year. The value of `year` is an integer with four digits representing a year. For example, `2025`. Default value is the current year. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/premium_request/usage/GET/query/year`. + public var year: Components.Parameters.BillingUsageReportYear? + /// If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. Default value is the current month. If no year is specified the default `year` is used. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/premium_request/usage/GET/query/month`. + public var month: Components.Parameters.BillingUsageReportMonthDefault? + /// If specified, only return results for a single day. The value of `day` is an integer between `1` and `31`. If no `year` or `month` is specified, the default `year` and `month` are used. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/premium_request/usage/GET/query/day`. + public var day: Components.Parameters.BillingUsageReportDay? + /// The user name to query usage for. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/premium_request/usage/GET/query/user`. + public var user: Components.Parameters.BillingUsageReportUser? + /// The model name to query usage for. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/premium_request/usage/GET/query/model`. + public var model: Components.Parameters.BillingUsageReportModel? + /// The product name to query usage for. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/premium_request/usage/GET/query/product`. + public var product: Components.Parameters.BillingUsageReportProduct? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - year: If specified, only return results for a single year. The value of `year` is an integer with four digits representing a year. For example, `2025`. Default value is the current year. + /// - month: If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. Default value is the current month. If no year is specified the default `year` is used. + /// - day: If specified, only return results for a single day. The value of `day` is an integer between `1` and `31`. If no `year` or `month` is specified, the default `year` and `month` are used. + /// - user: The user name to query usage for. The name is not case sensitive. + /// - model: The model name to query usage for. The name is not case sensitive. + /// - product: The product name to query usage for. The name is not case sensitive. + public init( + year: Components.Parameters.BillingUsageReportYear? = nil, + month: Components.Parameters.BillingUsageReportMonthDefault? = nil, + day: Components.Parameters.BillingUsageReportDay? = nil, + user: Components.Parameters.BillingUsageReportUser? = nil, + model: Components.Parameters.BillingUsageReportModel? = nil, + product: Components.Parameters.BillingUsageReportProduct? = nil + ) { + self.year = year + self.month = month + self.day = day + self.user = user + self.model = model + self.product = product + } + } + public var query: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input.Query + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/premium_request/usage/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + public init( + path: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input.Path, + query: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input.Query = .init(), + headers: Operations.BillingGetGithubBillingPremiumRequestUsageReportOrg.Input.Headers = .init() + ) { + self.path = path + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + /// Response when getting a billing premium request usage report + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Components.Responses.BillingPremiumRequestUsageReportOrg) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Components.Responses.BillingPremiumRequestUsageReportOrg { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Bad Request + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-org)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Components.Responses.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + public var badRequest: Components.Responses.BadRequest { + get throws { + switch self { + case let .badRequest(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-org)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Internal Error + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-org)/responses/500`. + /// + /// HTTP response code: `500 internalServerError`. + case internalServerError(Components.Responses.InternalError) + /// The associated value of the enum case if `self` is `.internalServerError`. + /// + /// - Throws: An error if `self` is not `.internalServerError`. + /// - SeeAlso: `.internalServerError`. + public var internalServerError: Components.Responses.InternalError { + get throws { + switch self { + case let .internalServerError(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "internalServerError", + response: self + ) + } + } + } + /// Service unavailable + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-org)/responses/503`. + /// + /// HTTP response code: `503 serviceUnavailable`. + case serviceUnavailable(Components.Responses.ServiceUnavailable) + /// The associated value of the enum case if `self` is `.serviceUnavailable`. + /// + /// - Throws: An error if `self` is not `.serviceUnavailable`. + /// - SeeAlso: `.serviceUnavailable`. + public var serviceUnavailable: Components.Responses.ServiceUnavailable { + get throws { + switch self { + case let .serviceUnavailable(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "serviceUnavailable", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case applicationScimJson + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + case "application/scim+json": + self = .applicationScimJson + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + case .applicationScimJson: + return "application/scim+json" + } + } + public static var allCases: [Self] { + [ + .json, + .applicationScimJson + ] + } + } + } /// Get billing usage report for an organization /// /// 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. @@ -2013,6 +2815,279 @@ public enum Operations { } } } + /// Get billing premium request usage report for a user + /// + /// Gets a report of premium request usage for a user. + /// + /// - Remark: HTTP `GET /users/{username}/settings/billing/premium_request/usage`. + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-user)`. + public enum BillingGetGithubBillingPremiumRequestUsageReportUser { + public static let id: Swift.String = "billing/get-github-billing-premium-request-usage-report-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/premium_request/usage/GET/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/premium_request/usage/GET/path/username`. + public var username: Components.Parameters.Username + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + public init(username: Components.Parameters.Username) { + self.username = username + } + } + public var path: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/premium_request/usage/GET/query`. + public struct Query: Sendable, Hashable { + /// If specified, only return results for a single year. The value of `year` is an integer with four digits representing a year. For example, `2025`. Default value is the current year. + /// + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/premium_request/usage/GET/query/year`. + public var year: Components.Parameters.BillingUsageReportYear? + /// If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. Default value is the current month. If no year is specified the default `year` is used. + /// + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/premium_request/usage/GET/query/month`. + public var month: Components.Parameters.BillingUsageReportMonthDefault? + /// If specified, only return results for a single day. The value of `day` is an integer between `1` and `31`. If no `year` or `month` is specified, the default `year` and `month` are used. + /// + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/premium_request/usage/GET/query/day`. + public var day: Components.Parameters.BillingUsageReportDay? + /// The model name to query usage for. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/premium_request/usage/GET/query/model`. + public var model: Components.Parameters.BillingUsageReportModel? + /// The product name to query usage for. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/premium_request/usage/GET/query/product`. + public var product: Components.Parameters.BillingUsageReportProduct? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - year: If specified, only return results for a single year. The value of `year` is an integer with four digits representing a year. For example, `2025`. Default value is the current year. + /// - month: If specified, only return results for a single month. The value of `month` is an integer between `1` and `12`. Default value is the current month. If no year is specified the default `year` is used. + /// - day: If specified, only return results for a single day. The value of `day` is an integer between `1` and `31`. If no `year` or `month` is specified, the default `year` and `month` are used. + /// - model: The model name to query usage for. The name is not case sensitive. + /// - product: The product name to query usage for. The name is not case sensitive. + public init( + year: Components.Parameters.BillingUsageReportYear? = nil, + month: Components.Parameters.BillingUsageReportMonthDefault? = nil, + day: Components.Parameters.BillingUsageReportDay? = nil, + model: Components.Parameters.BillingUsageReportModel? = nil, + product: Components.Parameters.BillingUsageReportProduct? = nil + ) { + self.year = year + self.month = month + self.day = day + self.model = model + self.product = product + } + } + public var query: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input.Query + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/premium_request/usage/GET/header`. + public struct Headers: Sendable, Hashable { + public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - accept: + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + public init( + path: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input.Path, + query: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input.Query = .init(), + headers: Operations.BillingGetGithubBillingPremiumRequestUsageReportUser.Input.Headers = .init() + ) { + self.path = path + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + /// Response when getting a billing premium request usage report + /// + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-user)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Components.Responses.BillingPremiumRequestUsageReportUser) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Components.Responses.BillingPremiumRequestUsageReportUser { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Bad Request + /// + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-user)/responses/400`. + /// + /// HTTP response code: `400 badRequest`. + case badRequest(Components.Responses.BadRequest) + /// The associated value of the enum case if `self` is `.badRequest`. + /// + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + public var badRequest: Components.Responses.BadRequest { + get throws { + switch self { + case let .badRequest(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "badRequest", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Internal Error + /// + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-user)/responses/500`. + /// + /// HTTP response code: `500 internalServerError`. + case internalServerError(Components.Responses.InternalError) + /// The associated value of the enum case if `self` is `.internalServerError`. + /// + /// - Throws: An error if `self` is not `.internalServerError`. + /// - SeeAlso: `.internalServerError`. + public var internalServerError: Components.Responses.InternalError { + get throws { + switch self { + case let .internalServerError(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "internalServerError", + response: self + ) + } + } + } + /// Service unavailable + /// + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/premium_request/usage/get(billing/get-github-billing-premium-request-usage-report-user)/responses/503`. + /// + /// HTTP response code: `503 serviceUnavailable`. + case serviceUnavailable(Components.Responses.ServiceUnavailable) + /// The associated value of the enum case if `self` is `.serviceUnavailable`. + /// + /// - Throws: An error if `self` is not `.serviceUnavailable`. + /// - SeeAlso: `.serviceUnavailable`. + public var serviceUnavailable: Components.Responses.ServiceUnavailable { + get throws { + switch self { + case let .serviceUnavailable(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "serviceUnavailable", + response: self + ) + } + } + } + /// Undocumented response. + /// + /// A response with a code that is not documented in the OpenAPI document. + case undocumented(statusCode: Swift.Int, OpenAPIRuntime.UndocumentedPayload) + } + @frozen public enum AcceptableContentType: AcceptableProtocol { + case json + case applicationScimJson + case other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + case "application/scim+json": + self = .applicationScimJson + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + case .applicationScimJson: + return "application/scim+json" + } + } + public static var allCases: [Self] { + [ + .json, + .applicationScimJson + ] + } + } + } /// Get shared storage billing for a user /// /// Gets the estimated paid and estimated total storage used for GitHub Actions and GitHub Packages. diff --git a/Sources/code-scanning/Types.swift b/Sources/code-scanning/Types.swift index e6c4fcf698..6d940e2acb 100644 --- a/Sources/code-scanning/Types.swift +++ b/Sources/code-scanning/Types.swift @@ -2058,6 +2058,8 @@ public enum Components { public var repository: Components.Schemas.SimpleRepository /// - Remark: Generated from `#/components/schemas/code-scanning-organization-alert-items/dismissal_approved_by`. public var dismissalApprovedBy: Components.Schemas.NullableSimpleUser? + /// - Remark: Generated from `#/components/schemas/code-scanning-organization-alert-items/assignees`. + public var assignees: [Components.Schemas.SimpleUser]? /// Creates a new `CodeScanningOrganizationAlertItems`. /// /// - Parameters: @@ -2078,6 +2080,7 @@ public enum Components { /// - mostRecentInstance: /// - repository: /// - dismissalApprovedBy: + /// - assignees: public init( number: Components.Schemas.AlertNumber, createdAt: Components.Schemas.AlertCreatedAt, @@ -2095,7 +2098,8 @@ public enum Components { tool: Components.Schemas.CodeScanningAnalysisTool, mostRecentInstance: Components.Schemas.CodeScanningAlertInstance, repository: Components.Schemas.SimpleRepository, - dismissalApprovedBy: Components.Schemas.NullableSimpleUser? = nil + dismissalApprovedBy: Components.Schemas.NullableSimpleUser? = nil, + assignees: [Components.Schemas.SimpleUser]? = nil ) { self.number = number self.createdAt = createdAt @@ -2114,6 +2118,7 @@ public enum Components { self.mostRecentInstance = mostRecentInstance self.repository = repository self.dismissalApprovedBy = dismissalApprovedBy + self.assignees = assignees } public enum CodingKeys: String, CodingKey { case number @@ -2133,6 +2138,7 @@ public enum Components { case mostRecentInstance = "most_recent_instance" case repository case dismissalApprovedBy = "dismissal_approved_by" + case assignees } } /// - Remark: Generated from `#/components/schemas/code-scanning-alert-items`. @@ -2169,6 +2175,8 @@ public enum Components { public var mostRecentInstance: Components.Schemas.CodeScanningAlertInstance /// - Remark: Generated from `#/components/schemas/code-scanning-alert-items/dismissal_approved_by`. public var dismissalApprovedBy: Components.Schemas.NullableSimpleUser? + /// - Remark: Generated from `#/components/schemas/code-scanning-alert-items/assignees`. + public var assignees: [Components.Schemas.SimpleUser]? /// Creates a new `CodeScanningAlertItems`. /// /// - Parameters: @@ -2188,6 +2196,7 @@ public enum Components { /// - tool: /// - mostRecentInstance: /// - dismissalApprovedBy: + /// - assignees: public init( number: Components.Schemas.AlertNumber, createdAt: Components.Schemas.AlertCreatedAt, @@ -2204,7 +2213,8 @@ public enum Components { rule: Components.Schemas.CodeScanningAlertRuleSummary, tool: Components.Schemas.CodeScanningAnalysisTool, mostRecentInstance: Components.Schemas.CodeScanningAlertInstance, - dismissalApprovedBy: Components.Schemas.NullableSimpleUser? = nil + dismissalApprovedBy: Components.Schemas.NullableSimpleUser? = nil, + assignees: [Components.Schemas.SimpleUser]? = nil ) { self.number = number self.createdAt = createdAt @@ -2222,6 +2232,7 @@ public enum Components { self.tool = tool self.mostRecentInstance = mostRecentInstance self.dismissalApprovedBy = dismissalApprovedBy + self.assignees = assignees } public enum CodingKeys: String, CodingKey { case number @@ -2240,6 +2251,7 @@ public enum Components { case tool case mostRecentInstance = "most_recent_instance" case dismissalApprovedBy = "dismissal_approved_by" + case assignees } } /// - Remark: Generated from `#/components/schemas/code-scanning-alert-rule`. @@ -2377,6 +2389,8 @@ public enum Components { public var mostRecentInstance: Components.Schemas.CodeScanningAlertInstance /// - Remark: Generated from `#/components/schemas/code-scanning-alert/dismissal_approved_by`. public var dismissalApprovedBy: Components.Schemas.NullableSimpleUser? + /// - Remark: Generated from `#/components/schemas/code-scanning-alert/assignees`. + public var assignees: [Components.Schemas.SimpleUser]? /// Creates a new `CodeScanningAlert`. /// /// - Parameters: @@ -2396,6 +2410,7 @@ public enum Components { /// - tool: /// - mostRecentInstance: /// - dismissalApprovedBy: + /// - assignees: public init( number: Components.Schemas.AlertNumber, createdAt: Components.Schemas.AlertCreatedAt, @@ -2412,7 +2427,8 @@ public enum Components { rule: Components.Schemas.CodeScanningAlertRule, tool: Components.Schemas.CodeScanningAnalysisTool, mostRecentInstance: Components.Schemas.CodeScanningAlertInstance, - dismissalApprovedBy: Components.Schemas.NullableSimpleUser? = nil + dismissalApprovedBy: Components.Schemas.NullableSimpleUser? = nil, + assignees: [Components.Schemas.SimpleUser]? = nil ) { self.number = number self.createdAt = createdAt @@ -2430,6 +2446,7 @@ public enum Components { self.tool = tool self.mostRecentInstance = mostRecentInstance self.dismissalApprovedBy = dismissalApprovedBy + self.assignees = assignees } public enum CodingKeys: String, CodingKey { case number @@ -2448,6 +2465,7 @@ public enum Components { case tool case mostRecentInstance = "most_recent_instance" case dismissalApprovedBy = "dismissal_approved_by" + case assignees } } /// Sets the state of the code scanning alert. You must provide `dismissed_reason` when you set the state to `dismissed`. diff --git a/Sources/orgs/Types.swift b/Sources/orgs/Types.swift index 803448baef..48433def71 100644 --- a/Sources/orgs/Types.swift +++ b/Sources/orgs/Types.swift @@ -11955,25 +11955,31 @@ public enum Operations { public var repositoryId: Swift.Int? /// - Remark: Generated from `#/paths/orgs/{org}/attestations/{subject_digest}/GET/responses/200/content/json/AttestationsPayload/bundle_url`. public var bundleUrl: Swift.String? + /// - Remark: Generated from `#/paths/orgs/{org}/attestations/{subject_digest}/GET/responses/200/content/json/AttestationsPayload/initiator`. + public var initiator: Swift.String? /// Creates a new `AttestationsPayloadPayload`. /// /// - Parameters: /// - bundle: The attestation's Sigstore Bundle. /// - repositoryId: /// - bundleUrl: + /// - initiator: public init( bundle: Operations.OrgsListAttestations.Output.Ok.Body.JsonPayload.AttestationsPayloadPayload.BundlePayload? = nil, repositoryId: Swift.Int? = nil, - bundleUrl: Swift.String? = nil + bundleUrl: Swift.String? = nil, + initiator: Swift.String? = nil ) { self.bundle = bundle self.repositoryId = repositoryId self.bundleUrl = bundleUrl + self.initiator = initiator } public enum CodingKeys: String, CodingKey { case bundle case repositoryId = "repository_id" case bundleUrl = "bundle_url" + case initiator } } /// - Remark: Generated from `#/paths/orgs/{org}/attestations/{subject_digest}/GET/responses/200/content/json/attestations`. diff --git a/Sources/repos/Types.swift b/Sources/repos/Types.swift index acbf4cea00..8cc427b806 100644 --- a/Sources/repos/Types.swift +++ b/Sources/repos/Types.swift @@ -27966,25 +27966,31 @@ public enum Operations { public var repositoryId: Swift.Int? /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/attestations/{subject_digest}/GET/responses/200/content/json/AttestationsPayload/bundle_url`. public var bundleUrl: Swift.String? + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/attestations/{subject_digest}/GET/responses/200/content/json/AttestationsPayload/initiator`. + public var initiator: Swift.String? /// Creates a new `AttestationsPayloadPayload`. /// /// - Parameters: /// - bundle: The attestation's Sigstore Bundle. /// - repositoryId: /// - bundleUrl: + /// - initiator: public init( bundle: Operations.ReposListAttestations.Output.Ok.Body.JsonPayload.AttestationsPayloadPayload.BundlePayload? = nil, repositoryId: Swift.Int? = nil, - bundleUrl: Swift.String? = nil + bundleUrl: Swift.String? = nil, + initiator: Swift.String? = nil ) { self.bundle = bundle self.repositoryId = repositoryId self.bundleUrl = bundleUrl + self.initiator = initiator } public enum CodingKeys: String, CodingKey { case bundle case repositoryId = "repository_id" case bundleUrl = "bundle_url" + case initiator } } /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/attestations/{subject_digest}/GET/responses/200/content/json/attestations`. diff --git a/Sources/users/Types.swift b/Sources/users/Types.swift index 6d4706ad01..7bfad928dc 100644 --- a/Sources/users/Types.swift +++ b/Sources/users/Types.swift @@ -12601,25 +12601,31 @@ public enum Operations { public var repositoryId: Swift.Int? /// - Remark: Generated from `#/paths/users/{username}/attestations/{subject_digest}/GET/responses/200/content/json/AttestationsPayload/bundle_url`. public var bundleUrl: Swift.String? + /// - Remark: Generated from `#/paths/users/{username}/attestations/{subject_digest}/GET/responses/200/content/json/AttestationsPayload/initiator`. + public var initiator: Swift.String? /// Creates a new `AttestationsPayloadPayload`. /// /// - Parameters: /// - bundle: The attestation's Sigstore Bundle. /// - repositoryId: /// - bundleUrl: + /// - initiator: public init( bundle: Operations.UsersListAttestations.Output.Ok.Body.JsonPayload.AttestationsPayloadPayload.BundlePayload? = nil, repositoryId: Swift.Int? = nil, - bundleUrl: Swift.String? = nil + bundleUrl: Swift.String? = nil, + initiator: Swift.String? = nil ) { self.bundle = bundle self.repositoryId = repositoryId self.bundleUrl = bundleUrl + self.initiator = initiator } public enum CodingKeys: String, CodingKey { case bundle case repositoryId = "repository_id" case bundleUrl = "bundle_url" + case initiator } } /// - Remark: Generated from `#/paths/users/{username}/attestations/{subject_digest}/GET/responses/200/content/json/attestations`. diff --git a/Submodule/github/rest-api-description b/Submodule/github/rest-api-description index 44dd20c107..23ea15fe81 160000 --- a/Submodule/github/rest-api-description +++ b/Submodule/github/rest-api-description @@ -1 +1 @@ -Subproject commit 44dd20c107ca46d1dbcaf4aa522d9039e96e631c +Subproject commit 23ea15fe816288eb00bb9c764c5c137fd16f4115