From d04ad1fc2e0be23133137073fd782df9de0485af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 21:26:36 +0000 Subject: [PATCH 1/5] Bump Submodule/github/rest-api-description from `ad5a9d5` to `1d62675` Bumps [Submodule/github/rest-api-description](https://github.com/github/rest-api-description) from `ad5a9d5` to `1d62675`. - [Release notes](https://github.com/github/rest-api-description/releases) - [Commits](https://github.com/github/rest-api-description/compare/ad5a9d52bd14ba99c9844087287d5cb240b8f0ac...1d6267568cc63a85b07f84d1d0afa9b374fd782f) --- updated-dependencies: - dependency-name: Submodule/github/rest-api-description dependency-version: 1d6267568cc63a85b07f84d1d0afa9b374fd782f dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Submodule/github/rest-api-description | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Submodule/github/rest-api-description b/Submodule/github/rest-api-description index ad5a9d52bd..1d6267568c 160000 --- a/Submodule/github/rest-api-description +++ b/Submodule/github/rest-api-description @@ -1 +1 @@ -Subproject commit ad5a9d52bd14ba99c9844087287d5cb240b8f0ac +Subproject commit 1d6267568cc63a85b07f84d1d0afa9b374fd782f From fd7cc251180d532bfd9ec18b11614716ac73e7fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 21:32:49 +0000 Subject: [PATCH 2/5] Commit via running: make Sources/actions --- Sources/actions/Types.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sources/actions/Types.swift b/Sources/actions/Types.swift index 228134e5ea..38c91f049c 100644 --- a/Sources/actions/Types.swift +++ b/Sources/actions/Types.swift @@ -9549,6 +9549,10 @@ public enum Components { public var labels: [Components.Schemas.RunnerLabel] /// - Remark: Generated from `#/components/schemas/runner/ephemeral`. public var ephemeral: Swift.Bool? + /// The version of the GitHub Actions Runner software. This is only set if the runner has connected to the service at least once. + /// + /// - Remark: Generated from `#/components/schemas/runner/version`. + public var version: Swift.String? /// Creates a new `Runner`. /// /// - Parameters: @@ -9560,6 +9564,7 @@ public enum Components { /// - busy: /// - labels: /// - ephemeral: + /// - version: The version of the GitHub Actions Runner software. This is only set if the runner has connected to the service at least once. public init( id: Swift.Int, runnerGroupId: Swift.Int? = nil, @@ -9568,7 +9573,8 @@ public enum Components { status: Swift.String, busy: Swift.Bool, labels: [Components.Schemas.RunnerLabel], - ephemeral: Swift.Bool? = nil + ephemeral: Swift.Bool? = nil, + version: Swift.String? = nil ) { self.id = id self.runnerGroupId = runnerGroupId @@ -9578,6 +9584,7 @@ public enum Components { self.busy = busy self.labels = labels self.ephemeral = ephemeral + self.version = version } public enum CodingKeys: String, CodingKey { case id @@ -9588,6 +9595,7 @@ public enum Components { case busy case labels case ephemeral + case version } } /// Runner Application From 783b4be310bc36766bccfc9214e6b315918168a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 21:33:34 +0000 Subject: [PATCH 3/5] Commit via running: make Sources/apps --- Sources/apps/Client.swift | 3 +++ Sources/apps/Types.swift | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/Sources/apps/Client.swift b/Sources/apps/Client.swift index fdcdfef136..bc4d78acf3 100644 --- a/Sources/apps/Client.swift +++ b/Sources/apps/Client.swift @@ -1083,6 +1083,9 @@ public struct Client: APIProtocol { /// /// Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. /// + /// > [!NOTE] + /// > Starting April 27, 2026, GitHub began a staged rollout of a stateless format (`ghs_APPID_JWT`) to all newly minted GitHub App installation tokens, making them more performant and improving the reliability of our API surface. If your application expects or relies on installation tokens being exactly 40 characters long, it may not handle this new token format correctly. You can now validate your apps and workflows using a temporary request header that lets you enable the token format on demand. For more information about the temporary header, see [the GitHub blog](https://github.blog/changelog/2026-05-15-github-app-installation-tokens-per-request-override-header). + /// /// Optionally, you can use the `repositories` or `repository_ids` body parameters to specify individual repositories that the installation access token can access. If you don't use `repositories` or `repository_ids` to grant access to specific repositories, the installation access token will have access to all repositories that the installation was granted access to. The installation access token cannot be granted access to repositories that the installation was not granted access to. Up to 500 repositories can be listed in this manner. /// /// Optionally, use the `permissions` body parameter to specify the permissions that the installation access token should have. If `permissions` is not specified, the installation access token will have all of the permissions that were granted to the app. The installation access token cannot be granted permissions that the app was not granted. diff --git a/Sources/apps/Types.swift b/Sources/apps/Types.swift index a4c64f6b7b..d5c98d6293 100644 --- a/Sources/apps/Types.swift +++ b/Sources/apps/Types.swift @@ -110,6 +110,9 @@ public protocol APIProtocol: Sendable { /// /// Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. /// + /// > [!NOTE] + /// > Starting April 27, 2026, GitHub began a staged rollout of a stateless format (`ghs_APPID_JWT`) to all newly minted GitHub App installation tokens, making them more performant and improving the reliability of our API surface. If your application expects or relies on installation tokens being exactly 40 characters long, it may not handle this new token format correctly. You can now validate your apps and workflows using a temporary request header that lets you enable the token format on demand. For more information about the temporary header, see [the GitHub blog](https://github.blog/changelog/2026-05-15-github-app-installation-tokens-per-request-override-header). + /// /// Optionally, you can use the `repositories` or `repository_ids` body parameters to specify individual repositories that the installation access token can access. If you don't use `repositories` or `repository_ids` to grant access to specific repositories, the installation access token will have access to all repositories that the installation was granted access to. The installation access token cannot be granted access to repositories that the installation was not granted access to. Up to 500 repositories can be listed in this manner. /// /// Optionally, use the `permissions` body parameter to specify the permissions that the installation access token should have. If `permissions` is not specified, the installation access token will have all of the permissions that were granted to the app. The installation access token cannot be granted permissions that the app was not granted. @@ -515,6 +518,9 @@ extension APIProtocol { /// /// Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. /// + /// > [!NOTE] + /// > Starting April 27, 2026, GitHub began a staged rollout of a stateless format (`ghs_APPID_JWT`) to all newly minted GitHub App installation tokens, making them more performant and improving the reliability of our API surface. If your application expects or relies on installation tokens being exactly 40 characters long, it may not handle this new token format correctly. You can now validate your apps and workflows using a temporary request header that lets you enable the token format on demand. For more information about the temporary header, see [the GitHub blog](https://github.blog/changelog/2026-05-15-github-app-installation-tokens-per-request-override-header). + /// /// Optionally, you can use the `repositories` or `repository_ids` body parameters to specify individual repositories that the installation access token can access. If you don't use `repositories` or `repository_ids` to grant access to specific repositories, the installation access token will have access to all repositories that the installation was granted access to. The installation access token cannot be granted access to repositories that the installation was not granted access to. Up to 500 repositories can be listed in this manner. /// /// Optionally, use the `permissions` body parameter to specify the permissions that the installation access token should have. If `permissions` is not specified, the installation access token will have all of the permissions that were granted to the app. The installation access token cannot be granted permissions that the app was not granted. @@ -7123,6 +7129,9 @@ public enum Operations { /// /// Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. /// + /// > [!NOTE] + /// > Starting April 27, 2026, GitHub began a staged rollout of a stateless format (`ghs_APPID_JWT`) to all newly minted GitHub App installation tokens, making them more performant and improving the reliability of our API surface. If your application expects or relies on installation tokens being exactly 40 characters long, it may not handle this new token format correctly. You can now validate your apps and workflows using a temporary request header that lets you enable the token format on demand. For more information about the temporary header, see [the GitHub blog](https://github.blog/changelog/2026-05-15-github-app-installation-tokens-per-request-override-header). + /// /// Optionally, you can use the `repositories` or `repository_ids` body parameters to specify individual repositories that the installation access token can access. If you don't use `repositories` or `repository_ids` to grant access to specific repositories, the installation access token will have access to all repositories that the installation was granted access to. The installation access token cannot be granted access to repositories that the installation was not granted access to. Up to 500 repositories can be listed in this manner. /// /// Optionally, use the `permissions` body parameter to specify the permissions that the installation access token should have. If `permissions` is not specified, the installation access token will have all of the permissions that were granted to the app. The installation access token cannot be granted permissions that the app was not granted. From 688f08e0bb35f5ef8bf712ededacc2bdf46d8a3a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 21:33:56 +0000 Subject: [PATCH 4/5] Commit via running: make Sources/billing --- Sources/billing/Client.swift | 703 +++++++++- Sources/billing/Types.swift | 2525 +++++++++++++++++++++++++++++----- 2 files changed, 2856 insertions(+), 372 deletions(-) diff --git a/Sources/billing/Client.swift b/Sources/billing/Client.swift index c8f429c1ab..3d29dae96f 100644 --- a/Sources/billing/Client.swift +++ b/Sources/billing/Client.swift @@ -38,10 +38,234 @@ public struct Client: APIProtocol { private var converter: Converter { client.converter } - /// Get all budgets for an organization + /// Get billing AI credit usage report for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. + /// Gets a report of AI credit usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account. + /// + /// **Note:** Only data from the past 24 months is accessible via this endpoint. + /// + /// - Remark: HTTP `GET /organizations/{org}/settings/billing/ai_credit/usage`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/ai_credit/usage/get(billing/get-github-billing-ai-credit-usage-report-org)`. + public func billingGetGithubBillingAiCreditUsageReportOrg(_ input: Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Input) async throws -> Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Output { + try await client.send( + input: input, + forOperation: Operations.BillingGetGithubBillingAiCreditUsageReportOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/organizations/{}/settings/billing/ai_credit/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.BillingAiCreditUsageReportOrg.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BillingAiCreditUsageReportOrg.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 all budgets for an organization /// /// Gets all budgets for an organization. The authenticated user must be an organization admin or billing manager. /// Each page returns up to 10 budgets. @@ -85,6 +309,13 @@ public struct Client: APIProtocol { name: "scope", value: input.query.scope ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "user", + value: input.query.user + ) converter.setAcceptHeader( in: &request.headerFields, contentTypes: input.headers.accept @@ -95,7 +326,224 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Components.Responses.GetAllBudgets.Body + let body: Components.Responses.GetAllBudgets.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.GetAllBudgets.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.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 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 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)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Create a budget for an organization + /// + /// Creates a new budget for an organization. The authenticated user must be an + /// organization admin or billing manager. + /// + /// - Remark: HTTP `POST /organizations/{org}/settings/billing/budgets`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/post(billing/create-organization-budget)`. + public func billingCreateOrganizationBudget(_ input: Operations.BillingCreateOrganizationBudget.Input) async throws -> Operations.BillingCreateOrganizationBudget.Output { + try await client.send( + input: input, + forOperation: Operations.BillingCreateOrganizationBudget.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/organizations/{}/settings/billing/budgets", + parameters: [ + input.path.org + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .post + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case .none: + body = nil + case let .json(value): + body = try converter.setOptionalRequestBodyAsJSON( + value, + headerFields: &request.headerFields, + contentType: "application/json; charset=utf-8" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.BillingCreateOrganizationBudget.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.CreateBudget.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 401: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.RequiresAuthentication.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 .unauthorized(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.BillingCreateOrganizationBudget.Output.Forbidden.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -105,7 +553,7 @@ public struct Client: APIProtocol { switch chosenContentType { case "application/json": body = try await converter.getResponseBodyAsJSON( - Components.Schemas.GetAllBudgets.self, + Components.Schemas.BasicError.self, from: responseBody, transforming: { value in .json(value) @@ -114,10 +562,10 @@ public struct Client: APIProtocol { default: preconditionFailure("bestContentType chose an invalid content type.") } - return .ok(.init(body: body)) + return .forbidden(.init(body: body)) case 404: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Components.Responses.NotFound.Body + let body: Operations.BillingCreateOrganizationBudget.Output.NotFound.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -137,9 +585,9 @@ public struct Client: APIProtocol { preconditionFailure("bestContentType chose an invalid content type.") } return .notFound(.init(body: body)) - case 403: + case 422: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Components.Responses.Forbidden.Body + let body: Components.Responses.ValidationFailed.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -149,7 +597,7 @@ public struct Client: APIProtocol { switch chosenContentType { case "application/json": body = try await converter.getResponseBodyAsJSON( - Components.Schemas.BasicError.self, + Components.Schemas.ValidationError.self, from: responseBody, transforming: { value in .json(value) @@ -158,10 +606,10 @@ public struct Client: APIProtocol { default: preconditionFailure("bestContentType chose an invalid content type.") } - return .forbidden(.init(body: body)) + return .unprocessableContent(.init(body: body)) case 500: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Components.Responses.InternalError.Body + let body: Operations.BillingCreateOrganizationBudget.Output.InternalServerError.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -195,9 +643,6 @@ public struct Client: APIProtocol { } /// Get a budget by ID for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// /// Gets a budget by ID. The authenticated user must be an organization admin or billing manager. /// /// - Remark: HTTP `GET /organizations/{org}/settings/billing/budgets/{budget_id}`. @@ -382,9 +827,6 @@ public struct Client: APIProtocol { } /// Update a budget for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// /// Updates an existing budget for an organization. The authenticated user must be an organization admin or billing manager. /// /// - Remark: HTTP `PATCH /organizations/{org}/settings/billing/budgets/{budget_id}`. @@ -435,7 +877,7 @@ public struct Client: APIProtocol { switch chosenContentType { case "application/json": body = try await converter.getResponseBodyAsJSON( - Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload.self, + Components.Schemas.UpdateBudget.self, from: responseBody, transforming: { value in .json(value) @@ -600,9 +1042,6 @@ public struct Client: APIProtocol { } /// Delete a budget for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// /// Deletes a budget by ID for an organization. The authenticated user must be an organization admin or billing manager. /// /// - Remark: HTTP `DELETE /organizations/{org}/settings/billing/budgets/{budget_id}`. @@ -1404,6 +1843,226 @@ public struct Client: APIProtocol { } ) } + /// Get billing AI credit usage report for a user + /// + /// Gets a report of AI credit usage for a user. + /// + /// **Note:** Only data from the past 24 months is accessible via this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/settings/billing/ai_credit/usage`. + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/ai_credit/usage/get(billing/get-github-billing-ai-credit-usage-report-user)`. + public func billingGetGithubBillingAiCreditUsageReportUser(_ input: Operations.BillingGetGithubBillingAiCreditUsageReportUser.Input) async throws -> Operations.BillingGetGithubBillingAiCreditUsageReportUser.Output { + try await client.send( + input: input, + forOperation: Operations.BillingGetGithubBillingAiCreditUsageReportUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/settings/billing/ai_credit/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.BillingAiCreditUsageReportUser.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BillingAiCreditUsageReportUser.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 premium request usage report for a user /// /// Gets a report of premium request usage for a user. diff --git a/Sources/billing/Types.swift b/Sources/billing/Types.swift index 4050470290..eb84242c7b 100644 --- a/Sources/billing/Types.swift +++ b/Sources/billing/Types.swift @@ -11,10 +11,16 @@ import struct Foundation.Date #endif /// A type that performs HTTP operations defined by the OpenAPI document. public protocol APIProtocol: Sendable { - /// Get all budgets for an organization + /// Get billing AI credit usage report for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. + /// Gets a report of AI credit usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account. + /// + /// **Note:** Only data from the past 24 months is accessible via this endpoint. + /// + /// - Remark: HTTP `GET /organizations/{org}/settings/billing/ai_credit/usage`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/ai_credit/usage/get(billing/get-github-billing-ai-credit-usage-report-org)`. + func billingGetGithubBillingAiCreditUsageReportOrg(_ input: Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Input) async throws -> Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Output + /// Get all budgets for an organization /// /// Gets all budgets for an organization. The authenticated user must be an organization admin or billing manager. /// Each page returns up to 10 budgets. @@ -22,10 +28,15 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `GET /organizations/{org}/settings/billing/budgets`. /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/get(billing/get-all-budgets-org)`. func billingGetAllBudgetsOrg(_ input: Operations.BillingGetAllBudgetsOrg.Input) async throws -> Operations.BillingGetAllBudgetsOrg.Output - /// Get a budget by ID for an organization + /// Create a budget for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. + /// Creates a new budget for an organization. The authenticated user must be an + /// organization admin or billing manager. + /// + /// - Remark: HTTP `POST /organizations/{org}/settings/billing/budgets`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/post(billing/create-organization-budget)`. + func billingCreateOrganizationBudget(_ input: Operations.BillingCreateOrganizationBudget.Input) async throws -> Operations.BillingCreateOrganizationBudget.Output + /// Get a budget by ID for an organization /// /// Gets a budget by ID. The authenticated user must be an organization admin or billing manager. /// @@ -34,9 +45,6 @@ public protocol APIProtocol: Sendable { func billingGetBudgetOrg(_ input: Operations.BillingGetBudgetOrg.Input) async throws -> Operations.BillingGetBudgetOrg.Output /// Update a budget for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// /// Updates an existing budget for an organization. The authenticated user must be an organization admin or billing manager. /// /// - Remark: HTTP `PATCH /organizations/{org}/settings/billing/budgets/{budget_id}`. @@ -44,9 +52,6 @@ public protocol APIProtocol: Sendable { func billingUpdateBudgetOrg(_ input: Operations.BillingUpdateBudgetOrg.Input) async throws -> Operations.BillingUpdateBudgetOrg.Output /// Delete a budget for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// /// Deletes a budget by ID for an organization. The authenticated user must be an organization admin or billing manager. /// /// - Remark: HTTP `DELETE /organizations/{org}/settings/billing/budgets/{budget_id}`. @@ -82,6 +87,15 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `GET /organizations/{org}/settings/billing/usage/summary`. /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/usage/summary/get(billing/get-github-billing-usage-summary-report-org)`. func billingGetGithubBillingUsageSummaryReportOrg(_ input: Operations.BillingGetGithubBillingUsageSummaryReportOrg.Input) async throws -> Operations.BillingGetGithubBillingUsageSummaryReportOrg.Output + /// Get billing AI credit usage report for a user + /// + /// Gets a report of AI credit usage for a user. + /// + /// **Note:** Only data from the past 24 months is accessible via this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/settings/billing/ai_credit/usage`. + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/ai_credit/usage/get(billing/get-github-billing-ai-credit-usage-report-user)`. + func billingGetGithubBillingAiCreditUsageReportUser(_ input: Operations.BillingGetGithubBillingAiCreditUsageReportUser.Input) async throws -> Operations.BillingGetGithubBillingAiCreditUsageReportUser.Output /// Get billing premium request usage report for a user /// /// Gets a report of premium request usage for a user. @@ -116,10 +130,26 @@ public protocol APIProtocol: Sendable { /// Convenience overloads for operation inputs. extension APIProtocol { - /// Get all budgets for an organization + /// Get billing AI credit usage report for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. + /// Gets a report of AI credit usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account. + /// + /// **Note:** Only data from the past 24 months is accessible via this endpoint. + /// + /// - Remark: HTTP `GET /organizations/{org}/settings/billing/ai_credit/usage`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/ai_credit/usage/get(billing/get-github-billing-ai-credit-usage-report-org)`. + public func billingGetGithubBillingAiCreditUsageReportOrg( + path: Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Input.Path, + query: Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Input.Query = .init(), + headers: Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Input.Headers = .init() + ) async throws -> Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Output { + try await billingGetGithubBillingAiCreditUsageReportOrg(Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Input( + path: path, + query: query, + headers: headers + )) + } + /// Get all budgets for an organization /// /// Gets all budgets for an organization. The authenticated user must be an organization admin or billing manager. /// Each page returns up to 10 budgets. @@ -137,10 +167,25 @@ extension APIProtocol { headers: headers )) } - /// Get a budget by ID for an organization + /// Create a budget for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. + /// Creates a new budget for an organization. The authenticated user must be an + /// organization admin or billing manager. + /// + /// - Remark: HTTP `POST /organizations/{org}/settings/billing/budgets`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/post(billing/create-organization-budget)`. + public func billingCreateOrganizationBudget( + path: Operations.BillingCreateOrganizationBudget.Input.Path, + headers: Operations.BillingCreateOrganizationBudget.Input.Headers = .init(), + body: Operations.BillingCreateOrganizationBudget.Input.Body? = nil + ) async throws -> Operations.BillingCreateOrganizationBudget.Output { + try await billingCreateOrganizationBudget(Operations.BillingCreateOrganizationBudget.Input( + path: path, + headers: headers, + body: body + )) + } + /// Get a budget by ID for an organization /// /// Gets a budget by ID. The authenticated user must be an organization admin or billing manager. /// @@ -157,9 +202,6 @@ extension APIProtocol { } /// Update a budget for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// /// Updates an existing budget for an organization. The authenticated user must be an organization admin or billing manager. /// /// - Remark: HTTP `PATCH /organizations/{org}/settings/billing/budgets/{budget_id}`. @@ -177,9 +219,6 @@ extension APIProtocol { } /// Delete a budget for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// /// Deletes a budget by ID for an organization. The authenticated user must be an organization admin or billing manager. /// /// - Remark: HTTP `DELETE /organizations/{org}/settings/billing/budgets/{budget_id}`. @@ -253,6 +292,25 @@ extension APIProtocol { headers: headers )) } + /// Get billing AI credit usage report for a user + /// + /// Gets a report of AI credit usage for a user. + /// + /// **Note:** Only data from the past 24 months is accessible via this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/settings/billing/ai_credit/usage`. + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/ai_credit/usage/get(billing/get-github-billing-ai-credit-usage-report-user)`. + public func billingGetGithubBillingAiCreditUsageReportUser( + path: Operations.BillingGetGithubBillingAiCreditUsageReportUser.Input.Path, + query: Operations.BillingGetGithubBillingAiCreditUsageReportUser.Input.Query = .init(), + headers: Operations.BillingGetGithubBillingAiCreditUsageReportUser.Input.Headers = .init() + ) async throws -> Operations.BillingGetGithubBillingAiCreditUsageReportUser.Output { + try await billingGetGithubBillingAiCreditUsageReportUser(Operations.BillingGetGithubBillingAiCreditUsageReportUser.Input( + path: path, + query: query, + headers: headers + )) + } /// Get billing premium request usage report for a user /// /// Gets a report of premium request usage for a user. @@ -549,6 +607,197 @@ public enum Components { case errors } } + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org`. + public struct BillingAiCreditUsageReportOrg: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/timePeriod`. + public struct TimePeriodPayload: Codable, Hashable, Sendable { + /// The year for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/timePeriod/year`. + public var year: Swift.Int + /// The month for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/timePeriod/month`. + public var month: Swift.Int? + /// The day for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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-ai-credit-usage-report-org/timePeriod`. + public var timePeriod: Components.Schemas.BillingAiCreditUsageReportOrg.TimePeriodPayload + /// The unique identifier of the organization. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/organization`. + public var organization: Swift.String + /// The name of the user for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/user`. + public var user: Swift.String? + /// The product for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/product`. + public var product: Swift.String? + /// The model for the usage report. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/model`. + public var model: Swift.String? + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/UsageItemsPayload`. + public struct UsageItemsPayloadPayload: Codable, Hashable, Sendable { + /// Product name. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/UsageItemsPayload/product`. + public var product: Swift.String + /// SKU name. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/UsageItemsPayload/sku`. + public var sku: Swift.String + /// Model name. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/UsageItemsPayload/model`. + public var model: Swift.String + /// Unit type of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/UsageItemsPayload/unitType`. + public var unitType: Swift.String + /// Price per unit of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/UsageItemsPayload/pricePerUnit`. + public var pricePerUnit: Swift.Double + /// Gross quantity of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/UsageItemsPayload/grossQuantity`. + public var grossQuantity: Swift.Double + /// Gross amount of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/UsageItemsPayload/grossAmount`. + public var grossAmount: Swift.Double + /// Discount quantity of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/UsageItemsPayload/discountQuantity`. + public var discountQuantity: Swift.Double + /// Discount amount of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/UsageItemsPayload/discountAmount`. + public var discountAmount: Swift.Double + /// Net quantity of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/UsageItemsPayload/netQuantity`. + public var netQuantity: Swift.Double + /// Net amount of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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.Double, + grossAmount: Swift.Double, + discountQuantity: Swift.Double, + discountAmount: Swift.Double, + netQuantity: Swift.Double, + 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-ai-credit-usage-report-org/usageItems`. + public typealias UsageItemsPayload = [Components.Schemas.BillingAiCreditUsageReportOrg.UsageItemsPayloadPayload] + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-org/usageItems`. + public var usageItems: Components.Schemas.BillingAiCreditUsageReportOrg.UsageItemsPayload + /// Creates a new `BillingAiCreditUsageReportOrg`. + /// + /// - 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.BillingAiCreditUsageReportOrg.TimePeriodPayload, + organization: Swift.String, + user: Swift.String? = nil, + product: Swift.String? = nil, + model: Swift.String? = nil, + usageItems: Components.Schemas.BillingAiCreditUsageReportOrg.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/budget`. public struct Budget: Codable, Hashable, Sendable { /// The unique identifier for the budget @@ -612,14 +861,29 @@ public enum Components { /// /// - Remark: Generated from `#/components/schemas/budget/prevent_further_usage`. public var preventFurtherUsage: Swift.Bool - /// The scope of the budget (enterprise, organization, repository, cost center) + /// The scope of the budget + /// + /// - Remark: Generated from `#/components/schemas/budget/budget_scope`. + @frozen public enum BudgetScopePayload: String, Codable, Hashable, Sendable, CaseIterable { + case enterprise = "enterprise" + case organization = "organization" + case repository = "repository" + case costCenter = "cost_center" + case multiUserCustomer = "multi_user_customer" + case user = "user" + } + /// The scope of the budget /// /// - Remark: Generated from `#/components/schemas/budget/budget_scope`. - public var budgetScope: Swift.String + public var budgetScope: Components.Schemas.Budget.BudgetScopePayload /// The name of the entity for the budget (enterprise does not require a name). /// /// - Remark: Generated from `#/components/schemas/budget/budget_entity_name`. public var budgetEntityName: Swift.String? + /// The user login when the budget is scoped to a single user (`user` scope). + /// + /// - Remark: Generated from `#/components/schemas/budget/user`. + public var user: Swift.String? /// A single product or sku to apply the budget to. /// /// - Remark: Generated from `#/components/schemas/budget/budget_product_sku`. @@ -660,8 +924,9 @@ public enum Components { /// - budgetType: The type of pricing for the budget /// - budgetAmount: The budget amount limit in whole dollars. For license-based products, this represents the number of licenses. /// - preventFurtherUsage: The type of limit enforcement for the budget - /// - budgetScope: The scope of the budget (enterprise, organization, repository, cost center) + /// - budgetScope: The scope of the budget /// - budgetEntityName: The name of the entity for the budget (enterprise does not require a name). + /// - user: The user login when the budget is scoped to a single user (`user` scope). /// - budgetProductSku: A single product or sku to apply the budget to. /// - budgetAlerting: public init( @@ -669,8 +934,9 @@ public enum Components { budgetType: Components.Schemas.Budget.BudgetTypePayload, budgetAmount: Swift.Int, preventFurtherUsage: Swift.Bool, - budgetScope: Swift.String, + budgetScope: Components.Schemas.Budget.BudgetScopePayload, budgetEntityName: Swift.String? = nil, + user: Swift.String? = nil, budgetProductSku: Swift.String, budgetAlerting: Components.Schemas.Budget.BudgetAlertingPayload ) { @@ -680,6 +946,7 @@ public enum Components { self.preventFurtherUsage = preventFurtherUsage self.budgetScope = budgetScope self.budgetEntityName = budgetEntityName + self.user = user self.budgetProductSku = budgetProductSku self.budgetAlerting = budgetAlerting } @@ -690,6 +957,7 @@ public enum Components { case preventFurtherUsage = "prevent_further_usage" case budgetScope = "budget_scope" case budgetEntityName = "budget_entity_name" + case user case budgetProductSku = "budget_product_sku" case budgetAlerting = "budget_alerting" } @@ -700,6 +968,51 @@ public enum Components { /// /// - Remark: Generated from `#/components/schemas/get_all_budgets/budgets`. public var budgets: [Components.Schemas.Budget] + /// User login included when the response is scoped with the `user` query parameter. + /// + /// - Remark: Generated from `#/components/schemas/get_all_budgets/user`. + public var user: Swift.String? + /// Effective user-level budget details returned when the response is scoped with the `user` query parameter. + /// + /// - Remark: Generated from `#/components/schemas/get_all_budgets/effective_budget`. + public struct EffectiveBudgetPayload: Codable, Hashable, Sendable { + /// The unique identifier of the effective budget. + /// + /// - Remark: Generated from `#/components/schemas/get_all_budgets/effective_budget/id`. + public var id: Swift.String + /// The budget amount for the effective budget. + /// + /// - Remark: Generated from `#/components/schemas/get_all_budgets/effective_budget/budget_amount`. + public var budgetAmount: Swift.Int + /// The consumed amount for the specified user within the effective budget. + /// + /// - Remark: Generated from `#/components/schemas/get_all_budgets/effective_budget/consumed_amount`. + public var consumedAmount: Swift.Double + /// Creates a new `EffectiveBudgetPayload`. + /// + /// - Parameters: + /// - id: The unique identifier of the effective budget. + /// - budgetAmount: The budget amount for the effective budget. + /// - consumedAmount: The consumed amount for the specified user within the effective budget. + public init( + id: Swift.String, + budgetAmount: Swift.Int, + consumedAmount: Swift.Double + ) { + self.id = id + self.budgetAmount = budgetAmount + self.consumedAmount = consumedAmount + } + public enum CodingKeys: String, CodingKey { + case id + case budgetAmount = "budget_amount" + case consumedAmount = "consumed_amount" + } + } + /// Effective user-level budget details returned when the response is scoped with the `user` query parameter. + /// + /// - Remark: Generated from `#/components/schemas/get_all_budgets/effective_budget`. + public var effectiveBudget: Components.Schemas.GetAllBudgets.EffectiveBudgetPayload? /// Indicates if there are more pages of results available (maps to hasNextPage from billing platform) /// /// - Remark: Generated from `#/components/schemas/get_all_budgets/has_next_page`. @@ -712,30 +1025,219 @@ public enum Components { /// /// - Parameters: /// - budgets: Array of budget objects for the enterprise + /// - user: User login included when the response is scoped with the `user` query parameter. + /// - effectiveBudget: Effective user-level budget details returned when the response is scoped with the `user` query parameter. /// - hasNextPage: Indicates if there are more pages of results available (maps to hasNextPage from billing platform) /// - totalCount: Total number of budgets matching the query public init( budgets: [Components.Schemas.Budget], + user: Swift.String? = nil, + effectiveBudget: Components.Schemas.GetAllBudgets.EffectiveBudgetPayload? = nil, hasNextPage: Swift.Bool? = nil, totalCount: Swift.Int? = nil ) { self.budgets = budgets + self.user = user + self.effectiveBudget = effectiveBudget self.hasNextPage = hasNextPage self.totalCount = totalCount } public enum CodingKeys: String, CodingKey { case budgets + case user + case effectiveBudget = "effective_budget" case hasNextPage = "has_next_page" case totalCount = "total_count" } } - /// - Remark: Generated from `#/components/schemas/get-budget`. - public struct GetBudget: Codable, Hashable, Sendable { - /// ID of the budget. + /// - Remark: Generated from `#/components/schemas/create-budget`. + public struct CreateBudget: Codable, Hashable, Sendable { + /// A message indicating the result of the create operation /// - /// - Remark: Generated from `#/components/schemas/get-budget/id`. - public var id: Swift.String - /// The type of scope for the budget + /// - Remark: Generated from `#/components/schemas/create-budget/message`. + public var message: Swift.String + /// - Remark: Generated from `#/components/schemas/create-budget/budget`. + public struct BudgetPayload: Codable, Hashable, Sendable { + /// ID of the budget. + /// + /// - Remark: Generated from `#/components/schemas/create-budget/budget/id`. + public var id: Swift.String? + /// The type of scope for the budget + /// + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_scope`. + @frozen public enum BudgetScopePayload: String, Codable, Hashable, Sendable, CaseIterable { + case enterprise = "enterprise" + case organization = "organization" + case repository = "repository" + case costCenter = "cost_center" + case multiUserCustomer = "multi_user_customer" + case user = "user" + } + /// The type of scope for the budget + /// + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_scope`. + public var budgetScope: Components.Schemas.CreateBudget.BudgetPayload.BudgetScopePayload? + /// The name of the entity to apply the budget to + /// + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_entity_name`. + public var budgetEntityName: Swift.String? + /// The budget amount in whole dollars. For license-based products, this represents the number of licenses. + /// + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_amount`. + public var budgetAmount: Swift.Int? + /// Whether to prevent additional spending once the budget is exceeded + /// + /// - Remark: Generated from `#/components/schemas/create-budget/budget/prevent_further_usage`. + public var preventFurtherUsage: Swift.Bool? + /// A single product or sku to apply the budget to. + /// + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_product_sku`. + public var budgetProductSku: Swift.String? + /// The type of pricing for the budget + /// + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_type`. + @frozen public enum BudgetTypePayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_type/case1`. + @frozen public enum Case1Payload: String, Codable, Hashable, Sendable, CaseIterable { + case productPricing = "ProductPricing" + } + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_type/case1`. + case case1(Components.Schemas.CreateBudget.BudgetPayload.BudgetTypePayload.Case1Payload) + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_type/case2`. + @frozen public enum Case2Payload: String, Codable, Hashable, Sendable, CaseIterable { + case skuPricing = "SkuPricing" + } + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_type/case2`. + case case2(Components.Schemas.CreateBudget.BudgetPayload.BudgetTypePayload.Case2Payload) + public init(from decoder: any Swift.Decoder) throws { + var errors: [any Swift.Error] = [] + do { + self = .case1(try decoder.decodeFromSingleValueContainer()) + return + } catch { + errors.append(error) + } + do { + self = .case2(try decoder.decodeFromSingleValueContainer()) + return + } catch { + errors.append(error) + } + throw Swift.DecodingError.failedToDecodeOneOfSchema( + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + public func encode(to encoder: any Swift.Encoder) throws { + switch self { + case let .case1(value): + try encoder.encodeToSingleValueContainer(value) + case let .case2(value): + try encoder.encodeToSingleValueContainer(value) + } + } + } + /// The type of pricing for the budget + /// + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_type`. + public var budgetType: Components.Schemas.CreateBudget.BudgetPayload.BudgetTypePayload? + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_alerting`. + public struct BudgetAlertingPayload: Codable, Hashable, Sendable { + /// Whether alerts are enabled for this budget + /// + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_alerting/will_alert`. + public var willAlert: Swift.Bool? + /// Array of user login names who will receive alerts + /// + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_alerting/alert_recipients`. + public var alertRecipients: [Swift.String]? + /// Creates a new `BudgetAlertingPayload`. + /// + /// - Parameters: + /// - willAlert: Whether alerts are enabled for this budget + /// - alertRecipients: Array of user login names who will receive alerts + public init( + willAlert: Swift.Bool? = nil, + alertRecipients: [Swift.String]? = nil + ) { + self.willAlert = willAlert + self.alertRecipients = alertRecipients + } + public enum CodingKeys: String, CodingKey { + case willAlert = "will_alert" + case alertRecipients = "alert_recipients" + } + } + /// - Remark: Generated from `#/components/schemas/create-budget/budget/budget_alerting`. + public var budgetAlerting: Components.Schemas.CreateBudget.BudgetPayload.BudgetAlertingPayload? + /// Creates a new `BudgetPayload`. + /// + /// - Parameters: + /// - id: ID of the budget. + /// - budgetScope: The type of scope for the budget + /// - budgetEntityName: The name of the entity to apply the budget to + /// - budgetAmount: The budget amount in whole dollars. For license-based products, this represents the number of licenses. + /// - preventFurtherUsage: Whether to prevent additional spending once the budget is exceeded + /// - budgetProductSku: A single product or sku to apply the budget to. + /// - budgetType: The type of pricing for the budget + /// - budgetAlerting: + public init( + id: Swift.String? = nil, + budgetScope: Components.Schemas.CreateBudget.BudgetPayload.BudgetScopePayload? = nil, + budgetEntityName: Swift.String? = nil, + budgetAmount: Swift.Int? = nil, + preventFurtherUsage: Swift.Bool? = nil, + budgetProductSku: Swift.String? = nil, + budgetType: Components.Schemas.CreateBudget.BudgetPayload.BudgetTypePayload? = nil, + budgetAlerting: Components.Schemas.CreateBudget.BudgetPayload.BudgetAlertingPayload? = nil + ) { + self.id = id + self.budgetScope = budgetScope + self.budgetEntityName = budgetEntityName + self.budgetAmount = budgetAmount + self.preventFurtherUsage = preventFurtherUsage + self.budgetProductSku = budgetProductSku + self.budgetType = budgetType + self.budgetAlerting = budgetAlerting + } + public enum CodingKeys: String, CodingKey { + case id + case budgetScope = "budget_scope" + case budgetEntityName = "budget_entity_name" + case budgetAmount = "budget_amount" + case preventFurtherUsage = "prevent_further_usage" + case budgetProductSku = "budget_product_sku" + case budgetType = "budget_type" + case budgetAlerting = "budget_alerting" + } + } + /// - Remark: Generated from `#/components/schemas/create-budget/budget`. + public var budget: Components.Schemas.CreateBudget.BudgetPayload + /// Creates a new `CreateBudget`. + /// + /// - Parameters: + /// - message: A message indicating the result of the create operation + /// - budget: + public init( + message: Swift.String, + budget: Components.Schemas.CreateBudget.BudgetPayload + ) { + self.message = message + self.budget = budget + } + public enum CodingKeys: String, CodingKey { + case message + case budget + } + } + /// - Remark: Generated from `#/components/schemas/get-budget`. + public struct GetBudget: Codable, Hashable, Sendable { + /// ID of the budget. + /// + /// - Remark: Generated from `#/components/schemas/get-budget/id`. + public var id: Swift.String + /// The type of scope for the budget /// /// - Remark: Generated from `#/components/schemas/get-budget/budget_scope`. @frozen public enum BudgetScopePayload: String, Codable, Hashable, Sendable, CaseIterable { @@ -743,6 +1245,8 @@ public enum Components { case organization = "organization" case repository = "repository" case costCenter = "cost_center" + case multiUserCustomer = "multi_user_customer" + case user = "user" } /// The type of scope for the budget /// @@ -752,6 +1256,10 @@ public enum Components { /// /// - Remark: Generated from `#/components/schemas/get-budget/budget_entity_name`. public var budgetEntityName: Swift.String + /// The user login when the budget is scoped to a single user (`user` scope). + /// + /// - Remark: Generated from `#/components/schemas/get-budget/user`. + public var user: Swift.String? /// The budget amount in whole dollars. For license-based products, this represents the number of licenses. /// /// - Remark: Generated from `#/components/schemas/get-budget/budget_amount`. @@ -848,6 +1356,7 @@ public enum Components { /// - id: ID of the budget. /// - budgetScope: The type of scope for the budget /// - budgetEntityName: The name of the entity to apply the budget to + /// - user: The user login when the budget is scoped to a single user (`user` scope). /// - budgetAmount: The budget amount in whole dollars. For license-based products, this represents the number of licenses. /// - preventFurtherUsage: Whether to prevent additional spending once the budget is exceeded /// - budgetProductSku: A single product or sku to apply the budget to. @@ -857,6 +1366,7 @@ public enum Components { id: Swift.String, budgetScope: Components.Schemas.GetBudget.BudgetScopePayload, budgetEntityName: Swift.String, + user: Swift.String? = nil, budgetAmount: Swift.Int, preventFurtherUsage: Swift.Bool, budgetProductSku: Swift.String, @@ -866,6 +1376,7 @@ public enum Components { self.id = id self.budgetScope = budgetScope self.budgetEntityName = budgetEntityName + self.user = user self.budgetAmount = budgetAmount self.preventFurtherUsage = preventFurtherUsage self.budgetProductSku = budgetProductSku @@ -876,6 +1387,7 @@ public enum Components { case id case budgetScope = "budget_scope" case budgetEntityName = "budget_entity_name" + case user case budgetAmount = "budget_amount" case preventFurtherUsage = "prevent_further_usage" case budgetProductSku = "budget_product_sku" @@ -883,6 +1395,185 @@ public enum Components { case budgetAlerting = "budget_alerting" } } + /// - Remark: Generated from `#/components/schemas/update-budget`. + public struct UpdateBudget: Codable, Hashable, Sendable { + /// A message indicating the result of the update operation + /// + /// - Remark: Generated from `#/components/schemas/update-budget/message`. + public var message: Swift.String + /// - Remark: Generated from `#/components/schemas/update-budget/budget`. + public struct BudgetPayload: Codable, Hashable, Sendable { + /// ID of the budget. + /// + /// - Remark: Generated from `#/components/schemas/update-budget/budget/id`. + public var id: Swift.String? + /// The type of scope for the budget + /// + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_scope`. + @frozen public enum BudgetScopePayload: String, Codable, Hashable, Sendable, CaseIterable { + case enterprise = "enterprise" + case organization = "organization" + case repository = "repository" + case costCenter = "cost_center" + } + /// The type of scope for the budget + /// + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_scope`. + public var budgetScope: Components.Schemas.UpdateBudget.BudgetPayload.BudgetScopePayload? + /// The name of the entity to apply the budget to + /// + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_entity_name`. + public var budgetEntityName: Swift.String? + /// The budget amount in whole dollars. For license-based products, this represents the number of licenses. + /// + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_amount`. + public var budgetAmount: Swift.Int? + /// Whether to prevent additional spending once the budget is exceeded + /// + /// - Remark: Generated from `#/components/schemas/update-budget/budget/prevent_further_usage`. + public var preventFurtherUsage: Swift.Bool? + /// A single product or sku to apply the budget to. + /// + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_product_sku`. + public var budgetProductSku: Swift.String? + /// The type of pricing for the budget + /// + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_type`. + @frozen public enum BudgetTypePayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_type/case1`. + @frozen public enum Case1Payload: String, Codable, Hashable, Sendable, CaseIterable { + case productPricing = "ProductPricing" + } + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_type/case1`. + case case1(Components.Schemas.UpdateBudget.BudgetPayload.BudgetTypePayload.Case1Payload) + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_type/case2`. + @frozen public enum Case2Payload: String, Codable, Hashable, Sendable, CaseIterable { + case skuPricing = "SkuPricing" + } + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_type/case2`. + case case2(Components.Schemas.UpdateBudget.BudgetPayload.BudgetTypePayload.Case2Payload) + public init(from decoder: any Swift.Decoder) throws { + var errors: [any Swift.Error] = [] + do { + self = .case1(try decoder.decodeFromSingleValueContainer()) + return + } catch { + errors.append(error) + } + do { + self = .case2(try decoder.decodeFromSingleValueContainer()) + return + } catch { + errors.append(error) + } + throw Swift.DecodingError.failedToDecodeOneOfSchema( + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + public func encode(to encoder: any Swift.Encoder) throws { + switch self { + case let .case1(value): + try encoder.encodeToSingleValueContainer(value) + case let .case2(value): + try encoder.encodeToSingleValueContainer(value) + } + } + } + /// The type of pricing for the budget + /// + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_type`. + public var budgetType: Components.Schemas.UpdateBudget.BudgetPayload.BudgetTypePayload? + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_alerting`. + public struct BudgetAlertingPayload: Codable, Hashable, Sendable { + /// Whether alerts are enabled for this budget + /// + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_alerting/will_alert`. + public var willAlert: Swift.Bool? + /// Array of user login names who will receive alerts + /// + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_alerting/alert_recipients`. + public var alertRecipients: [Swift.String]? + /// Creates a new `BudgetAlertingPayload`. + /// + /// - Parameters: + /// - willAlert: Whether alerts are enabled for this budget + /// - alertRecipients: Array of user login names who will receive alerts + public init( + willAlert: Swift.Bool? = nil, + alertRecipients: [Swift.String]? = nil + ) { + self.willAlert = willAlert + self.alertRecipients = alertRecipients + } + public enum CodingKeys: String, CodingKey { + case willAlert = "will_alert" + case alertRecipients = "alert_recipients" + } + } + /// - Remark: Generated from `#/components/schemas/update-budget/budget/budget_alerting`. + public var budgetAlerting: Components.Schemas.UpdateBudget.BudgetPayload.BudgetAlertingPayload? + /// Creates a new `BudgetPayload`. + /// + /// - Parameters: + /// - id: ID of the budget. + /// - budgetScope: The type of scope for the budget + /// - budgetEntityName: The name of the entity to apply the budget to + /// - budgetAmount: The budget amount in whole dollars. For license-based products, this represents the number of licenses. + /// - preventFurtherUsage: Whether to prevent additional spending once the budget is exceeded + /// - budgetProductSku: A single product or sku to apply the budget to. + /// - budgetType: The type of pricing for the budget + /// - budgetAlerting: + public init( + id: Swift.String? = nil, + budgetScope: Components.Schemas.UpdateBudget.BudgetPayload.BudgetScopePayload? = nil, + budgetEntityName: Swift.String? = nil, + budgetAmount: Swift.Int? = nil, + preventFurtherUsage: Swift.Bool? = nil, + budgetProductSku: Swift.String? = nil, + budgetType: Components.Schemas.UpdateBudget.BudgetPayload.BudgetTypePayload? = nil, + budgetAlerting: Components.Schemas.UpdateBudget.BudgetPayload.BudgetAlertingPayload? = nil + ) { + self.id = id + self.budgetScope = budgetScope + self.budgetEntityName = budgetEntityName + self.budgetAmount = budgetAmount + self.preventFurtherUsage = preventFurtherUsage + self.budgetProductSku = budgetProductSku + self.budgetType = budgetType + self.budgetAlerting = budgetAlerting + } + public enum CodingKeys: String, CodingKey { + case id + case budgetScope = "budget_scope" + case budgetEntityName = "budget_entity_name" + case budgetAmount = "budget_amount" + case preventFurtherUsage = "prevent_further_usage" + case budgetProductSku = "budget_product_sku" + case budgetType = "budget_type" + case budgetAlerting = "budget_alerting" + } + } + /// - Remark: Generated from `#/components/schemas/update-budget/budget`. + public var budget: Components.Schemas.UpdateBudget.BudgetPayload + /// Creates a new `UpdateBudget`. + /// + /// - Parameters: + /// - message: A message indicating the result of the update operation + /// - budget: + public init( + message: Swift.String, + budget: Components.Schemas.UpdateBudget.BudgetPayload + ) { + self.message = message + self.budget = budget + } + public enum CodingKeys: String, CodingKey { + case message + case budget + } + } /// - Remark: Generated from `#/components/schemas/delete-budget`. public struct DeleteBudget: Codable, Hashable, Sendable { /// A message indicating the result of the deletion operation @@ -1400,21 +2091,21 @@ public enum Components { case usageItems } } - /// - 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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-user`. + public struct BillingAiCreditUsageReportUser: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-user/timePeriod/day`. public var day: Swift.Int? /// Creates a new `TimePeriodPayload`. /// @@ -1437,65 +2128,65 @@ public enum Components { case day } } - /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/timePeriod`. - public var timePeriod: Components.Schemas.BillingPremiumRequestUsageReportUser.TimePeriodPayload + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-user/timePeriod`. + public var timePeriod: Components.Schemas.BillingAiCreditUsageReportUser.TimePeriodPayload /// The unique identifier of the user. /// - /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/user`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-user/model`. public var model: Swift.String? - /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-user/UsageItemsPayload/grossQuantity`. public var grossQuantity: Swift.Double /// Gross amount of the usage line item. /// - /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/grossAmount`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-user/UsageItemsPayload/discountQuantity`. public var discountQuantity: Swift.Double /// Discount amount of the usage line item. /// - /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/discountAmount`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-user/UsageItemsPayload/netQuantity`. public var netQuantity: Swift.Double /// Net amount of the usage line item. /// - /// - Remark: Generated from `#/components/schemas/billing-premium-request-usage-report-user/UsageItemsPayload/netAmount`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-user/UsageItemsPayload/netAmount`. public var netAmount: Swift.Double /// Creates a new `UsageItemsPayloadPayload`. /// @@ -1550,11 +2241,11 @@ public enum Components { 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`. + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-user/usageItems`. + public typealias UsageItemsPayload = [Components.Schemas.BillingAiCreditUsageReportUser.UsageItemsPayloadPayload] + /// - Remark: Generated from `#/components/schemas/billing-ai-credit-usage-report-user/usageItems`. + public var usageItems: Components.Schemas.BillingAiCreditUsageReportUser.UsageItemsPayload + /// Creates a new `BillingAiCreditUsageReportUser`. /// /// - Parameters: /// - timePeriod: @@ -1563,11 +2254,11 @@ public enum Components { /// - model: The model for the usage report. /// - usageItems: public init( - timePeriod: Components.Schemas.BillingPremiumRequestUsageReportUser.TimePeriodPayload, + timePeriod: Components.Schemas.BillingAiCreditUsageReportUser.TimePeriodPayload, user: Swift.String, product: Swift.String? = nil, model: Swift.String? = nil, - usageItems: Components.Schemas.BillingPremiumRequestUsageReportUser.UsageItemsPayload + usageItems: Components.Schemas.BillingAiCreditUsageReportUser.UsageItemsPayload ) { self.timePeriod = timePeriod self.user = user @@ -1583,21 +2274,204 @@ public enum Components { 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`. - public struct UsageItemsPayloadPayload: Codable, Hashable, Sendable { - /// Date of the usage line item. + /// - 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-usage-report-user/UsageItemsPayload/date`. - public var date: Swift.String + /// - 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-usage-report-user/UsageItemsPayload/product`. + /// - 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-usage-report-user/UsageItemsPayload/sku`. + /// - 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.Double + /// 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.Double + /// 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.Double + /// 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.Double, + grossAmount: Swift.Double, + discountQuantity: Swift.Double, + discountAmount: Swift.Double, + netQuantity: Swift.Double, + 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`. + public struct UsageItemsPayloadPayload: Codable, Hashable, Sendable { + /// Date of the usage line item. + /// + /// - Remark: Generated from `#/components/schemas/billing-usage-report-user/UsageItemsPayload/date`. + public var date: Swift.String + /// Product name. + /// + /// - Remark: Generated from `#/components/schemas/billing-usage-report-user/UsageItemsPayload/product`. + public var product: Swift.String + /// SKU name. + /// + /// - Remark: Generated from `#/components/schemas/billing-usage-report-user/UsageItemsPayload/sku`. public var sku: Swift.String /// Quantity of the usage line item. /// @@ -1885,10 +2759,6 @@ public enum Components { /// /// - Remark: Generated from `#/components/parameters/org`. public typealias Org = Swift.String - /// The ID corresponding to the budget. - /// - /// - Remark: Generated from `#/components/parameters/budget`. - public typealias Budget = Swift.String /// 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 `#/components/parameters/billing-usage-report-year`. @@ -1913,6 +2783,10 @@ public enum Components { /// /// - Remark: Generated from `#/components/parameters/billing-usage-report-product`. public typealias BillingUsageReportProduct = Swift.String + /// The ID corresponding to the budget. + /// + /// - Remark: Generated from `#/components/parameters/budget`. + public typealias Budget = 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`. @@ -2179,6 +3053,34 @@ public enum Components { self.body = body } } + public struct BillingAiCreditUsageReportOrg: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/billing_ai_credit_usage_report_org/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/billing_ai_credit_usage_report_org/content/application\/json`. + case json(Components.Schemas.BillingAiCreditUsageReportOrg) + /// 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.BillingAiCreditUsageReportOrg { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Components.Responses.BillingAiCreditUsageReportOrg.Body + /// Creates a new `BillingAiCreditUsageReportOrg`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Components.Responses.BillingAiCreditUsageReportOrg.Body) { + self.body = body + } + } public struct GetAllBudgets: Sendable, Hashable { /// - Remark: Generated from `#/components/responses/get_all_budgets/content`. @frozen public enum Body: Sendable, Hashable { @@ -2347,6 +3249,34 @@ public enum Components { self.body = body } } + public struct BillingAiCreditUsageReportUser: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/billing_ai_credit_usage_report_user/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/billing_ai_credit_usage_report_user/content/application\/json`. + case json(Components.Schemas.BillingAiCreditUsageReportUser) + /// 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.BillingAiCreditUsageReportUser { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Components.Responses.BillingAiCreditUsageReportUser.Body + /// Creates a new `BillingAiCreditUsageReportUser`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Components.Responses.BillingAiCreditUsageReportUser.Body) { + self.body = body + } + } public struct BillingPremiumRequestUsageReportUser: Sendable, Hashable { /// - Remark: Generated from `#/components/responses/billing_premium_request_usage_report_user/content`. @frozen public enum Body: Sendable, Hashable { @@ -2438,24 +3368,22 @@ public enum Components { /// API operations, with input and output types, generated from `#/paths` in the OpenAPI document. public enum Operations { - /// Get all budgets for an organization + /// Get billing AI credit usage report for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. + /// Gets a report of AI credit usage for an organization. To use this endpoint, you must be an administrator of an organization within an enterprise or an organization account. /// - /// Gets all budgets for an organization. The authenticated user must be an organization admin or billing manager. - /// Each page returns up to 10 budgets. + /// **Note:** Only data from the past 24 months is accessible via this endpoint. /// - /// - Remark: HTTP `GET /organizations/{org}/settings/billing/budgets`. - /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/get(billing/get-all-budgets-org)`. - public enum BillingGetAllBudgetsOrg { - public static let id: Swift.String = "billing/get-all-budgets-org" + /// - Remark: HTTP `GET /organizations/{org}/settings/billing/ai_credit/usage`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/ai_credit/usage/get(billing/get-github-billing-ai-credit-usage-report-org)`. + public enum BillingGetGithubBillingAiCreditUsageReportOrg { + public static let id: Swift.String = "billing/get-github-billing-ai-credit-usage-report-org" public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/path`. + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/ai_credit/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/budgets/GET/path/org`. + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/ai_credit/usage/GET/path/org`. public var org: Components.Parameters.Org /// Creates a new `Path`. /// @@ -2465,85 +3393,732 @@ public enum Operations { self.org = org } } - public var path: Operations.BillingGetAllBudgetsOrg.Input.Path - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/query`. + public var path: Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Input.Path + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/ai_credit/usage/GET/query`. public struct Query: Sendable, Hashable { - /// The page number of the results to fetch. + /// 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/budgets/GET/query/page`. - public var page: Swift.Int? - /// The number of results per page (max 10). + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/ai_credit/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/budgets/GET/query/per_page`. - public var perPage: Swift.Int? - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/query/scope`. - @frozen public enum ScopePayload: String, Codable, Hashable, Sendable, CaseIterable { - case enterprise = "enterprise" - case organization = "organization" - case repository = "repository" - case costCenter = "cost_center" - } - /// Filter budgets by scope type. + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/ai_credit/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/budgets/GET/query/scope`. - public var scope: Operations.BillingGetAllBudgetsOrg.Input.Query.ScopePayload? + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/ai_credit/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/ai_credit/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/ai_credit/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/ai_credit/usage/GET/query/product`. + public var product: Components.Parameters.BillingUsageReportProduct? /// Creates a new `Query`. /// /// - Parameters: - /// - page: The page number of the results to fetch. - /// - perPage: The number of results per page (max 10). - /// - scope: Filter budgets by scope type. + /// - 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( - page: Swift.Int? = nil, - perPage: Swift.Int? = nil, - scope: Operations.BillingGetAllBudgetsOrg.Input.Query.ScopePayload? = nil + 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.page = page - self.perPage = perPage - self.scope = scope - } - } - public var query: Operations.BillingGetAllBudgetsOrg.Input.Query - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/header`. - public struct Headers: Sendable, Hashable { + self.year = year + self.month = month + self.day = day + self.user = user + self.model = model + self.product = product + } + } + public var query: Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Input.Query + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/ai_credit/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.BillingGetGithubBillingAiCreditUsageReportOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + public init( + path: Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Input.Path, + query: Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Input.Query = .init(), + headers: Operations.BillingGetGithubBillingAiCreditUsageReportOrg.Input.Headers = .init() + ) { + self.path = path + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + /// Response when getting a billing AI credit usage report + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/ai_credit/usage/get(billing/get-github-billing-ai-credit-usage-report-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Components.Responses.BillingAiCreditUsageReportOrg) + /// 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.BillingAiCreditUsageReportOrg { + 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/ai_credit/usage/get(billing/get-github-billing-ai-credit-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/ai_credit/usage/get(billing/get-github-billing-ai-credit-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/ai_credit/usage/get(billing/get-github-billing-ai-credit-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/ai_credit/usage/get(billing/get-github-billing-ai-credit-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/ai_credit/usage/get(billing/get-github-billing-ai-credit-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 all budgets for an organization + /// + /// Gets all budgets for an organization. The authenticated user must be an organization admin or billing manager. + /// Each page returns up to 10 budgets. + /// + /// - Remark: HTTP `GET /organizations/{org}/settings/billing/budgets`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/get(billing/get-all-budgets-org)`. + public enum BillingGetAllBudgetsOrg { + public static let id: Swift.String = "billing/get-all-budgets-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/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.BillingGetAllBudgetsOrg.Input.Path + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/query`. + public struct Query: Sendable, Hashable { + /// The page number of the results to fetch. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/query/page`. + public var page: Swift.Int? + /// The number of results per page (max 10). + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/query/per_page`. + public var perPage: Swift.Int? + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/query/scope`. + @frozen public enum ScopePayload: String, Codable, Hashable, Sendable, CaseIterable { + case enterprise = "enterprise" + case organization = "organization" + case repository = "repository" + case costCenter = "cost_center" + case multiUserCustomer = "multi_user_customer" + case user = "user" + } + /// Filter budgets by scope type. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/query/scope`. + public var scope: Operations.BillingGetAllBudgetsOrg.Input.Query.ScopePayload? + /// Filter consumed amount details for budgets by the specified user login. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/query/user`. + public var user: Swift.String? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - page: The page number of the results to fetch. + /// - perPage: The number of results per page (max 10). + /// - scope: Filter budgets by scope type. + /// - user: Filter consumed amount details for budgets by the specified user login. + public init( + page: Swift.Int? = nil, + perPage: Swift.Int? = nil, + scope: Operations.BillingGetAllBudgetsOrg.Input.Query.ScopePayload? = nil, + user: Swift.String? = nil + ) { + self.page = page + self.perPage = perPage + self.scope = scope + self.user = user + } + } + public var query: Operations.BillingGetAllBudgetsOrg.Input.Query + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/GET/header`. + public struct Headers: Sendable, Hashable { public var accept: [OpenAPIRuntime.AcceptHeaderContentType] /// Creates a new `Headers`. /// /// - Parameters: /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { + self.accept = accept + } + } + public var headers: Operations.BillingGetAllBudgetsOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + public init( + path: Operations.BillingGetAllBudgetsOrg.Input.Path, + query: Operations.BillingGetAllBudgetsOrg.Input.Query = .init(), + headers: Operations.BillingGetAllBudgetsOrg.Input.Headers = .init() + ) { + self.path = path + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + /// Response when getting all budgets + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/get(billing/get-all-budgets-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Components.Responses.GetAllBudgets) + /// 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.GetAllBudgets { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/get(billing/get-all-budgets-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 + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/get(billing/get-all-budgets-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 + ) + } + } + } + /// Internal Error + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/get(billing/get-all-budgets-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 + ) + } + } + } + /// 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 other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } + /// Create a budget for an organization + /// + /// Creates a new budget for an organization. The authenticated user must be an + /// organization admin or billing manager. + /// + /// - Remark: HTTP `POST /organizations/{org}/settings/billing/budgets`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/post(billing/create-organization-budget)`. + public enum BillingCreateOrganizationBudget { + public static let id: Swift.String = "billing/create-organization-budget" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/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.BillingCreateOrganizationBudget.Input.Path + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/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.BillingGetAllBudgetsOrg.Input.Headers + public var headers: Operations.BillingCreateOrganizationBudget.Input.Headers + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The budget amount in whole dollars. For license-based products, this represents the number of licenses. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_amount`. + public var budgetAmount: Swift.Int? + /// Whether to prevent additional spending once the budget is exceeded. For `user` and `multi_user_customer` scopes, this must be `true`. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/prevent_further_usage`. + public var preventFurtherUsage: Swift.Bool? + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_alerting`. + public struct BudgetAlertingPayload: Codable, Hashable, Sendable { + /// Whether alerts are enabled for this budget + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_alerting/will_alert`. + public var willAlert: Swift.Bool? + /// Array of user login names who will receive alerts + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_alerting/alert_recipients`. + public var alertRecipients: [Swift.String]? + /// Creates a new `BudgetAlertingPayload`. + /// + /// - Parameters: + /// - willAlert: Whether alerts are enabled for this budget + /// - alertRecipients: Array of user login names who will receive alerts + public init( + willAlert: Swift.Bool? = nil, + alertRecipients: [Swift.String]? = nil + ) { + self.willAlert = willAlert + self.alertRecipients = alertRecipients + } + public enum CodingKeys: String, CodingKey { + case willAlert = "will_alert" + case alertRecipients = "alert_recipients" + } + } + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_alerting`. + public var budgetAlerting: Operations.BillingCreateOrganizationBudget.Input.Body.JsonPayload.BudgetAlertingPayload? + /// The scope of the budget for this organization. Use 'organization' for org-level budgets or 'repository' for repo-specific budgets within the organization. `user` and `multi_user_customer` scopes are only supported when `budget_product_sku` is `ai_credits` or `premium_requests`. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_scope`. + @frozen public enum BudgetScopePayload: String, Codable, Hashable, Sendable, CaseIterable { + case organization = "organization" + case repository = "repository" + case multiUserCustomer = "multi_user_customer" + case user = "user" + } + /// The scope of the budget for this organization. Use 'organization' for org-level budgets or 'repository' for repo-specific budgets within the organization. `user` and `multi_user_customer` scopes are only supported when `budget_product_sku` is `ai_credits` or `premium_requests`. + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_scope`. + public var budgetScope: Operations.BillingCreateOrganizationBudget.Input.Body.JsonPayload.BudgetScopePayload? + /// The name of the entity to apply the budget to + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_entity_name`. + public var budgetEntityName: Swift.String? + /// The type of pricing for the budget + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_type`. + @frozen public enum BudgetTypePayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_type/case1`. + @frozen public enum Case1Payload: String, Codable, Hashable, Sendable, CaseIterable { + case productPricing = "ProductPricing" + } + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_type/case1`. + case case1(Operations.BillingCreateOrganizationBudget.Input.Body.JsonPayload.BudgetTypePayload.Case1Payload) + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_type/case2`. + @frozen public enum Case2Payload: String, Codable, Hashable, Sendable, CaseIterable { + case skuPricing = "SkuPricing" + } + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_type/case2`. + case case2(Operations.BillingCreateOrganizationBudget.Input.Body.JsonPayload.BudgetTypePayload.Case2Payload) + public init(from decoder: any Swift.Decoder) throws { + var errors: [any Swift.Error] = [] + do { + self = .case1(try decoder.decodeFromSingleValueContainer()) + return + } catch { + errors.append(error) + } + do { + self = .case2(try decoder.decodeFromSingleValueContainer()) + return + } catch { + errors.append(error) + } + throw Swift.DecodingError.failedToDecodeOneOfSchema( + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + public func encode(to encoder: any Swift.Encoder) throws { + switch self { + case let .case1(value): + try encoder.encodeToSingleValueContainer(value) + case let .case2(value): + try encoder.encodeToSingleValueContainer(value) + } + } + } + /// The type of pricing for the budget + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_type`. + public var budgetType: Operations.BillingCreateOrganizationBudget.Input.Body.JsonPayload.BudgetTypePayload? + /// A single product or SKU that will be covered in the budget + /// + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/json/budget_product_sku`. + public var budgetProductSku: Swift.String? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - budgetAmount: The budget amount in whole dollars. For license-based products, this represents the number of licenses. + /// - preventFurtherUsage: Whether to prevent additional spending once the budget is exceeded. For `user` and `multi_user_customer` scopes, this must be `true`. + /// - budgetAlerting: + /// - budgetScope: The scope of the budget for this organization. Use 'organization' for org-level budgets or 'repository' for repo-specific budgets within the organization. `user` and `multi_user_customer` scopes are only supported when `budget_product_sku` is `ai_credits` or `premium_requests`. + /// - budgetEntityName: The name of the entity to apply the budget to + /// - budgetType: The type of pricing for the budget + /// - budgetProductSku: A single product or SKU that will be covered in the budget + public init( + budgetAmount: Swift.Int? = nil, + preventFurtherUsage: Swift.Bool? = nil, + budgetAlerting: Operations.BillingCreateOrganizationBudget.Input.Body.JsonPayload.BudgetAlertingPayload? = nil, + budgetScope: Operations.BillingCreateOrganizationBudget.Input.Body.JsonPayload.BudgetScopePayload? = nil, + budgetEntityName: Swift.String? = nil, + budgetType: Operations.BillingCreateOrganizationBudget.Input.Body.JsonPayload.BudgetTypePayload? = nil, + budgetProductSku: Swift.String? = nil + ) { + self.budgetAmount = budgetAmount + self.preventFurtherUsage = preventFurtherUsage + self.budgetAlerting = budgetAlerting + self.budgetScope = budgetScope + self.budgetEntityName = budgetEntityName + self.budgetType = budgetType + self.budgetProductSku = budgetProductSku + } + public enum CodingKeys: String, CodingKey { + case budgetAmount = "budget_amount" + case preventFurtherUsage = "prevent_further_usage" + case budgetAlerting = "budget_alerting" + case budgetScope = "budget_scope" + case budgetEntityName = "budget_entity_name" + case budgetType = "budget_type" + case budgetProductSku = "budget_product_sku" + } + } + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/requestBody/content/application\/json`. + case json(Operations.BillingCreateOrganizationBudget.Input.Body.JsonPayload) + } + public var body: Operations.BillingCreateOrganizationBudget.Input.Body? /// Creates a new `Input`. /// /// - Parameters: /// - path: - /// - query: /// - headers: + /// - body: public init( - path: Operations.BillingGetAllBudgetsOrg.Input.Path, - query: Operations.BillingGetAllBudgetsOrg.Input.Query = .init(), - headers: Operations.BillingGetAllBudgetsOrg.Input.Headers = .init() + path: Operations.BillingCreateOrganizationBudget.Input.Path, + headers: Operations.BillingCreateOrganizationBudget.Input.Headers = .init(), + body: Operations.BillingCreateOrganizationBudget.Input.Body? = nil ) { self.path = path - self.query = query self.headers = headers + self.body = body } } @frozen public enum Output: Sendable, Hashable { - /// Response when getting all budgets + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/responses/200/content/application\/json`. + case json(Components.Schemas.CreateBudget) + /// 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.CreateBudget { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.BillingCreateOrganizationBudget.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.BillingCreateOrganizationBudget.Output.Ok.Body) { + self.body = body + } + } + /// Budget created successfully /// - /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/get(billing/get-all-budgets-org)/responses/200`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/post(billing/create-organization-budget)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Components.Responses.GetAllBudgets) + case ok(Operations.BillingCreateOrganizationBudget.Output.Ok) /// 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.GetAllBudgets { + public var ok: Operations.BillingCreateOrganizationBudget.Output.Ok { get throws { switch self { case let .ok(response): @@ -2556,40 +4131,91 @@ public enum Operations { } } } - /// Resource not found + /// Bad Request /// - /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/get(billing/get-all-budgets-org)/responses/404`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/post(billing/create-organization-budget)/responses/400`. /// - /// HTTP response code: `404 notFound`. - case notFound(Components.Responses.NotFound) - /// The associated value of the enum case if `self` is `.notFound`. + /// 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 `.notFound`. - /// - SeeAlso: `.notFound`. - public var notFound: Components.Responses.NotFound { + /// - Throws: An error if `self` is not `.badRequest`. + /// - SeeAlso: `.badRequest`. + public var badRequest: Components.Responses.BadRequest { get throws { switch self { - case let .notFound(response): + case let .badRequest(response): return response default: try throwUnexpectedResponseStatus( - expectedStatus: "notFound", + expectedStatus: "badRequest", response: self ) } } } - /// Forbidden + /// Requires authentication /// - /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/get(billing/get-all-budgets-org)/responses/403`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/post(billing/create-organization-budget)/responses/401`. + /// + /// HTTP response code: `401 unauthorized`. + case unauthorized(Components.Responses.RequiresAuthentication) + /// The associated value of the enum case if `self` is `.unauthorized`. + /// + /// - Throws: An error if `self` is not `.unauthorized`. + /// - SeeAlso: `.unauthorized`. + public var unauthorized: Components.Responses.RequiresAuthentication { + get throws { + switch self { + case let .unauthorized(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unauthorized", + response: self + ) + } + } + } + public struct Forbidden: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/responses/403/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/responses/403/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: Operations.BillingCreateOrganizationBudget.Output.Forbidden.Body + /// Creates a new `Forbidden`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.BillingCreateOrganizationBudget.Output.Forbidden.Body) { + self.body = body + } + } + /// Insufficient permissions + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/post(billing/create-organization-budget)/responses/403`. /// /// HTTP response code: `403 forbidden`. - case forbidden(Components.Responses.Forbidden) + case forbidden(Operations.BillingCreateOrganizationBudget.Output.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 { + public var forbidden: Operations.BillingCreateOrganizationBudget.Output.Forbidden { get throws { switch self { case let .forbidden(response): @@ -2602,17 +4228,119 @@ public enum Operations { } } } - /// Internal Error + public struct NotFound: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/responses/404/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/responses/404/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: Operations.BillingCreateOrganizationBudget.Output.NotFound.Body + /// Creates a new `NotFound`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.BillingCreateOrganizationBudget.Output.NotFound.Body) { + self.body = body + } + } + /// Feature not enabled or organization not found /// - /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/get(billing/get-all-budgets-org)/responses/500`. + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/post(billing/create-organization-budget)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Operations.BillingCreateOrganizationBudget.Output.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: Operations.BillingCreateOrganizationBudget.Output.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/post(billing/create-organization-budget)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + public struct InternalServerError: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/responses/500/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/POST/responses/500/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: Operations.BillingCreateOrganizationBudget.Output.InternalServerError.Body + /// Creates a new `InternalServerError`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.BillingCreateOrganizationBudget.Output.InternalServerError.Body) { + self.body = body + } + } + /// Internal server error + /// + /// - Remark: Generated from `#/paths//organizations/{org}/settings/billing/budgets/post(billing/create-organization-budget)/responses/500`. /// /// HTTP response code: `500 internalServerError`. - case internalServerError(Components.Responses.InternalError) + case internalServerError(Operations.BillingCreateOrganizationBudget.Output.InternalServerError) /// 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 { + public var internalServerError: Operations.BillingCreateOrganizationBudget.Output.InternalServerError { get throws { switch self { case let .internalServerError(response): @@ -2632,11 +4360,14 @@ public enum Operations { } @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) } @@ -2647,20 +4378,20 @@ public enum Operations { return string case .json: return "application/json" + case .applicationScimJson: + return "application/scim+json" } } public static var allCases: [Self] { [ - .json + .json, + .applicationScimJson ] } } } /// Get a budget by ID for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// /// Gets a budget by ID. The authenticated user must be an organization admin or billing manager. /// /// - Remark: HTTP `GET /organizations/{org}/settings/billing/budgets/{budget_id}`. @@ -2895,9 +4626,6 @@ public enum Operations { } /// Update a budget for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// /// Updates an existing budget for an organization. The authenticated user must be an organization admin or billing manager. /// /// - Remark: HTTP `PATCH /organizations/{org}/settings/billing/budgets/{budget_id}`. @@ -2949,7 +4677,7 @@ public enum Operations { /// /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/requestBody/json/budget_amount`. public var budgetAmount: Swift.Int? - /// Whether to prevent additional spending once the budget is exceeded + /// Whether to prevent additional spending once the budget is exceeded. For budgets with `user` or `multi_user_customer` scope, this must remain `true`. /// /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/requestBody/json/prevent_further_usage`. public var preventFurtherUsage: Swift.Bool? @@ -2990,6 +4718,8 @@ public enum Operations { case organization = "organization" case repository = "repository" case costCenter = "cost_center" + case multiUserCustomer = "multi_user_customer" + case user = "user" } /// The scope of the budget /// @@ -3056,7 +4786,7 @@ public enum Operations { /// /// - Parameters: /// - budgetAmount: The budget amount in whole dollars. For license-based products, this represents the number of licenses. - /// - preventFurtherUsage: Whether to prevent additional spending once the budget is exceeded + /// - preventFurtherUsage: Whether to prevent additional spending once the budget is exceeded. For budgets with `user` or `multi_user_customer` scope, this must remain `true`. /// - budgetAlerting: /// - budgetScope: The scope of the budget /// - budgetEntityName: The name of the entity to apply the budget to @@ -3103,200 +4833,23 @@ public enum Operations { path: Operations.BillingUpdateBudgetOrg.Input.Path, headers: Operations.BillingUpdateBudgetOrg.Input.Headers = .init(), body: Operations.BillingUpdateBudgetOrg.Input.Body - ) { - self.path = path - self.headers = headers - self.body = body - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/message`. - public var message: Swift.String? - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget`. - public struct BudgetPayload: Codable, Hashable, Sendable { - /// ID of the budget. - /// - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/id`. - public var id: Swift.String? - /// The budget amount in whole dollars. For license-based products, this represents the number of licenses. - /// - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_amount`. - public var budgetAmount: Swift.Float? - /// Whether to prevent additional spending once the budget is exceeded - /// - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/prevent_further_usage`. - public var preventFurtherUsage: Swift.Bool? - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_alerting`. - public struct BudgetAlertingPayload: Codable, Hashable, Sendable { - /// Whether alerts are enabled for this budget - /// - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_alerting/will_alert`. - public var willAlert: Swift.Bool - /// Array of user login names who will receive alerts - /// - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_alerting/alert_recipients`. - public var alertRecipients: [Swift.String] - /// Creates a new `BudgetAlertingPayload`. - /// - /// - Parameters: - /// - willAlert: Whether alerts are enabled for this budget - /// - alertRecipients: Array of user login names who will receive alerts - public init( - willAlert: Swift.Bool, - alertRecipients: [Swift.String] - ) { - self.willAlert = willAlert - self.alertRecipients = alertRecipients - } - public enum CodingKeys: String, CodingKey { - case willAlert = "will_alert" - case alertRecipients = "alert_recipients" - } - } - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_alerting`. - public var budgetAlerting: Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload.BudgetPayload.BudgetAlertingPayload? - /// The scope of the budget - /// - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_scope`. - @frozen public enum BudgetScopePayload: String, Codable, Hashable, Sendable, CaseIterable { - case enterprise = "enterprise" - case organization = "organization" - case repository = "repository" - case costCenter = "cost_center" - } - /// The scope of the budget - /// - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_scope`. - public var budgetScope: Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload.BudgetPayload.BudgetScopePayload? - /// The name of the entity to apply the budget to - /// - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_entity_name`. - public var budgetEntityName: Swift.String? - /// The type of pricing for the budget - /// - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_type`. - @frozen public enum BudgetTypePayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_type/case1`. - @frozen public enum Case1Payload: String, Codable, Hashable, Sendable, CaseIterable { - case productPricing = "ProductPricing" - } - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_type/case1`. - case case1(Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload.BudgetPayload.BudgetTypePayload.Case1Payload) - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_type/case2`. - @frozen public enum Case2Payload: String, Codable, Hashable, Sendable, CaseIterable { - case skuPricing = "SkuPricing" - } - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_type/case2`. - case case2(Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload.BudgetPayload.BudgetTypePayload.Case2Payload) - public init(from decoder: any Swift.Decoder) throws { - var errors: [any Swift.Error] = [] - do { - self = .case1(try decoder.decodeFromSingleValueContainer()) - return - } catch { - errors.append(error) - } - do { - self = .case2(try decoder.decodeFromSingleValueContainer()) - return - } catch { - errors.append(error) - } - throw Swift.DecodingError.failedToDecodeOneOfSchema( - type: Self.self, - codingPath: decoder.codingPath, - errors: errors - ) - } - public func encode(to encoder: any Swift.Encoder) throws { - switch self { - case let .case1(value): - try encoder.encodeToSingleValueContainer(value) - case let .case2(value): - try encoder.encodeToSingleValueContainer(value) - } - } - } - /// The type of pricing for the budget - /// - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_type`. - public var budgetType: Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload.BudgetPayload.BudgetTypePayload? - /// A single product or SKU that will be covered in the budget - /// - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget/budget_product_sku`. - public var budgetProductSku: Swift.String? - /// Creates a new `BudgetPayload`. - /// - /// - Parameters: - /// - id: ID of the budget. - /// - budgetAmount: The budget amount in whole dollars. For license-based products, this represents the number of licenses. - /// - preventFurtherUsage: Whether to prevent additional spending once the budget is exceeded - /// - budgetAlerting: - /// - budgetScope: The scope of the budget - /// - budgetEntityName: The name of the entity to apply the budget to - /// - budgetType: The type of pricing for the budget - /// - budgetProductSku: A single product or SKU that will be covered in the budget - public init( - id: Swift.String? = nil, - budgetAmount: Swift.Float? = nil, - preventFurtherUsage: Swift.Bool? = nil, - budgetAlerting: Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload.BudgetPayload.BudgetAlertingPayload? = nil, - budgetScope: Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload.BudgetPayload.BudgetScopePayload? = nil, - budgetEntityName: Swift.String? = nil, - budgetType: Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload.BudgetPayload.BudgetTypePayload? = nil, - budgetProductSku: Swift.String? = nil - ) { - self.id = id - self.budgetAmount = budgetAmount - self.preventFurtherUsage = preventFurtherUsage - self.budgetAlerting = budgetAlerting - self.budgetScope = budgetScope - self.budgetEntityName = budgetEntityName - self.budgetType = budgetType - self.budgetProductSku = budgetProductSku - } - public enum CodingKeys: String, CodingKey { - case id - case budgetAmount = "budget_amount" - case preventFurtherUsage = "prevent_further_usage" - case budgetAlerting = "budget_alerting" - case budgetScope = "budget_scope" - case budgetEntityName = "budget_entity_name" - case budgetType = "budget_type" - case budgetProductSku = "budget_product_sku" - } - } - /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/json/budget`. - public var budget: Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload.BudgetPayload? - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: - /// - budget: - public init( - message: Swift.String? = nil, - budget: Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload.BudgetPayload? = nil - ) { - self.message = message - self.budget = budget - } - public enum CodingKeys: String, CodingKey { - case message - case budget - } - } + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { /// - Remark: Generated from `#/paths/organizations/{org}/settings/billing/budgets/{budget_id}/PATCH/responses/200/content/application\/json`. - case json(Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload) + case json(Components.Schemas.UpdateBudget) /// The associated value of the enum case if `self` is `.json`. /// /// - Throws: An error if `self` is not `.json`. /// - SeeAlso: `.json`. - public var json: Operations.BillingUpdateBudgetOrg.Output.Ok.Body.JsonPayload { + public var json: Components.Schemas.UpdateBudget { get throws { switch self { case let .json(body): @@ -3571,9 +5124,6 @@ public enum Operations { } /// Delete a budget for an organization /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// /// Deletes a budget by ID for an organization. The authenticated user must be an organization admin or billing manager. /// /// - Remark: HTTP `DELETE /organizations/{org}/settings/billing/budgets/{budget_id}`. @@ -4588,6 +6138,281 @@ public enum Operations { } } } + /// Get billing AI credit usage report for a user + /// + /// Gets a report of AI credit usage for a user. + /// + /// **Note:** Only data from the past 24 months is accessible via this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/settings/billing/ai_credit/usage`. + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/ai_credit/usage/get(billing/get-github-billing-ai-credit-usage-report-user)`. + public enum BillingGetGithubBillingAiCreditUsageReportUser { + public static let id: Swift.String = "billing/get-github-billing-ai-credit-usage-report-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/ai_credit/usage/GET/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/ai_credit/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.BillingGetGithubBillingAiCreditUsageReportUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/ai_credit/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/ai_credit/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/ai_credit/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/ai_credit/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/ai_credit/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/ai_credit/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.BillingGetGithubBillingAiCreditUsageReportUser.Input.Query + /// - Remark: Generated from `#/paths/users/{username}/settings/billing/ai_credit/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.BillingGetGithubBillingAiCreditUsageReportUser.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + public init( + path: Operations.BillingGetGithubBillingAiCreditUsageReportUser.Input.Path, + query: Operations.BillingGetGithubBillingAiCreditUsageReportUser.Input.Query = .init(), + headers: Operations.BillingGetGithubBillingAiCreditUsageReportUser.Input.Headers = .init() + ) { + self.path = path + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + /// Response when getting a billing AI credit usage report + /// + /// - Remark: Generated from `#/paths//users/{username}/settings/billing/ai_credit/usage/get(billing/get-github-billing-ai-credit-usage-report-user)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Components.Responses.BillingAiCreditUsageReportUser) + /// 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.BillingAiCreditUsageReportUser { + 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/ai_credit/usage/get(billing/get-github-billing-ai-credit-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/ai_credit/usage/get(billing/get-github-billing-ai-credit-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/ai_credit/usage/get(billing/get-github-billing-ai-credit-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/ai_credit/usage/get(billing/get-github-billing-ai-credit-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/ai_credit/usage/get(billing/get-github-billing-ai-credit-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 billing premium request usage report for a user /// /// Gets a report of premium request usage for a user. From 7bf82c8e774685e9ba7a1fed2dd3ba7adef18112 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jun 2026 21:42:07 +0000 Subject: [PATCH 5/5] Commit via running: make Sources/repos --- Sources/repos/Client.swift | 123 ++++++++++++++++ Sources/repos/Types.swift | 278 +++++++++++++++++++++++++++++++++++++ 2 files changed, 401 insertions(+) diff --git a/Sources/repos/Client.swift b/Sources/repos/Client.swift index dceaad6f42..df77dc1dd1 100644 --- a/Sources/repos/Client.swift +++ b/Sources/repos/Client.swift @@ -601,6 +601,13 @@ public struct Client: APIProtocol { name: "rule_suite_result", value: input.query.ruleSuiteResult ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "evaluate_status", + value: input.query.evaluateStatus + ) try converter.setQueryItemAsURI( in: &request, style: .form, @@ -11149,6 +11156,115 @@ public struct Client: APIProtocol { } ) } + /// Get the hash algorithm for a repository + /// + /// Returns the hash algorithm used to store repository objects. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/hash-algorithm`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/hash-algorithm/get(repos/get-hash-algorithm)`. + public func reposGetHashAlgorithm(_ input: Operations.ReposGetHashAlgorithm.Input) async throws -> Operations.ReposGetHashAlgorithm.Output { + try await client.send( + input: input, + forOperation: Operations.ReposGetHashAlgorithm.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/repos/{}/{}/hash-algorithm", + parameters: [ + input.path.owner, + input.path.repo + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + 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: Operations.ReposGetHashAlgorithm.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.RepositoryHashAlgorithm.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.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)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } /// List repository webhooks /// /// Lists webhooks for a repository. `last response` may return null if there have not been any deliveries within 30 days. @@ -16856,6 +16972,13 @@ public struct Client: APIProtocol { name: "rule_suite_result", value: input.query.ruleSuiteResult ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "evaluate_status", + value: input.query.evaluateStatus + ) try converter.setQueryItemAsURI( in: &request, style: .form, diff --git a/Sources/repos/Types.swift b/Sources/repos/Types.swift index daa0093e45..8a58903b8a 100644 --- a/Sources/repos/Types.swift +++ b/Sources/repos/Types.swift @@ -1281,6 +1281,13 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `POST /repos/{owner}/{repo}/forks`. /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/forks/post(repos/create-fork)`. func reposCreateFork(_ input: Operations.ReposCreateFork.Input) async throws -> Operations.ReposCreateFork.Output + /// Get the hash algorithm for a repository + /// + /// Returns the hash algorithm used to store repository objects. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/hash-algorithm`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/hash-algorithm/get(repos/get-hash-algorithm)`. + func reposGetHashAlgorithm(_ input: Operations.ReposGetHashAlgorithm.Input) async throws -> Operations.ReposGetHashAlgorithm.Output /// List repository webhooks /// /// Lists webhooks for a repository. `last response` may return null if there have not been any deliveries within 30 days. @@ -4290,6 +4297,21 @@ extension APIProtocol { body: body )) } + /// Get the hash algorithm for a repository + /// + /// Returns the hash algorithm used to store repository objects. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/hash-algorithm`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/hash-algorithm/get(repos/get-hash-algorithm)`. + public func reposGetHashAlgorithm( + path: Operations.ReposGetHashAlgorithm.Input.Path, + headers: Operations.ReposGetHashAlgorithm.Input.Headers = .init() + ) async throws -> Operations.ReposGetHashAlgorithm.Output { + try await reposGetHashAlgorithm(Operations.ReposGetHashAlgorithm.Input( + path: path, + headers: headers + )) + } /// List repository webhooks /// /// Lists webhooks for a repository. `last response` may return null if there have not been any deliveries within 30 days. @@ -20982,6 +21004,32 @@ public enum Components { case app } } + /// Repository hash algorithm + /// + /// - Remark: Generated from `#/components/schemas/repository-hash-algorithm`. + public struct RepositoryHashAlgorithm: Codable, Hashable, Sendable { + /// The Git hash algorithm used by this repository. + /// + /// - Remark: Generated from `#/components/schemas/repository-hash-algorithm/hash_algorithm`. + @frozen public enum HashAlgorithmPayload: String, Codable, Hashable, Sendable, CaseIterable { + case sha1 = "sha1" + case sha256 = "sha256" + } + /// The Git hash algorithm used by this repository. + /// + /// - Remark: Generated from `#/components/schemas/repository-hash-algorithm/hash_algorithm`. + public var hashAlgorithm: Components.Schemas.RepositoryHashAlgorithm.HashAlgorithmPayload + /// Creates a new `RepositoryHashAlgorithm`. + /// + /// - Parameters: + /// - hashAlgorithm: The Git hash algorithm used by this repository. + public init(hashAlgorithm: Components.Schemas.RepositoryHashAlgorithm.HashAlgorithmPayload) { + self.hashAlgorithm = hashAlgorithm + } + public enum CodingKeys: String, CodingKey { + case hashAlgorithm = "hash_algorithm" + } + } /// - Remark: Generated from `#/components/schemas/hook-response`. public struct HookResponse: Codable, Hashable, Sendable { /// - Remark: Generated from `#/components/schemas/hook-response/code`. @@ -23449,6 +23497,17 @@ public enum Components { case bypass = "bypass" case all = "all" } + /// The evaluate status to filter on. When specified, only rule suites resulting from rulesets with the specified evaluate status will be returned. + /// - `all` - all rule suites will be returned. + /// - `active` - only rule suites resulting from rulesets in active (non-evaluate) mode will be returned. + /// - `evaluate` - only rule suites resulting from rulesets in evaluate mode will be returned. + /// + /// - Remark: Generated from `#/components/parameters/evaluate-status`. + @frozen public enum EvaluateStatus: String, Codable, Hashable, Sendable, CaseIterable { + case all = "all" + case active = "active" + case evaluate = "evaluate" + } /// The unique identifier of the rule suite result. /// To get this ID, you can use [GET /repos/{owner}/{repo}/rulesets/rule-suites](https://docs.github.com/rest/repos/rule-suites#list-repository-rule-suites) /// for repositories and [GET /orgs/{org}/rulesets/rule-suites](https://docs.github.com/rest/orgs/rule-suites#list-organization-rule-suites) @@ -25260,6 +25319,19 @@ public enum Operations { /// /// - Remark: Generated from `#/paths/orgs/{org}/rulesets/rule-suites/GET/query/rule_suite_result`. public var ruleSuiteResult: Components.Parameters.RuleSuiteResult? + /// - Remark: Generated from `#/components/parameters/evaluate-status`. + @frozen public enum EvaluateStatus: String, Codable, Hashable, Sendable, CaseIterable { + case all = "all" + case active = "active" + case evaluate = "evaluate" + } + /// The evaluate status to filter on. When specified, only rule suites resulting from rulesets with the specified evaluate status will be returned. + /// - `all` - all rule suites will be returned. + /// - `active` - only rule suites resulting from rulesets in active (non-evaluate) mode will be returned. + /// - `evaluate` - only rule suites resulting from rulesets in evaluate mode will be returned. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/rulesets/rule-suites/GET/query/evaluate_status`. + public var evaluateStatus: Components.Parameters.EvaluateStatus? /// The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." /// /// - Remark: Generated from `#/paths/orgs/{org}/rulesets/rule-suites/GET/query/per_page`. @@ -25276,6 +25348,7 @@ public enum Operations { /// - timePeriod: The time period to filter by. /// - actorName: The handle for the GitHub user account to filter on. When specified, only rule evaluations triggered by this actor will be returned. /// - ruleSuiteResult: The rule suite results to filter on. When specified, only suites with this result will be returned. + /// - evaluateStatus: The evaluate status to filter on. When specified, only rule suites resulting from rulesets with the specified evaluate status will be returned. /// - perPage: The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." /// - page: The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." public init( @@ -25284,6 +25357,7 @@ public enum Operations { timePeriod: Components.Parameters.TimePeriod? = nil, actorName: Components.Parameters.ActorNameInQuery? = nil, ruleSuiteResult: Components.Parameters.RuleSuiteResult? = nil, + evaluateStatus: Components.Parameters.EvaluateStatus? = nil, perPage: Components.Parameters.PerPage? = nil, page: Components.Parameters.Page? = nil ) { @@ -25292,6 +25366,7 @@ public enum Operations { self.timePeriod = timePeriod self.actorName = actorName self.ruleSuiteResult = ruleSuiteResult + self.evaluateStatus = evaluateStatus self.perPage = perPage self.page = page } @@ -47823,6 +47898,193 @@ public enum Operations { } } } + /// Get the hash algorithm for a repository + /// + /// Returns the hash algorithm used to store repository objects. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/hash-algorithm`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/hash-algorithm/get(repos/get-hash-algorithm)`. + public enum ReposGetHashAlgorithm { + public static let id: Swift.String = "repos/get-hash-algorithm" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/hash-algorithm/GET/path`. + public struct Path: Sendable, Hashable { + /// The account owner of the repository. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/hash-algorithm/GET/path/owner`. + public var owner: Components.Parameters.Owner + /// The name of the repository without the `.git` extension. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/hash-algorithm/GET/path/repo`. + public var repo: Components.Parameters.Repo + /// Creates a new `Path`. + /// + /// - Parameters: + /// - owner: The account owner of the repository. The name is not case sensitive. + /// - repo: The name of the repository without the `.git` extension. The name is not case sensitive. + public init( + owner: Components.Parameters.Owner, + repo: Components.Parameters.Repo + ) { + self.owner = owner + self.repo = repo + } + } + public var path: Operations.ReposGetHashAlgorithm.Input.Path + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/hash-algorithm/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.ReposGetHashAlgorithm.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.ReposGetHashAlgorithm.Input.Path, + headers: Operations.ReposGetHashAlgorithm.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/hash-algorithm/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/hash-algorithm/GET/responses/200/content/application\/json`. + case json(Components.Schemas.RepositoryHashAlgorithm) + /// 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.RepositoryHashAlgorithm { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.ReposGetHashAlgorithm.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.ReposGetHashAlgorithm.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/hash-algorithm/get(repos/get-hash-algorithm)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.ReposGetHashAlgorithm.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. + /// + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.ReposGetHashAlgorithm.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/hash-algorithm/get(repos/get-hash-algorithm)/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//repos/{owner}/{repo}/hash-algorithm/get(repos/get-hash-algorithm)/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 + ) + } + } + } + /// 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 other(Swift.String) + public init?(rawValue: Swift.String) { + switch rawValue.lowercased() { + case "application/json": + self = .json + default: + self = .other(rawValue) + } + } + public var rawValue: Swift.String { + switch self { + case let .other(string): + return string + case .json: + return "application/json" + } + } + public static var allCases: [Self] { + [ + .json + ] + } + } + } /// List repository webhooks /// /// Lists webhooks for a repository. `last response` may return null if there have not been any deliveries within 30 days. @@ -59935,6 +60197,19 @@ public enum Operations { /// /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/rulesets/rule-suites/GET/query/rule_suite_result`. public var ruleSuiteResult: Components.Parameters.RuleSuiteResult? + /// - Remark: Generated from `#/components/parameters/evaluate-status`. + @frozen public enum EvaluateStatus: String, Codable, Hashable, Sendable, CaseIterable { + case all = "all" + case active = "active" + case evaluate = "evaluate" + } + /// The evaluate status to filter on. When specified, only rule suites resulting from rulesets with the specified evaluate status will be returned. + /// - `all` - all rule suites will be returned. + /// - `active` - only rule suites resulting from rulesets in active (non-evaluate) mode will be returned. + /// - `evaluate` - only rule suites resulting from rulesets in evaluate mode will be returned. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/rulesets/rule-suites/GET/query/evaluate_status`. + public var evaluateStatus: Components.Parameters.EvaluateStatus? /// The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." /// /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/rulesets/rule-suites/GET/query/per_page`. @@ -59950,6 +60225,7 @@ public enum Operations { /// - timePeriod: The time period to filter by. /// - actorName: The handle for the GitHub user account to filter on. When specified, only rule evaluations triggered by this actor will be returned. /// - ruleSuiteResult: The rule suite results to filter on. When specified, only suites with this result will be returned. + /// - evaluateStatus: The evaluate status to filter on. When specified, only rule suites resulting from rulesets with the specified evaluate status will be returned. /// - perPage: The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." /// - page: The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." public init( @@ -59957,6 +60233,7 @@ public enum Operations { timePeriod: Components.Parameters.TimePeriod? = nil, actorName: Components.Parameters.ActorNameInQuery? = nil, ruleSuiteResult: Components.Parameters.RuleSuiteResult? = nil, + evaluateStatus: Components.Parameters.EvaluateStatus? = nil, perPage: Components.Parameters.PerPage? = nil, page: Components.Parameters.Page? = nil ) { @@ -59964,6 +60241,7 @@ public enum Operations { self.timePeriod = timePeriod self.actorName = actorName self.ruleSuiteResult = ruleSuiteResult + self.evaluateStatus = evaluateStatus self.perPage = perPage self.page = page }