diff --git a/Sources/agent-tasks/Client.swift b/Sources/agent-tasks/Client.swift index ad0ac35cbaa..87202523ac7 100644 --- a/Sources/agent-tasks/Client.swift +++ b/Sources/agent-tasks/Client.swift @@ -38,982 +38,4 @@ public struct Client: APIProtocol { private var converter: Converter { client.converter } - /// List tasks for repository - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a list of tasks for a specific repository - /// - /// - /// - Remark: HTTP `GET /agents/repos/{owner}/{repo}/tasks`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/get(agent-tasks/list-tasks-for-repo)`. - public func agentTasksListTasksForRepo(_ input: Operations.AgentTasksListTasksForRepo.Input) async throws -> Operations.AgentTasksListTasksForRepo.Output { - try await client.send( - input: input, - forOperation: Operations.AgentTasksListTasksForRepo.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/agents/repos/{}/{}/tasks", - parameters: [ - input.path.owner, - input.path.repo - ] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .get - ) - suppressMutabilityWarning(&request) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "per_page", - value: input.query.perPage - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "page", - value: input.query.page - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "sort", - value: input.query.sort - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "direction", - value: input.query.direction - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "state", - value: input.query.state - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "is_archived", - value: input.query.isArchived - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "since", - value: input.query.since - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "creator_id", - value: input.query.creatorId - ) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - return (request, nil) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let headers: Operations.AgentTasksListTasksForRepo.Output.Ok.Headers = .init(link: try converter.getOptionalHeaderFieldAsURI( - in: response.headerFields, - name: "Link", - as: Swift.String.self - )) - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.AgentTasksListTasksForRepo.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init( - headers: headers, - body: body - )) - case 400: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.AgentTasksListTasksForRepo.Output.BadRequest.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksListTasksForRepo.Output.BadRequest.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(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: Operations.AgentTasksListTasksForRepo.Output.Unauthorized.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksListTasksForRepo.Output.Unauthorized.Body.JsonPayload.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.AgentTasksListTasksForRepo.Output.Forbidden.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksListTasksForRepo.Output.Forbidden.Body.JsonPayload.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: Operations.AgentTasksListTasksForRepo.Output.NotFound.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksListTasksForRepo.Output.NotFound.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .notFound(.init(body: body)) - case 422: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .unprocessableContent(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Create a task - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Creates a new task for a repository. - /// - /// - /// - Remark: HTTP `POST /agents/repos/{owner}/{repo}/tasks`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/post(agent-tasks/create-task)`. - public func agentTasksCreateTask(_ input: Operations.AgentTasksCreateTask.Input) async throws -> Operations.AgentTasksCreateTask.Output { - try await client.send( - input: input, - forOperation: Operations.AgentTasksCreateTask.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/agents/repos/{}/{}/tasks", - parameters: [ - input.path.owner, - input.path.repo - ] - ) - 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 let .json(value): - body = try converter.setRequiredRequestBodyAsJSON( - value, - headerFields: &request.headerFields, - contentType: "application/json; charset=utf-8" - ) - } - return (request, body) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 201: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.AgentTasksCreateTask.Output.Created.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .created(.init(body: body)) - case 400: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.AgentTasksCreateTask.Output.BadRequest.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksCreateTask.Output.BadRequest.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(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: Operations.AgentTasksCreateTask.Output.Unauthorized.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksCreateTask.Output.Unauthorized.Body.JsonPayload.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.AgentTasksCreateTask.Output.Forbidden.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksCreateTask.Output.Forbidden.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .forbidden(.init(body: body)) - case 422: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.AgentTasksCreateTask.Output.UnprocessableContent.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksCreateTask.Output.UnprocessableContent.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .unprocessableContent(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Get a task by repo - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a task by ID scoped to an owner/repo path - /// - /// - /// - Remark: HTTP `GET /agents/repos/{owner}/{repo}/tasks/{task_id}`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/{task_id}/get(agent-tasks/get-task-by-repo-and-id)`. - public func agentTasksGetTaskByRepoAndId(_ input: Operations.AgentTasksGetTaskByRepoAndId.Input) async throws -> Operations.AgentTasksGetTaskByRepoAndId.Output { - try await client.send( - input: input, - forOperation: Operations.AgentTasksGetTaskByRepoAndId.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/agents/repos/{}/{}/tasks/{}", - parameters: [ - input.path.owner, - input.path.repo, - input.path.taskId - ] - ) - 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.AgentTasksGetTaskByRepoAndId.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.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: Operations.AgentTasksGetTaskByRepoAndId.Output.BadRequest.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskByRepoAndId.Output.BadRequest.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(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: Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized.Body.JsonPayload.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.AgentTasksGetTaskByRepoAndId.Output.Forbidden.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskByRepoAndId.Output.Forbidden.Body.JsonPayload.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: Operations.AgentTasksGetTaskByRepoAndId.Output.NotFound.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskByRepoAndId.Output.NotFound.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .notFound(.init(body: body)) - case 422: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .unprocessableContent(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// List tasks - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a list of tasks for the authenticated user - /// - /// - /// - Remark: HTTP `GET /agents/tasks`. - /// - Remark: Generated from `#/paths//agents/tasks/get(agent-tasks/list-tasks)`. - public func agentTasksListTasks(_ input: Operations.AgentTasksListTasks.Input) async throws -> Operations.AgentTasksListTasks.Output { - try await client.send( - input: input, - forOperation: Operations.AgentTasksListTasks.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/agents/tasks", - parameters: [] - ) - var request: HTTPTypes.HTTPRequest = .init( - soar_path: path, - method: .get - ) - suppressMutabilityWarning(&request) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "per_page", - value: input.query.perPage - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "page", - value: input.query.page - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "sort", - value: input.query.sort - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "direction", - value: input.query.direction - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "state", - value: input.query.state - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "is_archived", - value: input.query.isArchived - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "since", - value: input.query.since - ) - converter.setAcceptHeader( - in: &request.headerFields, - contentTypes: input.headers.accept - ) - return (request, nil) - }, - deserializer: { response, responseBody in - switch response.status.code { - case 200: - let headers: Operations.AgentTasksListTasks.Output.Ok.Headers = .init(link: try converter.getOptionalHeaderFieldAsURI( - in: response.headerFields, - name: "Link", - as: Swift.String.self - )) - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.AgentTasksListTasks.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init( - headers: headers, - body: body - )) - case 400: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.AgentTasksListTasks.Output.BadRequest.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksListTasks.Output.BadRequest.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(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: Operations.AgentTasksListTasks.Output.Unauthorized.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksListTasks.Output.Unauthorized.Body.JsonPayload.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.AgentTasksListTasks.Output.Forbidden.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksListTasks.Output.Forbidden.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .forbidden(.init(body: body)) - case 422: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.AgentTasksListTasks.Output.UnprocessableContent.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksListTasks.Output.UnprocessableContent.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .unprocessableContent(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } - /// Get a task by ID - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a task by ID with its associated sessions - /// - /// - /// - Remark: HTTP `GET /agents/tasks/{task_id}`. - /// - Remark: Generated from `#/paths//agents/tasks/{task_id}/get(agent-tasks/get-task-by-id)`. - public func agentTasksGetTaskById(_ input: Operations.AgentTasksGetTaskById.Input) async throws -> Operations.AgentTasksGetTaskById.Output { - try await client.send( - input: input, - forOperation: Operations.AgentTasksGetTaskById.id, - serializer: { input in - let path = try converter.renderedPath( - template: "/agents/tasks/{}", - parameters: [ - input.path.taskId - ] - ) - 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.AgentTasksGetTaskById.Output.Ok.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.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: Operations.AgentTasksGetTaskById.Output.BadRequest.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskById.Output.BadRequest.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(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: Operations.AgentTasksGetTaskById.Output.Unauthorized.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskById.Output.Unauthorized.Body.JsonPayload.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.AgentTasksGetTaskById.Output.Forbidden.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskById.Output.Forbidden.Body.JsonPayload.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: Operations.AgentTasksGetTaskById.Output.NotFound.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskById.Output.NotFound.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .notFound(.init(body: body)) - case 422: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.AgentTasksGetTaskById.Output.UnprocessableContent.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Operations.AgentTasksGetTaskById.Output.UnprocessableContent.Body.JsonPayload.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .unprocessableContent(.init(body: body)) - default: - return .undocumented( - statusCode: response.status.code, - .init( - headerFields: response.headerFields, - body: responseBody - ) - ) - } - } - ) - } } diff --git a/Sources/agent-tasks/Types.swift b/Sources/agent-tasks/Types.swift index bc4a4c23d20..c3d1209ecf5 100644 --- a/Sources/agent-tasks/Types.swift +++ b/Sources/agent-tasks/Types.swift @@ -10,165 +10,10 @@ import struct Foundation.Data import struct Foundation.Date #endif /// A type that performs HTTP operations defined by the OpenAPI document. -public protocol APIProtocol: Sendable { - /// List tasks for repository - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a list of tasks for a specific repository - /// - /// - /// - Remark: HTTP `GET /agents/repos/{owner}/{repo}/tasks`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/get(agent-tasks/list-tasks-for-repo)`. - func agentTasksListTasksForRepo(_ input: Operations.AgentTasksListTasksForRepo.Input) async throws -> Operations.AgentTasksListTasksForRepo.Output - /// Create a task - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Creates a new task for a repository. - /// - /// - /// - Remark: HTTP `POST /agents/repos/{owner}/{repo}/tasks`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/post(agent-tasks/create-task)`. - func agentTasksCreateTask(_ input: Operations.AgentTasksCreateTask.Input) async throws -> Operations.AgentTasksCreateTask.Output - /// Get a task by repo - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a task by ID scoped to an owner/repo path - /// - /// - /// - Remark: HTTP `GET /agents/repos/{owner}/{repo}/tasks/{task_id}`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/{task_id}/get(agent-tasks/get-task-by-repo-and-id)`. - func agentTasksGetTaskByRepoAndId(_ input: Operations.AgentTasksGetTaskByRepoAndId.Input) async throws -> Operations.AgentTasksGetTaskByRepoAndId.Output - /// List tasks - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a list of tasks for the authenticated user - /// - /// - /// - Remark: HTTP `GET /agents/tasks`. - /// - Remark: Generated from `#/paths//agents/tasks/get(agent-tasks/list-tasks)`. - func agentTasksListTasks(_ input: Operations.AgentTasksListTasks.Input) async throws -> Operations.AgentTasksListTasks.Output - /// Get a task by ID - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a task by ID with its associated sessions - /// - /// - /// - Remark: HTTP `GET /agents/tasks/{task_id}`. - /// - Remark: Generated from `#/paths//agents/tasks/{task_id}/get(agent-tasks/get-task-by-id)`. - func agentTasksGetTaskById(_ input: Operations.AgentTasksGetTaskById.Input) async throws -> Operations.AgentTasksGetTaskById.Output -} +public protocol APIProtocol: Sendable {} /// Convenience overloads for operation inputs. extension APIProtocol { - /// List tasks for repository - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a list of tasks for a specific repository - /// - /// - /// - Remark: HTTP `GET /agents/repos/{owner}/{repo}/tasks`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/get(agent-tasks/list-tasks-for-repo)`. - public func agentTasksListTasksForRepo( - path: Operations.AgentTasksListTasksForRepo.Input.Path, - query: Operations.AgentTasksListTasksForRepo.Input.Query = .init(), - headers: Operations.AgentTasksListTasksForRepo.Input.Headers = .init() - ) async throws -> Operations.AgentTasksListTasksForRepo.Output { - try await agentTasksListTasksForRepo(Operations.AgentTasksListTasksForRepo.Input( - path: path, - query: query, - headers: headers - )) - } - /// Create a task - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Creates a new task for a repository. - /// - /// - /// - Remark: HTTP `POST /agents/repos/{owner}/{repo}/tasks`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/post(agent-tasks/create-task)`. - public func agentTasksCreateTask( - path: Operations.AgentTasksCreateTask.Input.Path, - headers: Operations.AgentTasksCreateTask.Input.Headers = .init(), - body: Operations.AgentTasksCreateTask.Input.Body - ) async throws -> Operations.AgentTasksCreateTask.Output { - try await agentTasksCreateTask(Operations.AgentTasksCreateTask.Input( - path: path, - headers: headers, - body: body - )) - } - /// Get a task by repo - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a task by ID scoped to an owner/repo path - /// - /// - /// - Remark: HTTP `GET /agents/repos/{owner}/{repo}/tasks/{task_id}`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/{task_id}/get(agent-tasks/get-task-by-repo-and-id)`. - public func agentTasksGetTaskByRepoAndId( - path: Operations.AgentTasksGetTaskByRepoAndId.Input.Path, - headers: Operations.AgentTasksGetTaskByRepoAndId.Input.Headers = .init() - ) async throws -> Operations.AgentTasksGetTaskByRepoAndId.Output { - try await agentTasksGetTaskByRepoAndId(Operations.AgentTasksGetTaskByRepoAndId.Input( - path: path, - headers: headers - )) - } - /// List tasks - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a list of tasks for the authenticated user - /// - /// - /// - Remark: HTTP `GET /agents/tasks`. - /// - Remark: Generated from `#/paths//agents/tasks/get(agent-tasks/list-tasks)`. - public func agentTasksListTasks( - query: Operations.AgentTasksListTasks.Input.Query = .init(), - headers: Operations.AgentTasksListTasks.Input.Headers = .init() - ) async throws -> Operations.AgentTasksListTasks.Output { - try await agentTasksListTasks(Operations.AgentTasksListTasks.Input( - query: query, - headers: headers - )) - } - /// Get a task by ID - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a task by ID with its associated sessions - /// - /// - /// - Remark: HTTP `GET /agents/tasks/{task_id}`. - /// - Remark: Generated from `#/paths//agents/tasks/{task_id}/get(agent-tasks/get-task-by-id)`. - public func agentTasksGetTaskById( - path: Operations.AgentTasksGetTaskById.Input.Path, - headers: Operations.AgentTasksGetTaskById.Input.Headers = .init() - ) async throws -> Operations.AgentTasksGetTaskById.Output { - try await agentTasksGetTaskById(Operations.AgentTasksGetTaskById.Input( - path: path, - headers: headers - )) - } } /// Server URLs defined in the OpenAPI document. @@ -205,6754 +50,4 @@ public enum Components { } /// API operations, with input and output types, generated from `#/paths` in the OpenAPI document. -public enum Operations { - /// List tasks for repository - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a list of tasks for a specific repository - /// - /// - /// - Remark: HTTP `GET /agents/repos/{owner}/{repo}/tasks`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/get(agent-tasks/list-tasks-for-repo)`. - public enum AgentTasksListTasksForRepo { - public static let id: Swift.String = "agent-tasks/list-tasks-for-repo" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/path`. - public struct Path: Sendable, Hashable { - /// The account owner of the repository. The name is not case sensitive. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/path/owner`. - public var owner: Swift.String - /// The name of the repository. The name is not case sensitive. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/path/repo`. - public var repo: Swift.String - /// Creates a new `Path`. - /// - /// - Parameters: - /// - owner: The account owner of the repository. The name is not case sensitive. - /// - repo: The name of the repository. The name is not case sensitive. - public init( - owner: Swift.String, - repo: Swift.String - ) { - self.owner = owner - self.repo = repo - } - } - public var path: Operations.AgentTasksListTasksForRepo.Input.Path - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/query`. - public struct Query: Sendable, Hashable { - /// The number of results per page (max 100). - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/query/per_page`. - public var perPage: Swift.Int? - /// The page number of the results to fetch. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/query/page`. - public var page: Swift.Int? - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/query/sort`. - @frozen public enum SortPayload: String, Codable, Hashable, Sendable, CaseIterable { - case updatedAt = "updated_at" - case createdAt = "created_at" - } - /// The field to sort results by. Can be `updated_at` or `created_at`. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/query/sort`. - public var sort: Operations.AgentTasksListTasksForRepo.Input.Query.SortPayload? - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/query/direction`. - @frozen public enum DirectionPayload: String, Codable, Hashable, Sendable, CaseIterable { - case asc = "asc" - case desc = "desc" - } - /// The direction to sort results. Can be `asc` or `desc`. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/query/direction`. - public var direction: Operations.AgentTasksListTasksForRepo.Input.Query.DirectionPayload? - /// Comma-separated list of task states to filter by. Can be any combination of: `queued`, `in_progress`, `completed`, `failed`, `idle`, `waiting_for_user`, `timed_out`, `cancelled`. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/query/state`. - public var state: Swift.String? - /// Filter by archived status. When `true`, returns only archived tasks. When `false` or omitted, returns only non-archived tasks. Defaults to `false`. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/query/is_archived`. - public var isArchived: Swift.Bool? - /// Only show tasks updated at or after this time (ISO 8601 timestamp) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/query/since`. - public var since: Foundation.Date? - /// Filter tasks by creator user ID - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/query/creator_id`. - public var creatorId: Swift.Int? - /// Creates a new `Query`. - /// - /// - Parameters: - /// - perPage: The number of results per page (max 100). - /// - page: The page number of the results to fetch. - /// - sort: The field to sort results by. Can be `updated_at` or `created_at`. - /// - direction: The direction to sort results. Can be `asc` or `desc`. - /// - state: Comma-separated list of task states to filter by. Can be any combination of: `queued`, `in_progress`, `completed`, `failed`, `idle`, `waiting_for_user`, `timed_out`, `cancelled`. - /// - isArchived: Filter by archived status. When `true`, returns only archived tasks. When `false` or omitted, returns only non-archived tasks. Defaults to `false`. - /// - since: Only show tasks updated at or after this time (ISO 8601 timestamp) - /// - creatorId: Filter tasks by creator user ID - public init( - perPage: Swift.Int? = nil, - page: Swift.Int? = nil, - sort: Operations.AgentTasksListTasksForRepo.Input.Query.SortPayload? = nil, - direction: Operations.AgentTasksListTasksForRepo.Input.Query.DirectionPayload? = nil, - state: Swift.String? = nil, - isArchived: Swift.Bool? = nil, - since: Foundation.Date? = nil, - creatorId: Swift.Int? = nil - ) { - self.perPage = perPage - self.page = page - self.sort = sort - self.direction = direction - self.state = state - self.isArchived = isArchived - self.since = since - self.creatorId = creatorId - } - } - public var query: Operations.AgentTasksListTasksForRepo.Input.Query - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/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.AgentTasksListTasksForRepo.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - path: - /// - query: - /// - headers: - public init( - path: Operations.AgentTasksListTasksForRepo.Input.Path, - query: Operations.AgentTasksListTasksForRepo.Input.Query = .init(), - headers: Operations.AgentTasksListTasksForRepo.Input.Headers = .init() - ) { - self.path = path - self.query = query - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/headers`. - public struct Headers: Sendable, Hashable { - /// Pagination links. Contains rel="first" (always), - /// rel="prev" (when current page > 1), - /// rel="next" (when more pages exist), and rel="last" (when on the final page). - /// - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/headers/Link`. - public var link: Swift.String? - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - link: Pagination links. Contains rel="first" (always), - public init(link: Swift.String? = nil) { - self.link = link - } - } - /// Received HTTP response headers - public var headers: Operations.AgentTasksListTasksForRepo.Output.Ok.Headers - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload`. - public struct TasksPayloadPayload: Codable, Hashable, Sendable { - /// Unique task identifier - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/id`. - public var id: Swift.String - /// API URL for this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/url`. - public var url: Swift.String? - /// Web URL for this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/html_url`. - public var htmlUrl: Swift.String? - /// Human-readable name derived from the task prompt - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/name`. - public var name: Swift.String? - /// The entity who created this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/creator`. - @frozen public enum CreatorPayload: Codable, Hashable, Sendable { - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/creator/case1`. - public struct Case1Payload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/creator/case1/id`. - public var id: Swift.Int64? - /// Creates a new `Case1Payload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/creator/case1`. - case case1(Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.CreatorPayload.Case1Payload) - public init(from decoder: any Swift.Decoder) throws { - var errors: [any Swift.Error] = [] - do { - self = .case1(try .init(from: decoder)) - 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 value.encode(to: encoder) - } - } - } - /// The entity who created this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/creator`. - public var creator: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.CreatorPayload? - /// Type of the task creator - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/creator_type`. - @frozen public enum CreatorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { - case user = "user" - case organization = "organization" - } - /// Type of the task creator - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/creator_type`. - public var creatorType: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.CreatorTypePayload? - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/UserCollaboratorsPayload`. - public struct UserCollaboratorsPayloadPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/UserCollaboratorsPayload/id`. - public var id: Swift.Int64? - /// Creates a new `UserCollaboratorsPayloadPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// User objects of collaborators on this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/user_collaborators`. - public typealias UserCollaboratorsPayload = [Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.UserCollaboratorsPayloadPayload] - /// User objects of collaborators on this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/user_collaborators`. - @available(*, deprecated) - public var userCollaborators: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.UserCollaboratorsPayload? - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/owner`. - public struct OwnerPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/owner/id`. - public var id: Swift.Int64? - /// Creates a new `OwnerPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/owner`. - public var owner: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.OwnerPayload? - /// The repository this task belongs to - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/repository`. - public struct RepositoryPayload: Codable, Hashable, Sendable { - /// The unique identifier of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/repository/id`. - public var id: Swift.Int64? - /// Creates a new `RepositoryPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the repository - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The repository this task belongs to - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/repository`. - public var repository: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.RepositoryPayload? - /// Current state of the task, derived from its most recent session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/state`. - @frozen public enum StatePayload: String, Codable, Hashable, Sendable, CaseIterable { - case queued = "queued" - case inProgress = "in_progress" - case completed = "completed" - case failed = "failed" - case idle = "idle" - case waitingForUser = "waiting_for_user" - case timedOut = "timed_out" - case cancelled = "cancelled" - } - /// Current state of the task, derived from its most recent session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/state`. - public var state: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.StatePayload - /// Number of sessions in this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/session_count`. - public var sessionCount: Swift.Int32? - /// A resource generated by the task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload`. - public struct ArtifactsPayloadPayload: Codable, Hashable, Sendable { - /// Provider namespace - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/provider`. - @frozen public enum ProviderPayload: String, Codable, Hashable, Sendable, CaseIterable { - case github = "github" - } - /// Provider namespace - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/provider`. - public var provider: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.ProviderPayload - /// Type of artifact. Available Values: `pull`, `branch`. - /// - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/type`. - @frozen public enum _TypePayload: String, Codable, Hashable, Sendable, CaseIterable { - case pull = "pull" - case branch = "branch" - } - /// Type of artifact. Available Values: `pull`, `branch`. - /// - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/type`. - public var _type: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload._TypePayload - /// Resource data (shape depends on type) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data`. - @frozen public enum DataPayload: Codable, Hashable, Sendable { - /// A GitHub resource (pull request, issue, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case1`. - public struct Case1Payload: Codable, Hashable, Sendable { - /// GitHub resource ID - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case1/id`. - public var id: Swift.Int64 - /// GraphQL global ID - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case1/global_id`. - public var globalId: Swift.String? - /// Creates a new `Case1Payload`. - /// - /// - Parameters: - /// - id: GitHub resource ID - /// - globalId: GraphQL global ID - public init( - id: Swift.Int64, - globalId: Swift.String? = nil - ) { - self.id = id - self.globalId = globalId - } - public enum CodingKeys: String, CodingKey { - case id - case globalId = "global_id" - } - } - /// A GitHub resource (pull request, issue, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case1`. - case case1(Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.DataPayload.Case1Payload) - /// A Git branch reference - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case2`. - public struct Case2Payload: Codable, Hashable, Sendable { - /// Head branch name - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case2/head_ref`. - public var headRef: Swift.String - /// Base branch name - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case2/base_ref`. - public var baseRef: Swift.String - /// Creates a new `Case2Payload`. - /// - /// - Parameters: - /// - headRef: Head branch name - /// - baseRef: Base branch name - public init( - headRef: Swift.String, - baseRef: Swift.String - ) { - self.headRef = headRef - self.baseRef = baseRef - } - public enum CodingKeys: String, CodingKey { - case headRef = "head_ref" - case baseRef = "base_ref" - } - } - /// A Git branch reference - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case2`. - case case2(Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.DataPayload.Case2Payload) - public init(from decoder: any Swift.Decoder) throws { - var errors: [any Swift.Error] = [] - do { - self = .case1(try .init(from: decoder)) - return - } catch { - errors.append(error) - } - do { - self = .case2(try .init(from: decoder)) - 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 value.encode(to: encoder) - case let .case2(value): - try value.encode(to: encoder) - } - } - } - /// Resource data (shape depends on type) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data`. - public var data: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.DataPayload - /// Creates a new `ArtifactsPayloadPayload`. - /// - /// - Parameters: - /// - provider: Provider namespace - /// - _type: Type of artifact. Available Values: `pull`, `branch`. - /// - data: Resource data (shape depends on type) - public init( - provider: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.ProviderPayload, - _type: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload._TypePayload, - data: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.DataPayload - ) { - self.provider = provider - self._type = _type - self.data = data - } - public enum CodingKeys: String, CodingKey { - case provider - case _type = "type" - case data - } - } - /// Resources created by this task (PRs, branches, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/artifacts`. - public typealias ArtifactsPayload = [Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload] - /// Resources created by this task (PRs, branches, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/artifacts`. - public var artifacts: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayload? - /// Timestamp when the task was archived, null if not archived - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/archived_at`. - public var archivedAt: Foundation.Date? - /// Timestamp of the most recent update - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/updated_at`. - public var updatedAt: Foundation.Date? - /// Timestamp when the task was created - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/TasksPayload/created_at`. - public var createdAt: Foundation.Date - /// Creates a new `TasksPayloadPayload`. - /// - /// - Parameters: - /// - id: Unique task identifier - /// - url: API URL for this task - /// - htmlUrl: Web URL for this task - /// - name: Human-readable name derived from the task prompt - /// - creator: The entity who created this task - /// - creatorType: Type of the task creator - /// - userCollaborators: User objects of collaborators on this task - /// - owner: The owner of the repository - /// - repository: The repository this task belongs to - /// - state: Current state of the task, derived from its most recent session - /// - sessionCount: Number of sessions in this task - /// - artifacts: Resources created by this task (PRs, branches, etc.) - /// - archivedAt: Timestamp when the task was archived, null if not archived - /// - updatedAt: Timestamp of the most recent update - /// - createdAt: Timestamp when the task was created - public init( - id: Swift.String, - url: Swift.String? = nil, - htmlUrl: Swift.String? = nil, - name: Swift.String? = nil, - creator: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.CreatorPayload? = nil, - creatorType: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.CreatorTypePayload? = nil, - userCollaborators: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.UserCollaboratorsPayload? = nil, - owner: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.OwnerPayload? = nil, - repository: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.RepositoryPayload? = nil, - state: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.StatePayload, - sessionCount: Swift.Int32? = nil, - artifacts: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayload? = nil, - archivedAt: Foundation.Date? = nil, - updatedAt: Foundation.Date? = nil, - createdAt: Foundation.Date - ) { - self.id = id - self.url = url - self.htmlUrl = htmlUrl - self.name = name - self.creator = creator - self.creatorType = creatorType - self.userCollaborators = userCollaborators - self.owner = owner - self.repository = repository - self.state = state - self.sessionCount = sessionCount - self.artifacts = artifacts - self.archivedAt = archivedAt - self.updatedAt = updatedAt - self.createdAt = createdAt - } - public enum CodingKeys: String, CodingKey { - case id - case url - case htmlUrl = "html_url" - case name - case creator - case creatorType = "creator_type" - case userCollaborators = "user_collaborators" - case owner - case repository - case state - case sessionCount = "session_count" - case artifacts - case archivedAt = "archived_at" - case updatedAt = "updated_at" - case createdAt = "created_at" - } - } - /// List of tasks - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/tasks`. - public typealias TasksPayload = [Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayloadPayload] - /// List of tasks - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/tasks`. - public var tasks: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayload - /// Total count of active (non-archived) tasks - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/total_active_count`. - public var totalActiveCount: Swift.Int32? - /// Total count of archived tasks - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/json/total_archived_count`. - public var totalArchivedCount: Swift.Int32? - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - tasks: List of tasks - /// - totalActiveCount: Total count of active (non-archived) tasks - /// - totalArchivedCount: Total count of archived tasks - public init( - tasks: Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload.TasksPayload, - totalActiveCount: Swift.Int32? = nil, - totalArchivedCount: Swift.Int32? = nil - ) { - self.tasks = tasks - self.totalActiveCount = totalActiveCount - self.totalArchivedCount = totalArchivedCount - } - public enum CodingKeys: String, CodingKey { - case tasks - case totalActiveCount = "total_active_count" - case totalArchivedCount = "total_archived_count" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/200/content/application\/json`. - case json(Operations.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload) - /// 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.AgentTasksListTasksForRepo.Output.Ok.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksListTasksForRepo.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - headers: Received HTTP response headers - /// - body: Received HTTP response body - public init( - headers: Operations.AgentTasksListTasksForRepo.Output.Ok.Headers = .init(), - body: Operations.AgentTasksListTasksForRepo.Output.Ok.Body - ) { - self.headers = headers - self.body = body - } - } - /// Tasks retrieved successfully - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/get(agent-tasks/list-tasks-for-repo)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.AgentTasksListTasksForRepo.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.AgentTasksListTasksForRepo.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - public struct BadRequest: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/400/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/400/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/400/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/400/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/400/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/400/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksListTasksForRepo.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/400/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksListTasksForRepo.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/400/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksListTasksForRepo.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/400/content/json/errors`. - public var errors: Operations.AgentTasksListTasksForRepo.Output.BadRequest.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/400/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksListTasksForRepo.Output.BadRequest.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/400/content/application\/json`. - case json(Operations.AgentTasksListTasksForRepo.Output.BadRequest.Body.JsonPayload) - /// 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.AgentTasksListTasksForRepo.Output.BadRequest.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksListTasksForRepo.Output.BadRequest.Body - /// Creates a new `BadRequest`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksListTasksForRepo.Output.BadRequest.Body) { - self.body = body - } - } - /// Bad request - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/get(agent-tasks/list-tasks-for-repo)/responses/400`. - /// - /// HTTP response code: `400 badRequest`. - case badRequest(Operations.AgentTasksListTasksForRepo.Output.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: Operations.AgentTasksListTasksForRepo.Output.BadRequest { - get throws { - switch self { - case let .badRequest(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "badRequest", - response: self - ) - } - } - } - public struct Unauthorized: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/401/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/401/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/401/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/401/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/401/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/401/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksListTasksForRepo.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/401/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksListTasksForRepo.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/401/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksListTasksForRepo.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/401/content/json/errors`. - public var errors: Operations.AgentTasksListTasksForRepo.Output.Unauthorized.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/401/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksListTasksForRepo.Output.Unauthorized.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/401/content/application\/json`. - case json(Operations.AgentTasksListTasksForRepo.Output.Unauthorized.Body.JsonPayload) - /// 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.AgentTasksListTasksForRepo.Output.Unauthorized.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksListTasksForRepo.Output.Unauthorized.Body - /// Creates a new `Unauthorized`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksListTasksForRepo.Output.Unauthorized.Body) { - self.body = body - } - } - /// Authentication required - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/get(agent-tasks/list-tasks-for-repo)/responses/401`. - /// - /// HTTP response code: `401 unauthorized`. - case unauthorized(Operations.AgentTasksListTasksForRepo.Output.Unauthorized) - /// The associated value of the enum case if `self` is `.unauthorized`. - /// - /// - Throws: An error if `self` is not `.unauthorized`. - /// - SeeAlso: `.unauthorized`. - public var unauthorized: Operations.AgentTasksListTasksForRepo.Output.Unauthorized { - 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/agents/repos/{owner}/{repo}/tasks/GET/responses/403/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/403/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/403/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/403/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/403/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/403/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksListTasksForRepo.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/403/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksListTasksForRepo.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/403/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksListTasksForRepo.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/403/content/json/errors`. - public var errors: Operations.AgentTasksListTasksForRepo.Output.Forbidden.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/403/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksListTasksForRepo.Output.Forbidden.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/403/content/application\/json`. - case json(Operations.AgentTasksListTasksForRepo.Output.Forbidden.Body.JsonPayload) - /// 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.AgentTasksListTasksForRepo.Output.Forbidden.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksListTasksForRepo.Output.Forbidden.Body - /// Creates a new `Forbidden`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksListTasksForRepo.Output.Forbidden.Body) { - self.body = body - } - } - /// Insufficient permissions - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/get(agent-tasks/list-tasks-for-repo)/responses/403`. - /// - /// HTTP response code: `403 forbidden`. - case forbidden(Operations.AgentTasksListTasksForRepo.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: Operations.AgentTasksListTasksForRepo.Output.Forbidden { - get throws { - switch self { - case let .forbidden(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "forbidden", - response: self - ) - } - } - } - public struct NotFound: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/404/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/404/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/404/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/404/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/404/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/404/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksListTasksForRepo.Output.NotFound.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/404/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksListTasksForRepo.Output.NotFound.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/404/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksListTasksForRepo.Output.NotFound.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/404/content/json/errors`. - public var errors: Operations.AgentTasksListTasksForRepo.Output.NotFound.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/404/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksListTasksForRepo.Output.NotFound.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/404/content/application\/json`. - case json(Operations.AgentTasksListTasksForRepo.Output.NotFound.Body.JsonPayload) - /// 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.AgentTasksListTasksForRepo.Output.NotFound.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksListTasksForRepo.Output.NotFound.Body - /// Creates a new `NotFound`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksListTasksForRepo.Output.NotFound.Body) { - self.body = body - } - } - /// Resource not found - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/get(agent-tasks/list-tasks-for-repo)/responses/404`. - /// - /// HTTP response code: `404 notFound`. - case notFound(Operations.AgentTasksListTasksForRepo.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.AgentTasksListTasksForRepo.Output.NotFound { - get throws { - switch self { - case let .notFound(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "notFound", - response: self - ) - } - } - } - public struct UnprocessableContent: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/422/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/422/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/422/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/422/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/422/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/422/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/422/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/422/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/422/content/json/errors`. - public var errors: Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/422/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/GET/responses/422/content/application\/json`. - case json(Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent.Body.JsonPayload) - /// 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.AgentTasksListTasksForRepo.Output.UnprocessableContent.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent.Body - /// Creates a new `UnprocessableContent`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent.Body) { - self.body = body - } - } - /// Validation Failed - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/get(agent-tasks/list-tasks-for-repo)/responses/422`. - /// - /// HTTP response code: `422 unprocessableContent`. - case unprocessableContent(Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent) - /// The associated value of the enum case if `self` is `.unprocessableContent`. - /// - /// - Throws: An error if `self` is not `.unprocessableContent`. - /// - SeeAlso: `.unprocessableContent`. - public var unprocessableContent: Operations.AgentTasksListTasksForRepo.Output.UnprocessableContent { - get throws { - switch self { - case let .unprocessableContent(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "unprocessableContent", - 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 task - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Creates a new task for a repository. - /// - /// - /// - Remark: HTTP `POST /agents/repos/{owner}/{repo}/tasks`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/post(agent-tasks/create-task)`. - public enum AgentTasksCreateTask { - public static let id: Swift.String = "agent-tasks/create-task" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/path`. - public struct Path: Sendable, Hashable { - /// The account owner of the repository. The name is not case sensitive. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/path/owner`. - public var owner: Swift.String - /// The name of the repository. The name is not case sensitive. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/path/repo`. - public var repo: Swift.String - /// Creates a new `Path`. - /// - /// - Parameters: - /// - owner: The account owner of the repository. The name is not case sensitive. - /// - repo: The name of the repository. The name is not case sensitive. - public init( - owner: Swift.String, - repo: Swift.String - ) { - self.owner = owner - self.repo = repo - } - } - public var path: Operations.AgentTasksCreateTask.Input.Path - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/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.AgentTasksCreateTask.Input.Headers - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/requestBody`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/requestBody/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// The user's prompt for the agent - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/requestBody/json/prompt`. - public var prompt: Swift.String - /// The model to use for this task. The allowed models may change over time and depend on the user's GitHub Copilot plan and organization policies. Currently supported values: `claude-sonnet-4.6`, `claude-opus-4.6`, `gpt-5.2-codex`, `gpt-5.3-codex`, `gpt-5.4`, `claude-sonnet-4.5`, `claude-opus-4.5` - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/requestBody/json/model`. - public var model: Swift.String? - /// Whether to create a PR. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/requestBody/json/create_pull_request`. - public var createPullRequest: Swift.Bool? - /// Base ref for new branch/PR - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/requestBody/json/base_ref`. - public var baseRef: Swift.String? - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - prompt: The user's prompt for the agent - /// - model: The model to use for this task. The allowed models may change over time and depend on the user's GitHub Copilot plan and organization policies. Currently supported values: `claude-sonnet-4.6`, `claude-opus-4.6`, `gpt-5.2-codex`, `gpt-5.3-codex`, `gpt-5.4`, `claude-sonnet-4.5`, `claude-opus-4.5` - /// - createPullRequest: Whether to create a PR. - /// - baseRef: Base ref for new branch/PR - public init( - prompt: Swift.String, - model: Swift.String? = nil, - createPullRequest: Swift.Bool? = nil, - baseRef: Swift.String? = nil - ) { - self.prompt = prompt - self.model = model - self.createPullRequest = createPullRequest - self.baseRef = baseRef - } - public enum CodingKeys: String, CodingKey { - case prompt - case model - case createPullRequest = "create_pull_request" - case baseRef = "base_ref" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/requestBody/content/application\/json`. - case json(Operations.AgentTasksCreateTask.Input.Body.JsonPayload) - } - public var body: Operations.AgentTasksCreateTask.Input.Body - /// Creates a new `Input`. - /// - /// - Parameters: - /// - path: - /// - headers: - /// - body: - public init( - path: Operations.AgentTasksCreateTask.Input.Path, - headers: Operations.AgentTasksCreateTask.Input.Headers = .init(), - body: Operations.AgentTasksCreateTask.Input.Body - ) { - self.path = path - self.headers = headers - self.body = body - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Created: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Unique task identifier - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/id`. - public var id: Swift.String - /// API URL for this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/url`. - public var url: Swift.String? - /// Web URL for this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/html_url`. - public var htmlUrl: Swift.String? - /// Human-readable name derived from the task prompt - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/name`. - public var name: Swift.String? - /// The entity who created this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/creator`. - @frozen public enum CreatorPayload: Codable, Hashable, Sendable { - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/creator/case1`. - public struct Case1Payload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/creator/case1/id`. - public var id: Swift.Int64? - /// Creates a new `Case1Payload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/creator/case1`. - case case1(Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.CreatorPayload.Case1Payload) - public init(from decoder: any Swift.Decoder) throws { - var errors: [any Swift.Error] = [] - do { - self = .case1(try .init(from: decoder)) - 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 value.encode(to: encoder) - } - } - } - /// The entity who created this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/creator`. - public var creator: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.CreatorPayload? - /// Type of the task creator - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/creator_type`. - @frozen public enum CreatorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { - case user = "user" - case organization = "organization" - } - /// Type of the task creator - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/creator_type`. - public var creatorType: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.CreatorTypePayload? - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/UserCollaboratorsPayload`. - public struct UserCollaboratorsPayloadPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/UserCollaboratorsPayload/id`. - public var id: Swift.Int64? - /// Creates a new `UserCollaboratorsPayloadPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// User objects of collaborators on this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/user_collaborators`. - public typealias UserCollaboratorsPayload = [Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.UserCollaboratorsPayloadPayload] - /// User objects of collaborators on this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/user_collaborators`. - @available(*, deprecated) - public var userCollaborators: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.UserCollaboratorsPayload? - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/owner`. - public struct OwnerPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/owner/id`. - public var id: Swift.Int64? - /// Creates a new `OwnerPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/owner`. - public var owner: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.OwnerPayload? - /// The repository this task belongs to - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/repository`. - public struct RepositoryPayload: Codable, Hashable, Sendable { - /// The unique identifier of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/repository/id`. - public var id: Swift.Int64? - /// Creates a new `RepositoryPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the repository - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The repository this task belongs to - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/repository`. - public var repository: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.RepositoryPayload? - /// Current state of the task, derived from its most recent session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/state`. - @frozen public enum StatePayload: String, Codable, Hashable, Sendable, CaseIterable { - case queued = "queued" - case inProgress = "in_progress" - case completed = "completed" - case failed = "failed" - case idle = "idle" - case waitingForUser = "waiting_for_user" - case timedOut = "timed_out" - case cancelled = "cancelled" - } - /// Current state of the task, derived from its most recent session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/state`. - public var state: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.StatePayload - /// Number of sessions in this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/session_count`. - public var sessionCount: Swift.Int32? - /// A resource generated by the task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload`. - public struct ArtifactsPayloadPayload: Codable, Hashable, Sendable { - /// Provider namespace - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/provider`. - @frozen public enum ProviderPayload: String, Codable, Hashable, Sendable, CaseIterable { - case github = "github" - } - /// Provider namespace - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/provider`. - public var provider: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.ArtifactsPayloadPayload.ProviderPayload - /// Type of artifact. Available Values: `pull`, `branch`. - /// - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/type`. - @frozen public enum _TypePayload: String, Codable, Hashable, Sendable, CaseIterable { - case pull = "pull" - case branch = "branch" - } - /// Type of artifact. Available Values: `pull`, `branch`. - /// - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/type`. - public var _type: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.ArtifactsPayloadPayload._TypePayload - /// Resource data (shape depends on type) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/data`. - @frozen public enum DataPayload: Codable, Hashable, Sendable { - /// A GitHub resource (pull request, issue, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/data/case1`. - public struct Case1Payload: Codable, Hashable, Sendable { - /// GitHub resource ID - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/data/case1/id`. - public var id: Swift.Int64 - /// GraphQL global ID - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/data/case1/global_id`. - public var globalId: Swift.String? - /// Creates a new `Case1Payload`. - /// - /// - Parameters: - /// - id: GitHub resource ID - /// - globalId: GraphQL global ID - public init( - id: Swift.Int64, - globalId: Swift.String? = nil - ) { - self.id = id - self.globalId = globalId - } - public enum CodingKeys: String, CodingKey { - case id - case globalId = "global_id" - } - } - /// A GitHub resource (pull request, issue, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/data/case1`. - case case1(Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.ArtifactsPayloadPayload.DataPayload.Case1Payload) - /// A Git branch reference - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/data/case2`. - public struct Case2Payload: Codable, Hashable, Sendable { - /// Head branch name - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/data/case2/head_ref`. - public var headRef: Swift.String - /// Base branch name - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/data/case2/base_ref`. - public var baseRef: Swift.String - /// Creates a new `Case2Payload`. - /// - /// - Parameters: - /// - headRef: Head branch name - /// - baseRef: Base branch name - public init( - headRef: Swift.String, - baseRef: Swift.String - ) { - self.headRef = headRef - self.baseRef = baseRef - } - public enum CodingKeys: String, CodingKey { - case headRef = "head_ref" - case baseRef = "base_ref" - } - } - /// A Git branch reference - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/data/case2`. - case case2(Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.ArtifactsPayloadPayload.DataPayload.Case2Payload) - public init(from decoder: any Swift.Decoder) throws { - var errors: [any Swift.Error] = [] - do { - self = .case1(try .init(from: decoder)) - return - } catch { - errors.append(error) - } - do { - self = .case2(try .init(from: decoder)) - 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 value.encode(to: encoder) - case let .case2(value): - try value.encode(to: encoder) - } - } - } - /// Resource data (shape depends on type) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/ArtifactsPayload/data`. - public var data: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.ArtifactsPayloadPayload.DataPayload - /// Creates a new `ArtifactsPayloadPayload`. - /// - /// - Parameters: - /// - provider: Provider namespace - /// - _type: Type of artifact. Available Values: `pull`, `branch`. - /// - data: Resource data (shape depends on type) - public init( - provider: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.ArtifactsPayloadPayload.ProviderPayload, - _type: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.ArtifactsPayloadPayload._TypePayload, - data: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.ArtifactsPayloadPayload.DataPayload - ) { - self.provider = provider - self._type = _type - self.data = data - } - public enum CodingKeys: String, CodingKey { - case provider - case _type = "type" - case data - } - } - /// Resources created by this task (PRs, branches, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/artifacts`. - public typealias ArtifactsPayload = [Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.ArtifactsPayloadPayload] - /// Resources created by this task (PRs, branches, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/artifacts`. - public var artifacts: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.ArtifactsPayload? - /// Timestamp when the task was archived, null if not archived - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/archived_at`. - public var archivedAt: Foundation.Date? - /// Timestamp of the most recent update - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/updated_at`. - public var updatedAt: Foundation.Date? - /// Timestamp when the task was created - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/json/created_at`. - public var createdAt: Foundation.Date - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - id: Unique task identifier - /// - url: API URL for this task - /// - htmlUrl: Web URL for this task - /// - name: Human-readable name derived from the task prompt - /// - creator: The entity who created this task - /// - creatorType: Type of the task creator - /// - userCollaborators: User objects of collaborators on this task - /// - owner: The owner of the repository - /// - repository: The repository this task belongs to - /// - state: Current state of the task, derived from its most recent session - /// - sessionCount: Number of sessions in this task - /// - artifacts: Resources created by this task (PRs, branches, etc.) - /// - archivedAt: Timestamp when the task was archived, null if not archived - /// - updatedAt: Timestamp of the most recent update - /// - createdAt: Timestamp when the task was created - public init( - id: Swift.String, - url: Swift.String? = nil, - htmlUrl: Swift.String? = nil, - name: Swift.String? = nil, - creator: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.CreatorPayload? = nil, - creatorType: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.CreatorTypePayload? = nil, - userCollaborators: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.UserCollaboratorsPayload? = nil, - owner: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.OwnerPayload? = nil, - repository: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.RepositoryPayload? = nil, - state: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.StatePayload, - sessionCount: Swift.Int32? = nil, - artifacts: Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload.ArtifactsPayload? = nil, - archivedAt: Foundation.Date? = nil, - updatedAt: Foundation.Date? = nil, - createdAt: Foundation.Date - ) { - self.id = id - self.url = url - self.htmlUrl = htmlUrl - self.name = name - self.creator = creator - self.creatorType = creatorType - self.userCollaborators = userCollaborators - self.owner = owner - self.repository = repository - self.state = state - self.sessionCount = sessionCount - self.artifacts = artifacts - self.archivedAt = archivedAt - self.updatedAt = updatedAt - self.createdAt = createdAt - } - public enum CodingKeys: String, CodingKey { - case id - case url - case htmlUrl = "html_url" - case name - case creator - case creatorType = "creator_type" - case userCollaborators = "user_collaborators" - case owner - case repository - case state - case sessionCount = "session_count" - case artifacts - case archivedAt = "archived_at" - case updatedAt = "updated_at" - case createdAt = "created_at" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/201/content/application\/json`. - case json(Operations.AgentTasksCreateTask.Output.Created.Body.JsonPayload) - /// 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.AgentTasksCreateTask.Output.Created.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksCreateTask.Output.Created.Body - /// Creates a new `Created`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksCreateTask.Output.Created.Body) { - self.body = body - } - } - /// Task created successfully - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/post(agent-tasks/create-task)/responses/201`. - /// - /// HTTP response code: `201 created`. - case created(Operations.AgentTasksCreateTask.Output.Created) - /// The associated value of the enum case if `self` is `.created`. - /// - /// - Throws: An error if `self` is not `.created`. - /// - SeeAlso: `.created`. - public var created: Operations.AgentTasksCreateTask.Output.Created { - get throws { - switch self { - case let .created(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "created", - response: self - ) - } - } - } - public struct BadRequest: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/400/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/400/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/400/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/400/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/400/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/400/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksCreateTask.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/400/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksCreateTask.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/400/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksCreateTask.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/400/content/json/errors`. - public var errors: Operations.AgentTasksCreateTask.Output.BadRequest.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/400/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksCreateTask.Output.BadRequest.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/400/content/application\/json`. - case json(Operations.AgentTasksCreateTask.Output.BadRequest.Body.JsonPayload) - /// 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.AgentTasksCreateTask.Output.BadRequest.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksCreateTask.Output.BadRequest.Body - /// Creates a new `BadRequest`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksCreateTask.Output.BadRequest.Body) { - self.body = body - } - } - /// Problems parsing JSON - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/post(agent-tasks/create-task)/responses/400`. - /// - /// HTTP response code: `400 badRequest`. - case badRequest(Operations.AgentTasksCreateTask.Output.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: Operations.AgentTasksCreateTask.Output.BadRequest { - get throws { - switch self { - case let .badRequest(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "badRequest", - response: self - ) - } - } - } - public struct Unauthorized: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/401/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/401/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/401/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/401/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/401/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/401/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksCreateTask.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/401/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksCreateTask.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/401/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksCreateTask.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/401/content/json/errors`. - public var errors: Operations.AgentTasksCreateTask.Output.Unauthorized.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/401/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksCreateTask.Output.Unauthorized.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/401/content/application\/json`. - case json(Operations.AgentTasksCreateTask.Output.Unauthorized.Body.JsonPayload) - /// 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.AgentTasksCreateTask.Output.Unauthorized.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksCreateTask.Output.Unauthorized.Body - /// Creates a new `Unauthorized`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksCreateTask.Output.Unauthorized.Body) { - self.body = body - } - } - /// Authentication required - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/post(agent-tasks/create-task)/responses/401`. - /// - /// HTTP response code: `401 unauthorized`. - case unauthorized(Operations.AgentTasksCreateTask.Output.Unauthorized) - /// The associated value of the enum case if `self` is `.unauthorized`. - /// - /// - Throws: An error if `self` is not `.unauthorized`. - /// - SeeAlso: `.unauthorized`. - public var unauthorized: Operations.AgentTasksCreateTask.Output.Unauthorized { - 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/agents/repos/{owner}/{repo}/tasks/POST/responses/403/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/403/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/403/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/403/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/403/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/403/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksCreateTask.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/403/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksCreateTask.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/403/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksCreateTask.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/403/content/json/errors`. - public var errors: Operations.AgentTasksCreateTask.Output.Forbidden.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/403/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksCreateTask.Output.Forbidden.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/403/content/application\/json`. - case json(Operations.AgentTasksCreateTask.Output.Forbidden.Body.JsonPayload) - /// 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.AgentTasksCreateTask.Output.Forbidden.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksCreateTask.Output.Forbidden.Body - /// Creates a new `Forbidden`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksCreateTask.Output.Forbidden.Body) { - self.body = body - } - } - /// Insufficient permissions - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/post(agent-tasks/create-task)/responses/403`. - /// - /// HTTP response code: `403 forbidden`. - case forbidden(Operations.AgentTasksCreateTask.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: Operations.AgentTasksCreateTask.Output.Forbidden { - get throws { - switch self { - case let .forbidden(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "forbidden", - response: self - ) - } - } - } - public struct UnprocessableContent: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/422/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/422/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/422/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/422/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/422/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/422/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksCreateTask.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/422/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksCreateTask.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/422/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksCreateTask.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/422/content/json/errors`. - public var errors: Operations.AgentTasksCreateTask.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/422/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksCreateTask.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/POST/responses/422/content/application\/json`. - case json(Operations.AgentTasksCreateTask.Output.UnprocessableContent.Body.JsonPayload) - /// 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.AgentTasksCreateTask.Output.UnprocessableContent.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksCreateTask.Output.UnprocessableContent.Body - /// Creates a new `UnprocessableContent`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksCreateTask.Output.UnprocessableContent.Body) { - self.body = body - } - } - /// Validation Failed - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/post(agent-tasks/create-task)/responses/422`. - /// - /// HTTP response code: `422 unprocessableContent`. - case unprocessableContent(Operations.AgentTasksCreateTask.Output.UnprocessableContent) - /// The associated value of the enum case if `self` is `.unprocessableContent`. - /// - /// - Throws: An error if `self` is not `.unprocessableContent`. - /// - SeeAlso: `.unprocessableContent`. - public var unprocessableContent: Operations.AgentTasksCreateTask.Output.UnprocessableContent { - get throws { - switch self { - case let .unprocessableContent(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "unprocessableContent", - 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 - ] - } - } - } - /// Get a task by repo - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a task by ID scoped to an owner/repo path - /// - /// - /// - Remark: HTTP `GET /agents/repos/{owner}/{repo}/tasks/{task_id}`. - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/{task_id}/get(agent-tasks/get-task-by-repo-and-id)`. - public enum AgentTasksGetTaskByRepoAndId { - public static let id: Swift.String = "agent-tasks/get-task-by-repo-and-id" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/path`. - public struct Path: Sendable, Hashable { - /// The account owner of the repository. The name is not case sensitive. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/path/owner`. - public var owner: Swift.String - /// The name of the repository. The name is not case sensitive. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/path/repo`. - public var repo: Swift.String - /// The unique identifier of the task. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/path/task_id`. - public var taskId: Swift.String - /// Creates a new `Path`. - /// - /// - Parameters: - /// - owner: The account owner of the repository. The name is not case sensitive. - /// - repo: The name of the repository. The name is not case sensitive. - /// - taskId: The unique identifier of the task. - public init( - owner: Swift.String, - repo: Swift.String, - taskId: Swift.String - ) { - self.owner = owner - self.repo = repo - self.taskId = taskId - } - } - public var path: Operations.AgentTasksGetTaskByRepoAndId.Input.Path - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/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.AgentTasksGetTaskByRepoAndId.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - path: - /// - headers: - public init( - path: Operations.AgentTasksGetTaskByRepoAndId.Input.Path, - headers: Operations.AgentTasksGetTaskByRepoAndId.Input.Headers = .init() - ) { - self.path = path - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1`. - public struct Value1Payload: Codable, Hashable, Sendable { - /// Unique task identifier - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/id`. - public var id: Swift.String - /// API URL for this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/url`. - public var url: Swift.String? - /// Web URL for this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/html_url`. - public var htmlUrl: Swift.String? - /// Human-readable name derived from the task prompt - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/name`. - public var name: Swift.String? - /// The entity who created this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/creator`. - @frozen public enum CreatorPayload: Codable, Hashable, Sendable { - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/creator/case1`. - public struct Case1Payload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/creator/case1/id`. - public var id: Swift.Int64? - /// Creates a new `Case1Payload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/creator/case1`. - case case1(Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.CreatorPayload.Case1Payload) - public init(from decoder: any Swift.Decoder) throws { - var errors: [any Swift.Error] = [] - do { - self = .case1(try .init(from: decoder)) - 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 value.encode(to: encoder) - } - } - } - /// The entity who created this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/creator`. - public var creator: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.CreatorPayload? - /// Type of the task creator - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/creator_type`. - @frozen public enum CreatorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { - case user = "user" - case organization = "organization" - } - /// Type of the task creator - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/creator_type`. - public var creatorType: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.CreatorTypePayload? - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/UserCollaboratorsPayload`. - public struct UserCollaboratorsPayloadPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/UserCollaboratorsPayload/id`. - public var id: Swift.Int64? - /// Creates a new `UserCollaboratorsPayloadPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// User objects of collaborators on this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/user_collaborators`. - public typealias UserCollaboratorsPayload = [Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.UserCollaboratorsPayloadPayload] - /// User objects of collaborators on this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/user_collaborators`. - @available(*, deprecated) - public var userCollaborators: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.UserCollaboratorsPayload? - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/owner`. - public struct OwnerPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/owner/id`. - public var id: Swift.Int64? - /// Creates a new `OwnerPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/owner`. - public var owner: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.OwnerPayload? - /// The repository this task belongs to - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/repository`. - public struct RepositoryPayload: Codable, Hashable, Sendable { - /// The unique identifier of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/repository/id`. - public var id: Swift.Int64? - /// Creates a new `RepositoryPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the repository - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The repository this task belongs to - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/repository`. - public var repository: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.RepositoryPayload? - /// Current state of the task, derived from its most recent session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/state`. - @frozen public enum StatePayload: String, Codable, Hashable, Sendable, CaseIterable { - case queued = "queued" - case inProgress = "in_progress" - case completed = "completed" - case failed = "failed" - case idle = "idle" - case waitingForUser = "waiting_for_user" - case timedOut = "timed_out" - case cancelled = "cancelled" - } - /// Current state of the task, derived from its most recent session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/state`. - public var state: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.StatePayload - /// Number of sessions in this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/session_count`. - public var sessionCount: Swift.Int32? - /// A resource generated by the task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload`. - public struct ArtifactsPayloadPayload: Codable, Hashable, Sendable { - /// Provider namespace - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/provider`. - @frozen public enum ProviderPayload: String, Codable, Hashable, Sendable, CaseIterable { - case github = "github" - } - /// Provider namespace - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/provider`. - public var provider: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.ProviderPayload - /// Type of artifact. Available Values: `pull`, `branch`. - /// - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/type`. - @frozen public enum _TypePayload: String, Codable, Hashable, Sendable, CaseIterable { - case pull = "pull" - case branch = "branch" - } - /// Type of artifact. Available Values: `pull`, `branch`. - /// - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/type`. - public var _type: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload._TypePayload - /// Resource data (shape depends on type) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data`. - @frozen public enum DataPayload: Codable, Hashable, Sendable { - /// A GitHub resource (pull request, issue, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case1`. - public struct Case1Payload: Codable, Hashable, Sendable { - /// GitHub resource ID - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case1/id`. - public var id: Swift.Int64 - /// GraphQL global ID - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case1/global_id`. - public var globalId: Swift.String? - /// Creates a new `Case1Payload`. - /// - /// - Parameters: - /// - id: GitHub resource ID - /// - globalId: GraphQL global ID - public init( - id: Swift.Int64, - globalId: Swift.String? = nil - ) { - self.id = id - self.globalId = globalId - } - public enum CodingKeys: String, CodingKey { - case id - case globalId = "global_id" - } - } - /// A GitHub resource (pull request, issue, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case1`. - case case1(Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.DataPayload.Case1Payload) - /// A Git branch reference - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case2`. - public struct Case2Payload: Codable, Hashable, Sendable { - /// Head branch name - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case2/head_ref`. - public var headRef: Swift.String - /// Base branch name - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case2/base_ref`. - public var baseRef: Swift.String - /// Creates a new `Case2Payload`. - /// - /// - Parameters: - /// - headRef: Head branch name - /// - baseRef: Base branch name - public init( - headRef: Swift.String, - baseRef: Swift.String - ) { - self.headRef = headRef - self.baseRef = baseRef - } - public enum CodingKeys: String, CodingKey { - case headRef = "head_ref" - case baseRef = "base_ref" - } - } - /// A Git branch reference - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case2`. - case case2(Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.DataPayload.Case2Payload) - public init(from decoder: any Swift.Decoder) throws { - var errors: [any Swift.Error] = [] - do { - self = .case1(try .init(from: decoder)) - return - } catch { - errors.append(error) - } - do { - self = .case2(try .init(from: decoder)) - 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 value.encode(to: encoder) - case let .case2(value): - try value.encode(to: encoder) - } - } - } - /// Resource data (shape depends on type) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data`. - public var data: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.DataPayload - /// Creates a new `ArtifactsPayloadPayload`. - /// - /// - Parameters: - /// - provider: Provider namespace - /// - _type: Type of artifact. Available Values: `pull`, `branch`. - /// - data: Resource data (shape depends on type) - public init( - provider: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.ProviderPayload, - _type: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload._TypePayload, - data: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.DataPayload - ) { - self.provider = provider - self._type = _type - self.data = data - } - public enum CodingKeys: String, CodingKey { - case provider - case _type = "type" - case data - } - } - /// Resources created by this task (PRs, branches, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/artifacts`. - public typealias ArtifactsPayload = [Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload] - /// Resources created by this task (PRs, branches, etc.) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/artifacts`. - public var artifacts: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayload? - /// Timestamp when the task was archived, null if not archived - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/archived_at`. - public var archivedAt: Foundation.Date? - /// Timestamp of the most recent update - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/updated_at`. - public var updatedAt: Foundation.Date? - /// Timestamp when the task was created - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1/created_at`. - public var createdAt: Foundation.Date - /// Creates a new `Value1Payload`. - /// - /// - Parameters: - /// - id: Unique task identifier - /// - url: API URL for this task - /// - htmlUrl: Web URL for this task - /// - name: Human-readable name derived from the task prompt - /// - creator: The entity who created this task - /// - creatorType: Type of the task creator - /// - userCollaborators: User objects of collaborators on this task - /// - owner: The owner of the repository - /// - repository: The repository this task belongs to - /// - state: Current state of the task, derived from its most recent session - /// - sessionCount: Number of sessions in this task - /// - artifacts: Resources created by this task (PRs, branches, etc.) - /// - archivedAt: Timestamp when the task was archived, null if not archived - /// - updatedAt: Timestamp of the most recent update - /// - createdAt: Timestamp when the task was created - public init( - id: Swift.String, - url: Swift.String? = nil, - htmlUrl: Swift.String? = nil, - name: Swift.String? = nil, - creator: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.CreatorPayload? = nil, - creatorType: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.CreatorTypePayload? = nil, - userCollaborators: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.UserCollaboratorsPayload? = nil, - owner: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.OwnerPayload? = nil, - repository: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.RepositoryPayload? = nil, - state: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.StatePayload, - sessionCount: Swift.Int32? = nil, - artifacts: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayload? = nil, - archivedAt: Foundation.Date? = nil, - updatedAt: Foundation.Date? = nil, - createdAt: Foundation.Date - ) { - self.id = id - self.url = url - self.htmlUrl = htmlUrl - self.name = name - self.creator = creator - self.creatorType = creatorType - self.userCollaborators = userCollaborators - self.owner = owner - self.repository = repository - self.state = state - self.sessionCount = sessionCount - self.artifacts = artifacts - self.archivedAt = archivedAt - self.updatedAt = updatedAt - self.createdAt = createdAt - } - public enum CodingKeys: String, CodingKey { - case id - case url - case htmlUrl = "html_url" - case name - case creator - case creatorType = "creator_type" - case userCollaborators = "user_collaborators" - case owner - case repository - case state - case sessionCount = "session_count" - case artifacts - case archivedAt = "archived_at" - case updatedAt = "updated_at" - case createdAt = "created_at" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value1`. - public var value1: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2`. - public struct Value2Payload: Codable, Hashable, Sendable { - /// Full session details within a task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload`. - public struct SessionsPayloadPayload: Codable, Hashable, Sendable { - /// Session ID - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/id`. - public var id: Swift.String - /// Session name - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/name`. - public var name: Swift.String? - /// The user who created this session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/user`. - public struct UserPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/user/id`. - public var id: Swift.Int64? - /// Creates a new `UserPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The user who created this session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/user`. - public var user: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.UserPayload? - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/owner`. - public struct OwnerPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/owner/id`. - public var id: Swift.Int64? - /// Creates a new `OwnerPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/owner`. - public var owner: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.OwnerPayload? - /// The repository this session belongs to - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/repository`. - public struct RepositoryPayload: Codable, Hashable, Sendable { - /// The unique identifier of the repository - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/repository/id`. - public var id: Swift.Int64? - /// Creates a new `RepositoryPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the repository - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The repository this session belongs to - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/repository`. - public var repository: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.RepositoryPayload? - /// Task ID this session belongs to - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/task_id`. - public var taskId: Swift.String? - /// Current state of a session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/state`. - @frozen public enum StatePayload: String, Codable, Hashable, Sendable, CaseIterable { - case queued = "queued" - case inProgress = "in_progress" - case completed = "completed" - case failed = "failed" - case idle = "idle" - case waitingForUser = "waiting_for_user" - case timedOut = "timed_out" - case cancelled = "cancelled" - } - /// Current state of a session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/state`. - public var state: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.StatePayload - /// Creation timestamp - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/created_at`. - public var createdAt: Foundation.Date - /// Last update timestamp - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/updated_at`. - public var updatedAt: Foundation.Date? - /// Completion timestamp - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/completed_at`. - public var completedAt: Foundation.Date? - /// Content of the triggering event - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/prompt`. - public var prompt: Swift.String? - /// Head branch name - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/head_ref`. - public var headRef: Swift.String? - /// Base branch name - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/base_ref`. - public var baseRef: Swift.String? - /// Model used for this session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/model`. - public var model: Swift.String? - /// Error details for a failed session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/error`. - public struct _ErrorPayload: Codable, Hashable, Sendable { - /// Error message - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/error/message`. - public var message: Swift.String? - /// Creates a new `_ErrorPayload`. - /// - /// - Parameters: - /// - message: Error message - public init(message: Swift.String? = nil) { - self.message = message - } - public enum CodingKeys: String, CodingKey { - case message - } - } - /// Error details for a failed session - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/error`. - public var error: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload._ErrorPayload? - /// Creates a new `SessionsPayloadPayload`. - /// - /// - Parameters: - /// - id: Session ID - /// - name: Session name - /// - user: The user who created this session - /// - owner: The owner of the repository - /// - repository: The repository this session belongs to - /// - taskId: Task ID this session belongs to - /// - state: Current state of a session - /// - createdAt: Creation timestamp - /// - updatedAt: Last update timestamp - /// - completedAt: Completion timestamp - /// - prompt: Content of the triggering event - /// - headRef: Head branch name - /// - baseRef: Base branch name - /// - model: Model used for this session - /// - error: Error details for a failed session - public init( - id: Swift.String, - name: Swift.String? = nil, - user: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.UserPayload? = nil, - owner: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.OwnerPayload? = nil, - repository: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.RepositoryPayload? = nil, - taskId: Swift.String? = nil, - state: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.StatePayload, - createdAt: Foundation.Date, - updatedAt: Foundation.Date? = nil, - completedAt: Foundation.Date? = nil, - prompt: Swift.String? = nil, - headRef: Swift.String? = nil, - baseRef: Swift.String? = nil, - model: Swift.String? = nil, - error: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload._ErrorPayload? = nil - ) { - self.id = id - self.name = name - self.user = user - self.owner = owner - self.repository = repository - self.taskId = taskId - self.state = state - self.createdAt = createdAt - self.updatedAt = updatedAt - self.completedAt = completedAt - self.prompt = prompt - self.headRef = headRef - self.baseRef = baseRef - self.model = model - self.error = error - } - public enum CodingKeys: String, CodingKey { - case id - case name - case user - case owner - case repository - case taskId = "task_id" - case state - case createdAt = "created_at" - case updatedAt = "updated_at" - case completedAt = "completed_at" - case prompt - case headRef = "head_ref" - case baseRef = "base_ref" - case model - case error - } - } - /// Sessions associated with this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/sessions`. - public typealias SessionsPayload = [Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload] - /// Sessions associated with this task - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2/sessions`. - public var sessions: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayload? - /// Creates a new `Value2Payload`. - /// - /// - Parameters: - /// - sessions: Sessions associated with this task - public init(sessions: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayload? = nil) { - self.sessions = sessions - } - public enum CodingKeys: String, CodingKey { - case sessions - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/json/value2`. - public var value2: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - value1: - /// - value2: - public init( - value1: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value1Payload, - value2: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload.Value2Payload - ) { - self.value1 = value1 - self.value2 = value2 - } - public init(from decoder: any Swift.Decoder) throws { - self.value1 = try .init(from: decoder) - self.value2 = try .init(from: decoder) - } - public func encode(to encoder: any Swift.Encoder) throws { - try self.value1.encode(to: encoder) - try self.value2.encode(to: encoder) - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/200/content/application\/json`. - case json(Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload) - /// 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.AgentTasksGetTaskByRepoAndId.Output.Ok.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskByRepoAndId.Output.Ok.Body) { - self.body = body - } - } - /// Task retrieved successfully - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/{task_id}/get(agent-tasks/get-task-by-repo-and-id)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.AgentTasksGetTaskByRepoAndId.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.AgentTasksGetTaskByRepoAndId.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - public struct BadRequest: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/400/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/400/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/400/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/400/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/400/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/400/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksGetTaskByRepoAndId.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/400/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksGetTaskByRepoAndId.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/400/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksGetTaskByRepoAndId.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/400/content/json/errors`. - public var errors: Operations.AgentTasksGetTaskByRepoAndId.Output.BadRequest.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/400/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksGetTaskByRepoAndId.Output.BadRequest.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/400/content/application\/json`. - case json(Operations.AgentTasksGetTaskByRepoAndId.Output.BadRequest.Body.JsonPayload) - /// 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.AgentTasksGetTaskByRepoAndId.Output.BadRequest.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskByRepoAndId.Output.BadRequest.Body - /// Creates a new `BadRequest`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskByRepoAndId.Output.BadRequest.Body) { - self.body = body - } - } - /// Bad request - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/{task_id}/get(agent-tasks/get-task-by-repo-and-id)/responses/400`. - /// - /// HTTP response code: `400 badRequest`. - case badRequest(Operations.AgentTasksGetTaskByRepoAndId.Output.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: Operations.AgentTasksGetTaskByRepoAndId.Output.BadRequest { - get throws { - switch self { - case let .badRequest(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "badRequest", - response: self - ) - } - } - } - public struct Unauthorized: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/401/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/401/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/401/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/401/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/401/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/401/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/401/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/401/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/401/content/json/errors`. - public var errors: Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/401/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/401/content/application\/json`. - case json(Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized.Body.JsonPayload) - /// 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.AgentTasksGetTaskByRepoAndId.Output.Unauthorized.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized.Body - /// Creates a new `Unauthorized`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized.Body) { - self.body = body - } - } - /// Authentication required - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/{task_id}/get(agent-tasks/get-task-by-repo-and-id)/responses/401`. - /// - /// HTTP response code: `401 unauthorized`. - case unauthorized(Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized) - /// The associated value of the enum case if `self` is `.unauthorized`. - /// - /// - Throws: An error if `self` is not `.unauthorized`. - /// - SeeAlso: `.unauthorized`. - public var unauthorized: Operations.AgentTasksGetTaskByRepoAndId.Output.Unauthorized { - 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/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/403/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/403/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/403/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/403/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/403/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/403/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksGetTaskByRepoAndId.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/403/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksGetTaskByRepoAndId.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/403/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksGetTaskByRepoAndId.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/403/content/json/errors`. - public var errors: Operations.AgentTasksGetTaskByRepoAndId.Output.Forbidden.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/403/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksGetTaskByRepoAndId.Output.Forbidden.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/403/content/application\/json`. - case json(Operations.AgentTasksGetTaskByRepoAndId.Output.Forbidden.Body.JsonPayload) - /// 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.AgentTasksGetTaskByRepoAndId.Output.Forbidden.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskByRepoAndId.Output.Forbidden.Body - /// Creates a new `Forbidden`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskByRepoAndId.Output.Forbidden.Body) { - self.body = body - } - } - /// Insufficient permissions - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/{task_id}/get(agent-tasks/get-task-by-repo-and-id)/responses/403`. - /// - /// HTTP response code: `403 forbidden`. - case forbidden(Operations.AgentTasksGetTaskByRepoAndId.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: Operations.AgentTasksGetTaskByRepoAndId.Output.Forbidden { - get throws { - switch self { - case let .forbidden(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "forbidden", - response: self - ) - } - } - } - public struct NotFound: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/404/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/404/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/404/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/404/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/404/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/404/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksGetTaskByRepoAndId.Output.NotFound.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/404/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksGetTaskByRepoAndId.Output.NotFound.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/404/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksGetTaskByRepoAndId.Output.NotFound.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/404/content/json/errors`. - public var errors: Operations.AgentTasksGetTaskByRepoAndId.Output.NotFound.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/404/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksGetTaskByRepoAndId.Output.NotFound.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/404/content/application\/json`. - case json(Operations.AgentTasksGetTaskByRepoAndId.Output.NotFound.Body.JsonPayload) - /// 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.AgentTasksGetTaskByRepoAndId.Output.NotFound.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskByRepoAndId.Output.NotFound.Body - /// Creates a new `NotFound`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskByRepoAndId.Output.NotFound.Body) { - self.body = body - } - } - /// Resource not found - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/{task_id}/get(agent-tasks/get-task-by-repo-and-id)/responses/404`. - /// - /// HTTP response code: `404 notFound`. - case notFound(Operations.AgentTasksGetTaskByRepoAndId.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.AgentTasksGetTaskByRepoAndId.Output.NotFound { - get throws { - switch self { - case let .notFound(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "notFound", - response: self - ) - } - } - } - public struct UnprocessableContent: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/422/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/422/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/422/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/422/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/422/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/422/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/422/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/422/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/422/content/json/errors`. - public var errors: Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/422/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/repos/{owner}/{repo}/tasks/{task_id}/GET/responses/422/content/application\/json`. - case json(Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent.Body.JsonPayload) - /// 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.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent.Body - /// Creates a new `UnprocessableContent`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent.Body) { - self.body = body - } - } - /// Validation Failed - /// - /// - Remark: Generated from `#/paths//agents/repos/{owner}/{repo}/tasks/{task_id}/get(agent-tasks/get-task-by-repo-and-id)/responses/422`. - /// - /// HTTP response code: `422 unprocessableContent`. - case unprocessableContent(Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent) - /// The associated value of the enum case if `self` is `.unprocessableContent`. - /// - /// - Throws: An error if `self` is not `.unprocessableContent`. - /// - SeeAlso: `.unprocessableContent`. - public var unprocessableContent: Operations.AgentTasksGetTaskByRepoAndId.Output.UnprocessableContent { - get throws { - switch self { - case let .unprocessableContent(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "unprocessableContent", - 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 tasks - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a list of tasks for the authenticated user - /// - /// - /// - Remark: HTTP `GET /agents/tasks`. - /// - Remark: Generated from `#/paths//agents/tasks/get(agent-tasks/list-tasks)`. - public enum AgentTasksListTasks { - public static let id: Swift.String = "agent-tasks/list-tasks" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/GET/query`. - public struct Query: Sendable, Hashable { - /// The number of results per page (max 100). - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/query/per_page`. - public var perPage: Swift.Int? - /// The page number of the results to fetch. - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/query/page`. - public var page: Swift.Int? - /// - Remark: Generated from `#/paths/agents/tasks/GET/query/sort`. - @frozen public enum SortPayload: String, Codable, Hashable, Sendable, CaseIterable { - case updatedAt = "updated_at" - case createdAt = "created_at" - } - /// The field to sort results by. Can be `updated_at` or `created_at`. - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/query/sort`. - public var sort: Operations.AgentTasksListTasks.Input.Query.SortPayload? - /// - Remark: Generated from `#/paths/agents/tasks/GET/query/direction`. - @frozen public enum DirectionPayload: String, Codable, Hashable, Sendable, CaseIterable { - case asc = "asc" - case desc = "desc" - } - /// The direction to sort results. Can be `asc` or `desc`. - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/query/direction`. - public var direction: Operations.AgentTasksListTasks.Input.Query.DirectionPayload? - /// Comma-separated list of task states to filter by. Can be any combination of: `queued`, `in_progress`, `completed`, `failed`, `idle`, `waiting_for_user`, `timed_out`, `cancelled`. - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/query/state`. - public var state: Swift.String? - /// Filter by archived status. When `true`, returns only archived tasks. When `false` or omitted, returns only non-archived tasks. Defaults to `false`. - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/query/is_archived`. - public var isArchived: Swift.Bool? - /// Only show tasks updated at or after this time (ISO 8601 timestamp) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/query/since`. - public var since: Foundation.Date? - /// Creates a new `Query`. - /// - /// - Parameters: - /// - perPage: The number of results per page (max 100). - /// - page: The page number of the results to fetch. - /// - sort: The field to sort results by. Can be `updated_at` or `created_at`. - /// - direction: The direction to sort results. Can be `asc` or `desc`. - /// - state: Comma-separated list of task states to filter by. Can be any combination of: `queued`, `in_progress`, `completed`, `failed`, `idle`, `waiting_for_user`, `timed_out`, `cancelled`. - /// - isArchived: Filter by archived status. When `true`, returns only archived tasks. When `false` or omitted, returns only non-archived tasks. Defaults to `false`. - /// - since: Only show tasks updated at or after this time (ISO 8601 timestamp) - public init( - perPage: Swift.Int? = nil, - page: Swift.Int? = nil, - sort: Operations.AgentTasksListTasks.Input.Query.SortPayload? = nil, - direction: Operations.AgentTasksListTasks.Input.Query.DirectionPayload? = nil, - state: Swift.String? = nil, - isArchived: Swift.Bool? = nil, - since: Foundation.Date? = nil - ) { - self.perPage = perPage - self.page = page - self.sort = sort - self.direction = direction - self.state = state - self.isArchived = isArchived - self.since = since - } - } - public var query: Operations.AgentTasksListTasks.Input.Query - /// - Remark: Generated from `#/paths/agents/tasks/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.AgentTasksListTasks.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - query: - /// - headers: - public init( - query: Operations.AgentTasksListTasks.Input.Query = .init(), - headers: Operations.AgentTasksListTasks.Input.Headers = .init() - ) { - self.query = query - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/headers`. - public struct Headers: Sendable, Hashable { - /// Pagination links. Contains rel="first" (always), - /// rel="next" (when more pages exist), and rel="last" (when on the final page). - /// - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/headers/Link`. - public var link: Swift.String? - /// Creates a new `Headers`. - /// - /// - Parameters: - /// - link: Pagination links. Contains rel="first" (always), - public init(link: Swift.String? = nil) { - self.link = link - } - } - /// Received HTTP response headers - public var headers: Operations.AgentTasksListTasks.Output.Ok.Headers - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload`. - public struct TasksPayloadPayload: Codable, Hashable, Sendable { - /// Unique task identifier - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/id`. - public var id: Swift.String - /// API URL for this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/url`. - public var url: Swift.String? - /// Web URL for this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/html_url`. - public var htmlUrl: Swift.String? - /// Human-readable name derived from the task prompt - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/name`. - public var name: Swift.String? - /// The entity who created this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/creator`. - @frozen public enum CreatorPayload: Codable, Hashable, Sendable { - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/creator/case1`. - public struct Case1Payload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/creator/case1/id`. - public var id: Swift.Int64? - /// Creates a new `Case1Payload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/creator/case1`. - case case1(Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.CreatorPayload.Case1Payload) - public init(from decoder: any Swift.Decoder) throws { - var errors: [any Swift.Error] = [] - do { - self = .case1(try .init(from: decoder)) - 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 value.encode(to: encoder) - } - } - } - /// The entity who created this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/creator`. - public var creator: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.CreatorPayload? - /// Type of the task creator - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/creator_type`. - @frozen public enum CreatorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { - case user = "user" - case organization = "organization" - } - /// Type of the task creator - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/creator_type`. - public var creatorType: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.CreatorTypePayload? - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/UserCollaboratorsPayload`. - public struct UserCollaboratorsPayloadPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/UserCollaboratorsPayload/id`. - public var id: Swift.Int64? - /// Creates a new `UserCollaboratorsPayloadPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// User objects of collaborators on this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/user_collaborators`. - public typealias UserCollaboratorsPayload = [Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.UserCollaboratorsPayloadPayload] - /// User objects of collaborators on this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/user_collaborators`. - @available(*, deprecated) - public var userCollaborators: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.UserCollaboratorsPayload? - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/owner`. - public struct OwnerPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/owner/id`. - public var id: Swift.Int64? - /// Creates a new `OwnerPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/owner`. - public var owner: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.OwnerPayload? - /// The repository this task belongs to - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/repository`. - public struct RepositoryPayload: Codable, Hashable, Sendable { - /// The unique identifier of the repository - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/repository/id`. - public var id: Swift.Int64? - /// Creates a new `RepositoryPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the repository - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The repository this task belongs to - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/repository`. - public var repository: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.RepositoryPayload? - /// Current state of the task, derived from its most recent session - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/state`. - @frozen public enum StatePayload: String, Codable, Hashable, Sendable, CaseIterable { - case queued = "queued" - case inProgress = "in_progress" - case completed = "completed" - case failed = "failed" - case idle = "idle" - case waitingForUser = "waiting_for_user" - case timedOut = "timed_out" - case cancelled = "cancelled" - } - /// Current state of the task, derived from its most recent session - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/state`. - public var state: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.StatePayload - /// Number of sessions in this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/session_count`. - public var sessionCount: Swift.Int32? - /// A resource generated by the task - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload`. - public struct ArtifactsPayloadPayload: Codable, Hashable, Sendable { - /// Provider namespace - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/provider`. - @frozen public enum ProviderPayload: String, Codable, Hashable, Sendable, CaseIterable { - case github = "github" - } - /// Provider namespace - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/provider`. - public var provider: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.ProviderPayload - /// Type of artifact. Available Values: `pull`, `branch`. - /// - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/type`. - @frozen public enum _TypePayload: String, Codable, Hashable, Sendable, CaseIterable { - case pull = "pull" - case branch = "branch" - } - /// Type of artifact. Available Values: `pull`, `branch`. - /// - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/type`. - public var _type: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload._TypePayload - /// Resource data (shape depends on type) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data`. - @frozen public enum DataPayload: Codable, Hashable, Sendable { - /// A GitHub resource (pull request, issue, etc.) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case1`. - public struct Case1Payload: Codable, Hashable, Sendable { - /// GitHub resource ID - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case1/id`. - public var id: Swift.Int64 - /// GraphQL global ID - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case1/global_id`. - public var globalId: Swift.String? - /// Creates a new `Case1Payload`. - /// - /// - Parameters: - /// - id: GitHub resource ID - /// - globalId: GraphQL global ID - public init( - id: Swift.Int64, - globalId: Swift.String? = nil - ) { - self.id = id - self.globalId = globalId - } - public enum CodingKeys: String, CodingKey { - case id - case globalId = "global_id" - } - } - /// A GitHub resource (pull request, issue, etc.) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case1`. - case case1(Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.DataPayload.Case1Payload) - /// A Git branch reference - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case2`. - public struct Case2Payload: Codable, Hashable, Sendable { - /// Head branch name - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case2/head_ref`. - public var headRef: Swift.String - /// Base branch name - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case2/base_ref`. - public var baseRef: Swift.String - /// Creates a new `Case2Payload`. - /// - /// - Parameters: - /// - headRef: Head branch name - /// - baseRef: Base branch name - public init( - headRef: Swift.String, - baseRef: Swift.String - ) { - self.headRef = headRef - self.baseRef = baseRef - } - public enum CodingKeys: String, CodingKey { - case headRef = "head_ref" - case baseRef = "base_ref" - } - } - /// A Git branch reference - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data/case2`. - case case2(Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.DataPayload.Case2Payload) - public init(from decoder: any Swift.Decoder) throws { - var errors: [any Swift.Error] = [] - do { - self = .case1(try .init(from: decoder)) - return - } catch { - errors.append(error) - } - do { - self = .case2(try .init(from: decoder)) - 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 value.encode(to: encoder) - case let .case2(value): - try value.encode(to: encoder) - } - } - } - /// Resource data (shape depends on type) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/ArtifactsPayload/data`. - public var data: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.DataPayload - /// Creates a new `ArtifactsPayloadPayload`. - /// - /// - Parameters: - /// - provider: Provider namespace - /// - _type: Type of artifact. Available Values: `pull`, `branch`. - /// - data: Resource data (shape depends on type) - public init( - provider: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.ProviderPayload, - _type: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload._TypePayload, - data: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload.DataPayload - ) { - self.provider = provider - self._type = _type - self.data = data - } - public enum CodingKeys: String, CodingKey { - case provider - case _type = "type" - case data - } - } - /// Resources created by this task (PRs, branches, etc.) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/artifacts`. - public typealias ArtifactsPayload = [Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayloadPayload] - /// Resources created by this task (PRs, branches, etc.) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/artifacts`. - public var artifacts: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayload? - /// Timestamp when the task was archived, null if not archived - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/archived_at`. - public var archivedAt: Foundation.Date? - /// Timestamp of the most recent update - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/updated_at`. - public var updatedAt: Foundation.Date? - /// Timestamp when the task was created - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/TasksPayload/created_at`. - public var createdAt: Foundation.Date - /// Creates a new `TasksPayloadPayload`. - /// - /// - Parameters: - /// - id: Unique task identifier - /// - url: API URL for this task - /// - htmlUrl: Web URL for this task - /// - name: Human-readable name derived from the task prompt - /// - creator: The entity who created this task - /// - creatorType: Type of the task creator - /// - userCollaborators: User objects of collaborators on this task - /// - owner: The owner of the repository - /// - repository: The repository this task belongs to - /// - state: Current state of the task, derived from its most recent session - /// - sessionCount: Number of sessions in this task - /// - artifacts: Resources created by this task (PRs, branches, etc.) - /// - archivedAt: Timestamp when the task was archived, null if not archived - /// - updatedAt: Timestamp of the most recent update - /// - createdAt: Timestamp when the task was created - public init( - id: Swift.String, - url: Swift.String? = nil, - htmlUrl: Swift.String? = nil, - name: Swift.String? = nil, - creator: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.CreatorPayload? = nil, - creatorType: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.CreatorTypePayload? = nil, - userCollaborators: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.UserCollaboratorsPayload? = nil, - owner: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.OwnerPayload? = nil, - repository: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.RepositoryPayload? = nil, - state: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.StatePayload, - sessionCount: Swift.Int32? = nil, - artifacts: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload.ArtifactsPayload? = nil, - archivedAt: Foundation.Date? = nil, - updatedAt: Foundation.Date? = nil, - createdAt: Foundation.Date - ) { - self.id = id - self.url = url - self.htmlUrl = htmlUrl - self.name = name - self.creator = creator - self.creatorType = creatorType - self.userCollaborators = userCollaborators - self.owner = owner - self.repository = repository - self.state = state - self.sessionCount = sessionCount - self.artifacts = artifacts - self.archivedAt = archivedAt - self.updatedAt = updatedAt - self.createdAt = createdAt - } - public enum CodingKeys: String, CodingKey { - case id - case url - case htmlUrl = "html_url" - case name - case creator - case creatorType = "creator_type" - case userCollaborators = "user_collaborators" - case owner - case repository - case state - case sessionCount = "session_count" - case artifacts - case archivedAt = "archived_at" - case updatedAt = "updated_at" - case createdAt = "created_at" - } - } - /// List of tasks - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/tasks`. - public typealias TasksPayload = [Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayloadPayload] - /// List of tasks - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/tasks`. - public var tasks: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayload - /// Total count of active (non-archived) tasks - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/total_active_count`. - public var totalActiveCount: Swift.Int32? - /// Total count of archived tasks - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/json/total_archived_count`. - public var totalArchivedCount: Swift.Int32? - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - tasks: List of tasks - /// - totalActiveCount: Total count of active (non-archived) tasks - /// - totalArchivedCount: Total count of archived tasks - public init( - tasks: Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload.TasksPayload, - totalActiveCount: Swift.Int32? = nil, - totalArchivedCount: Swift.Int32? = nil - ) { - self.tasks = tasks - self.totalActiveCount = totalActiveCount - self.totalArchivedCount = totalArchivedCount - } - public enum CodingKeys: String, CodingKey { - case tasks - case totalActiveCount = "total_active_count" - case totalArchivedCount = "total_archived_count" - } - } - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/200/content/application\/json`. - case json(Operations.AgentTasksListTasks.Output.Ok.Body.JsonPayload) - /// 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.AgentTasksListTasks.Output.Ok.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksListTasks.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - headers: Received HTTP response headers - /// - body: Received HTTP response body - public init( - headers: Operations.AgentTasksListTasks.Output.Ok.Headers = .init(), - body: Operations.AgentTasksListTasks.Output.Ok.Body - ) { - self.headers = headers - self.body = body - } - } - /// Tasks retrieved successfully - /// - /// - Remark: Generated from `#/paths//agents/tasks/get(agent-tasks/list-tasks)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.AgentTasksListTasks.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.AgentTasksListTasks.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - public struct BadRequest: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/400/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/400/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/400/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/400/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/400/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/400/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksListTasks.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/400/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksListTasks.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/400/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksListTasks.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/400/content/json/errors`. - public var errors: Operations.AgentTasksListTasks.Output.BadRequest.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/400/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksListTasks.Output.BadRequest.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/400/content/application\/json`. - case json(Operations.AgentTasksListTasks.Output.BadRequest.Body.JsonPayload) - /// 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.AgentTasksListTasks.Output.BadRequest.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksListTasks.Output.BadRequest.Body - /// Creates a new `BadRequest`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksListTasks.Output.BadRequest.Body) { - self.body = body - } - } - /// Bad request - /// - /// - Remark: Generated from `#/paths//agents/tasks/get(agent-tasks/list-tasks)/responses/400`. - /// - /// HTTP response code: `400 badRequest`. - case badRequest(Operations.AgentTasksListTasks.Output.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: Operations.AgentTasksListTasks.Output.BadRequest { - get throws { - switch self { - case let .badRequest(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "badRequest", - response: self - ) - } - } - } - public struct Unauthorized: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/401/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/401/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/401/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/401/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/401/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/401/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksListTasks.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/401/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksListTasks.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/401/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksListTasks.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/401/content/json/errors`. - public var errors: Operations.AgentTasksListTasks.Output.Unauthorized.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/401/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksListTasks.Output.Unauthorized.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/401/content/application\/json`. - case json(Operations.AgentTasksListTasks.Output.Unauthorized.Body.JsonPayload) - /// 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.AgentTasksListTasks.Output.Unauthorized.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksListTasks.Output.Unauthorized.Body - /// Creates a new `Unauthorized`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksListTasks.Output.Unauthorized.Body) { - self.body = body - } - } - /// Authentication required - /// - /// - Remark: Generated from `#/paths//agents/tasks/get(agent-tasks/list-tasks)/responses/401`. - /// - /// HTTP response code: `401 unauthorized`. - case unauthorized(Operations.AgentTasksListTasks.Output.Unauthorized) - /// The associated value of the enum case if `self` is `.unauthorized`. - /// - /// - Throws: An error if `self` is not `.unauthorized`. - /// - SeeAlso: `.unauthorized`. - public var unauthorized: Operations.AgentTasksListTasks.Output.Unauthorized { - 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/agents/tasks/GET/responses/403/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/403/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/403/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/403/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/403/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/403/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksListTasks.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/403/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksListTasks.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/403/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksListTasks.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/403/content/json/errors`. - public var errors: Operations.AgentTasksListTasks.Output.Forbidden.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/403/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksListTasks.Output.Forbidden.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/403/content/application\/json`. - case json(Operations.AgentTasksListTasks.Output.Forbidden.Body.JsonPayload) - /// 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.AgentTasksListTasks.Output.Forbidden.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksListTasks.Output.Forbidden.Body - /// Creates a new `Forbidden`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksListTasks.Output.Forbidden.Body) { - self.body = body - } - } - /// Insufficient permissions - /// - /// - Remark: Generated from `#/paths//agents/tasks/get(agent-tasks/list-tasks)/responses/403`. - /// - /// HTTP response code: `403 forbidden`. - case forbidden(Operations.AgentTasksListTasks.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: Operations.AgentTasksListTasks.Output.Forbidden { - get throws { - switch self { - case let .forbidden(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "forbidden", - response: self - ) - } - } - } - public struct UnprocessableContent: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/422/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/422/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/422/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/422/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/422/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/422/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksListTasks.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/422/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksListTasks.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/422/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksListTasks.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/422/content/json/errors`. - public var errors: Operations.AgentTasksListTasks.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/422/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksListTasks.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/tasks/GET/responses/422/content/application\/json`. - case json(Operations.AgentTasksListTasks.Output.UnprocessableContent.Body.JsonPayload) - /// 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.AgentTasksListTasks.Output.UnprocessableContent.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksListTasks.Output.UnprocessableContent.Body - /// Creates a new `UnprocessableContent`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksListTasks.Output.UnprocessableContent.Body) { - self.body = body - } - } - /// Validation Failed - /// - /// - Remark: Generated from `#/paths//agents/tasks/get(agent-tasks/list-tasks)/responses/422`. - /// - /// HTTP response code: `422 unprocessableContent`. - case unprocessableContent(Operations.AgentTasksListTasks.Output.UnprocessableContent) - /// The associated value of the enum case if `self` is `.unprocessableContent`. - /// - /// - Throws: An error if `self` is not `.unprocessableContent`. - /// - SeeAlso: `.unprocessableContent`. - public var unprocessableContent: Operations.AgentTasksListTasks.Output.UnprocessableContent { - get throws { - switch self { - case let .unprocessableContent(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "unprocessableContent", - 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 - ] - } - } - } - /// Get a task by ID - /// - /// > [!NOTE] - /// > This endpoint is in public preview and is subject to change. - /// - /// Returns a task by ID with its associated sessions - /// - /// - /// - Remark: HTTP `GET /agents/tasks/{task_id}`. - /// - Remark: Generated from `#/paths//agents/tasks/{task_id}/get(agent-tasks/get-task-by-id)`. - public enum AgentTasksGetTaskById { - public static let id: Swift.String = "agent-tasks/get-task-by-id" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/path`. - public struct Path: Sendable, Hashable { - /// The unique identifier of the task. - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/path/task_id`. - public var taskId: Swift.String - /// Creates a new `Path`. - /// - /// - Parameters: - /// - taskId: The unique identifier of the task. - public init(taskId: Swift.String) { - self.taskId = taskId - } - } - public var path: Operations.AgentTasksGetTaskById.Input.Path - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/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.AgentTasksGetTaskById.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - path: - /// - headers: - public init( - path: Operations.AgentTasksGetTaskById.Input.Path, - headers: Operations.AgentTasksGetTaskById.Input.Headers = .init() - ) { - self.path = path - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1`. - public struct Value1Payload: Codable, Hashable, Sendable { - /// Unique task identifier - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/id`. - public var id: Swift.String - /// API URL for this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/url`. - public var url: Swift.String? - /// Web URL for this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/html_url`. - public var htmlUrl: Swift.String? - /// Human-readable name derived from the task prompt - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/name`. - public var name: Swift.String? - /// The entity who created this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/creator`. - @frozen public enum CreatorPayload: Codable, Hashable, Sendable { - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/creator/case1`. - public struct Case1Payload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/creator/case1/id`. - public var id: Swift.Int64? - /// Creates a new `Case1Payload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/creator/case1`. - case case1(Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.CreatorPayload.Case1Payload) - public init(from decoder: any Swift.Decoder) throws { - var errors: [any Swift.Error] = [] - do { - self = .case1(try .init(from: decoder)) - 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 value.encode(to: encoder) - } - } - } - /// The entity who created this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/creator`. - public var creator: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.CreatorPayload? - /// Type of the task creator - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/creator_type`. - @frozen public enum CreatorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { - case user = "user" - case organization = "organization" - } - /// Type of the task creator - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/creator_type`. - public var creatorType: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.CreatorTypePayload? - /// A GitHub user - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/UserCollaboratorsPayload`. - public struct UserCollaboratorsPayloadPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/UserCollaboratorsPayload/id`. - public var id: Swift.Int64? - /// Creates a new `UserCollaboratorsPayloadPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// User objects of collaborators on this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/user_collaborators`. - public typealias UserCollaboratorsPayload = [Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.UserCollaboratorsPayloadPayload] - /// User objects of collaborators on this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/user_collaborators`. - @available(*, deprecated) - public var userCollaborators: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.UserCollaboratorsPayload? - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/owner`. - public struct OwnerPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/owner/id`. - public var id: Swift.Int64? - /// Creates a new `OwnerPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/owner`. - public var owner: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.OwnerPayload? - /// The repository this task belongs to - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/repository`. - public struct RepositoryPayload: Codable, Hashable, Sendable { - /// The unique identifier of the repository - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/repository/id`. - public var id: Swift.Int64? - /// Creates a new `RepositoryPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the repository - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The repository this task belongs to - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/repository`. - public var repository: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.RepositoryPayload? - /// Current state of the task, derived from its most recent session - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/state`. - @frozen public enum StatePayload: String, Codable, Hashable, Sendable, CaseIterable { - case queued = "queued" - case inProgress = "in_progress" - case completed = "completed" - case failed = "failed" - case idle = "idle" - case waitingForUser = "waiting_for_user" - case timedOut = "timed_out" - case cancelled = "cancelled" - } - /// Current state of the task, derived from its most recent session - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/state`. - public var state: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.StatePayload - /// Number of sessions in this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/session_count`. - public var sessionCount: Swift.Int32? - /// A resource generated by the task - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload`. - public struct ArtifactsPayloadPayload: Codable, Hashable, Sendable { - /// Provider namespace - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/provider`. - @frozen public enum ProviderPayload: String, Codable, Hashable, Sendable, CaseIterable { - case github = "github" - } - /// Provider namespace - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/provider`. - public var provider: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.ProviderPayload - /// Type of artifact. Available Values: `pull`, `branch`. - /// - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/type`. - @frozen public enum _TypePayload: String, Codable, Hashable, Sendable, CaseIterable { - case pull = "pull" - case branch = "branch" - } - /// Type of artifact. Available Values: `pull`, `branch`. - /// - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/type`. - public var _type: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload._TypePayload - /// Resource data (shape depends on type) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data`. - @frozen public enum DataPayload: Codable, Hashable, Sendable { - /// A GitHub resource (pull request, issue, etc.) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case1`. - public struct Case1Payload: Codable, Hashable, Sendable { - /// GitHub resource ID - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case1/id`. - public var id: Swift.Int64 - /// GraphQL global ID - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case1/global_id`. - public var globalId: Swift.String? - /// Creates a new `Case1Payload`. - /// - /// - Parameters: - /// - id: GitHub resource ID - /// - globalId: GraphQL global ID - public init( - id: Swift.Int64, - globalId: Swift.String? = nil - ) { - self.id = id - self.globalId = globalId - } - public enum CodingKeys: String, CodingKey { - case id - case globalId = "global_id" - } - } - /// A GitHub resource (pull request, issue, etc.) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case1`. - case case1(Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.DataPayload.Case1Payload) - /// A Git branch reference - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case2`. - public struct Case2Payload: Codable, Hashable, Sendable { - /// Head branch name - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case2/head_ref`. - public var headRef: Swift.String - /// Base branch name - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case2/base_ref`. - public var baseRef: Swift.String - /// Creates a new `Case2Payload`. - /// - /// - Parameters: - /// - headRef: Head branch name - /// - baseRef: Base branch name - public init( - headRef: Swift.String, - baseRef: Swift.String - ) { - self.headRef = headRef - self.baseRef = baseRef - } - public enum CodingKeys: String, CodingKey { - case headRef = "head_ref" - case baseRef = "base_ref" - } - } - /// A Git branch reference - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data/case2`. - case case2(Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.DataPayload.Case2Payload) - public init(from decoder: any Swift.Decoder) throws { - var errors: [any Swift.Error] = [] - do { - self = .case1(try .init(from: decoder)) - return - } catch { - errors.append(error) - } - do { - self = .case2(try .init(from: decoder)) - 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 value.encode(to: encoder) - case let .case2(value): - try value.encode(to: encoder) - } - } - } - /// Resource data (shape depends on type) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/ArtifactsPayload/data`. - public var data: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.DataPayload - /// Creates a new `ArtifactsPayloadPayload`. - /// - /// - Parameters: - /// - provider: Provider namespace - /// - _type: Type of artifact. Available Values: `pull`, `branch`. - /// - data: Resource data (shape depends on type) - public init( - provider: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.ProviderPayload, - _type: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload._TypePayload, - data: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload.DataPayload - ) { - self.provider = provider - self._type = _type - self.data = data - } - public enum CodingKeys: String, CodingKey { - case provider - case _type = "type" - case data - } - } - /// Resources created by this task (PRs, branches, etc.) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/artifacts`. - public typealias ArtifactsPayload = [Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayloadPayload] - /// Resources created by this task (PRs, branches, etc.) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/artifacts`. - public var artifacts: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayload? - /// Timestamp when the task was archived, null if not archived - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/archived_at`. - public var archivedAt: Foundation.Date? - /// Timestamp of the most recent update - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/updated_at`. - public var updatedAt: Foundation.Date? - /// Timestamp when the task was created - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1/created_at`. - public var createdAt: Foundation.Date - /// Creates a new `Value1Payload`. - /// - /// - Parameters: - /// - id: Unique task identifier - /// - url: API URL for this task - /// - htmlUrl: Web URL for this task - /// - name: Human-readable name derived from the task prompt - /// - creator: The entity who created this task - /// - creatorType: Type of the task creator - /// - userCollaborators: User objects of collaborators on this task - /// - owner: The owner of the repository - /// - repository: The repository this task belongs to - /// - state: Current state of the task, derived from its most recent session - /// - sessionCount: Number of sessions in this task - /// - artifacts: Resources created by this task (PRs, branches, etc.) - /// - archivedAt: Timestamp when the task was archived, null if not archived - /// - updatedAt: Timestamp of the most recent update - /// - createdAt: Timestamp when the task was created - public init( - id: Swift.String, - url: Swift.String? = nil, - htmlUrl: Swift.String? = nil, - name: Swift.String? = nil, - creator: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.CreatorPayload? = nil, - creatorType: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.CreatorTypePayload? = nil, - userCollaborators: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.UserCollaboratorsPayload? = nil, - owner: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.OwnerPayload? = nil, - repository: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.RepositoryPayload? = nil, - state: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.StatePayload, - sessionCount: Swift.Int32? = nil, - artifacts: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload.ArtifactsPayload? = nil, - archivedAt: Foundation.Date? = nil, - updatedAt: Foundation.Date? = nil, - createdAt: Foundation.Date - ) { - self.id = id - self.url = url - self.htmlUrl = htmlUrl - self.name = name - self.creator = creator - self.creatorType = creatorType - self.userCollaborators = userCollaborators - self.owner = owner - self.repository = repository - self.state = state - self.sessionCount = sessionCount - self.artifacts = artifacts - self.archivedAt = archivedAt - self.updatedAt = updatedAt - self.createdAt = createdAt - } - public enum CodingKeys: String, CodingKey { - case id - case url - case htmlUrl = "html_url" - case name - case creator - case creatorType = "creator_type" - case userCollaborators = "user_collaborators" - case owner - case repository - case state - case sessionCount = "session_count" - case artifacts - case archivedAt = "archived_at" - case updatedAt = "updated_at" - case createdAt = "created_at" - } - } - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value1`. - public var value1: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2`. - public struct Value2Payload: Codable, Hashable, Sendable { - /// Full session details within a task - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload`. - public struct SessionsPayloadPayload: Codable, Hashable, Sendable { - /// Session ID - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/id`. - public var id: Swift.String - /// Session name - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/name`. - public var name: Swift.String? - /// The user who created this session - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/user`. - public struct UserPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/user/id`. - public var id: Swift.Int64? - /// Creates a new `UserPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The user who created this session - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/user`. - public var user: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.UserPayload? - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/owner`. - public struct OwnerPayload: Codable, Hashable, Sendable { - /// The unique identifier of the user - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/owner/id`. - public var id: Swift.Int64? - /// Creates a new `OwnerPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the user - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The owner of the repository - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/owner`. - public var owner: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.OwnerPayload? - /// The repository this session belongs to - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/repository`. - public struct RepositoryPayload: Codable, Hashable, Sendable { - /// The unique identifier of the repository - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/repository/id`. - public var id: Swift.Int64? - /// Creates a new `RepositoryPayload`. - /// - /// - Parameters: - /// - id: The unique identifier of the repository - public init(id: Swift.Int64? = nil) { - self.id = id - } - public enum CodingKeys: String, CodingKey { - case id - } - } - /// The repository this session belongs to - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/repository`. - public var repository: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.RepositoryPayload? - /// Task ID this session belongs to - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/task_id`. - public var taskId: Swift.String? - /// Current state of a session - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/state`. - @frozen public enum StatePayload: String, Codable, Hashable, Sendable, CaseIterable { - case queued = "queued" - case inProgress = "in_progress" - case completed = "completed" - case failed = "failed" - case idle = "idle" - case waitingForUser = "waiting_for_user" - case timedOut = "timed_out" - case cancelled = "cancelled" - } - /// Current state of a session - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/state`. - public var state: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.StatePayload - /// Creation timestamp - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/created_at`. - public var createdAt: Foundation.Date - /// Last update timestamp - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/updated_at`. - public var updatedAt: Foundation.Date? - /// Completion timestamp - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/completed_at`. - public var completedAt: Foundation.Date? - /// Content of the triggering event - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/prompt`. - public var prompt: Swift.String? - /// Head branch name - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/head_ref`. - public var headRef: Swift.String? - /// Base branch name - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/base_ref`. - public var baseRef: Swift.String? - /// Model used for this session - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/model`. - public var model: Swift.String? - /// Error details for a failed session - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/error`. - public struct _ErrorPayload: Codable, Hashable, Sendable { - /// Error message - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/error/message`. - public var message: Swift.String? - /// Creates a new `_ErrorPayload`. - /// - /// - Parameters: - /// - message: Error message - public init(message: Swift.String? = nil) { - self.message = message - } - public enum CodingKeys: String, CodingKey { - case message - } - } - /// Error details for a failed session - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/SessionsPayload/error`. - public var error: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload._ErrorPayload? - /// Creates a new `SessionsPayloadPayload`. - /// - /// - Parameters: - /// - id: Session ID - /// - name: Session name - /// - user: The user who created this session - /// - owner: The owner of the repository - /// - repository: The repository this session belongs to - /// - taskId: Task ID this session belongs to - /// - state: Current state of a session - /// - createdAt: Creation timestamp - /// - updatedAt: Last update timestamp - /// - completedAt: Completion timestamp - /// - prompt: Content of the triggering event - /// - headRef: Head branch name - /// - baseRef: Base branch name - /// - model: Model used for this session - /// - error: Error details for a failed session - public init( - id: Swift.String, - name: Swift.String? = nil, - user: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.UserPayload? = nil, - owner: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.OwnerPayload? = nil, - repository: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.RepositoryPayload? = nil, - taskId: Swift.String? = nil, - state: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload.StatePayload, - createdAt: Foundation.Date, - updatedAt: Foundation.Date? = nil, - completedAt: Foundation.Date? = nil, - prompt: Swift.String? = nil, - headRef: Swift.String? = nil, - baseRef: Swift.String? = nil, - model: Swift.String? = nil, - error: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload._ErrorPayload? = nil - ) { - self.id = id - self.name = name - self.user = user - self.owner = owner - self.repository = repository - self.taskId = taskId - self.state = state - self.createdAt = createdAt - self.updatedAt = updatedAt - self.completedAt = completedAt - self.prompt = prompt - self.headRef = headRef - self.baseRef = baseRef - self.model = model - self.error = error - } - public enum CodingKeys: String, CodingKey { - case id - case name - case user - case owner - case repository - case taskId = "task_id" - case state - case createdAt = "created_at" - case updatedAt = "updated_at" - case completedAt = "completed_at" - case prompt - case headRef = "head_ref" - case baseRef = "base_ref" - case model - case error - } - } - /// Sessions associated with this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/sessions`. - public typealias SessionsPayload = [Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayloadPayload] - /// Sessions associated with this task - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2/sessions`. - public var sessions: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayload? - /// Creates a new `Value2Payload`. - /// - /// - Parameters: - /// - sessions: Sessions associated with this task - public init(sessions: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload.SessionsPayload? = nil) { - self.sessions = sessions - } - public enum CodingKeys: String, CodingKey { - case sessions - } - } - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/json/value2`. - public var value2: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - value1: - /// - value2: - public init( - value1: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value1Payload, - value2: Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload.Value2Payload - ) { - self.value1 = value1 - self.value2 = value2 - } - public init(from decoder: any Swift.Decoder) throws { - self.value1 = try .init(from: decoder) - self.value2 = try .init(from: decoder) - } - public func encode(to encoder: any Swift.Encoder) throws { - try self.value1.encode(to: encoder) - try self.value2.encode(to: encoder) - } - } - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/200/content/application\/json`. - case json(Operations.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload) - /// 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.AgentTasksGetTaskById.Output.Ok.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskById.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskById.Output.Ok.Body) { - self.body = body - } - } - /// Task retrieved successfully - /// - /// - Remark: Generated from `#/paths//agents/tasks/{task_id}/get(agent-tasks/get-task-by-id)/responses/200`. - /// - /// HTTP response code: `200 ok`. - case ok(Operations.AgentTasksGetTaskById.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.AgentTasksGetTaskById.Output.Ok { - get throws { - switch self { - case let .ok(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "ok", - response: self - ) - } - } - } - public struct BadRequest: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/400/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/400/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/400/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/400/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/400/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/400/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksGetTaskById.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/400/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksGetTaskById.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/400/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksGetTaskById.Output.BadRequest.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/400/content/json/errors`. - public var errors: Operations.AgentTasksGetTaskById.Output.BadRequest.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/400/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksGetTaskById.Output.BadRequest.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/400/content/application\/json`. - case json(Operations.AgentTasksGetTaskById.Output.BadRequest.Body.JsonPayload) - /// 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.AgentTasksGetTaskById.Output.BadRequest.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskById.Output.BadRequest.Body - /// Creates a new `BadRequest`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskById.Output.BadRequest.Body) { - self.body = body - } - } - /// Problems parsing request - /// - /// - Remark: Generated from `#/paths//agents/tasks/{task_id}/get(agent-tasks/get-task-by-id)/responses/400`. - /// - /// HTTP response code: `400 badRequest`. - case badRequest(Operations.AgentTasksGetTaskById.Output.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: Operations.AgentTasksGetTaskById.Output.BadRequest { - get throws { - switch self { - case let .badRequest(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "badRequest", - response: self - ) - } - } - } - public struct Unauthorized: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/401/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/401/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/401/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/401/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/401/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/401/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksGetTaskById.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/401/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksGetTaskById.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/401/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksGetTaskById.Output.Unauthorized.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/401/content/json/errors`. - public var errors: Operations.AgentTasksGetTaskById.Output.Unauthorized.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/401/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksGetTaskById.Output.Unauthorized.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/401/content/application\/json`. - case json(Operations.AgentTasksGetTaskById.Output.Unauthorized.Body.JsonPayload) - /// 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.AgentTasksGetTaskById.Output.Unauthorized.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskById.Output.Unauthorized.Body - /// Creates a new `Unauthorized`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskById.Output.Unauthorized.Body) { - self.body = body - } - } - /// Authentication required - /// - /// - Remark: Generated from `#/paths//agents/tasks/{task_id}/get(agent-tasks/get-task-by-id)/responses/401`. - /// - /// HTTP response code: `401 unauthorized`. - case unauthorized(Operations.AgentTasksGetTaskById.Output.Unauthorized) - /// The associated value of the enum case if `self` is `.unauthorized`. - /// - /// - Throws: An error if `self` is not `.unauthorized`. - /// - SeeAlso: `.unauthorized`. - public var unauthorized: Operations.AgentTasksGetTaskById.Output.Unauthorized { - 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/agents/tasks/{task_id}/GET/responses/403/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/403/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/403/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/403/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/403/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/403/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksGetTaskById.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/403/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksGetTaskById.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/403/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksGetTaskById.Output.Forbidden.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/403/content/json/errors`. - public var errors: Operations.AgentTasksGetTaskById.Output.Forbidden.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/403/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksGetTaskById.Output.Forbidden.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/403/content/application\/json`. - case json(Operations.AgentTasksGetTaskById.Output.Forbidden.Body.JsonPayload) - /// 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.AgentTasksGetTaskById.Output.Forbidden.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskById.Output.Forbidden.Body - /// Creates a new `Forbidden`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskById.Output.Forbidden.Body) { - self.body = body - } - } - /// Insufficient permissions - /// - /// - Remark: Generated from `#/paths//agents/tasks/{task_id}/get(agent-tasks/get-task-by-id)/responses/403`. - /// - /// HTTP response code: `403 forbidden`. - case forbidden(Operations.AgentTasksGetTaskById.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: Operations.AgentTasksGetTaskById.Output.Forbidden { - get throws { - switch self { - case let .forbidden(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "forbidden", - response: self - ) - } - } - } - public struct NotFound: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/404/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/404/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/404/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/404/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/404/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/404/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksGetTaskById.Output.NotFound.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/404/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksGetTaskById.Output.NotFound.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/404/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksGetTaskById.Output.NotFound.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/404/content/json/errors`. - public var errors: Operations.AgentTasksGetTaskById.Output.NotFound.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/404/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksGetTaskById.Output.NotFound.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/404/content/application\/json`. - case json(Operations.AgentTasksGetTaskById.Output.NotFound.Body.JsonPayload) - /// 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.AgentTasksGetTaskById.Output.NotFound.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskById.Output.NotFound.Body - /// Creates a new `NotFound`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskById.Output.NotFound.Body) { - self.body = body - } - } - /// Resource not found - /// - /// - Remark: Generated from `#/paths//agents/tasks/{task_id}/get(agent-tasks/get-task-by-id)/responses/404`. - /// - /// HTTP response code: `404 notFound`. - case notFound(Operations.AgentTasksGetTaskById.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.AgentTasksGetTaskById.Output.NotFound { - get throws { - switch self { - case let .notFound(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "notFound", - response: self - ) - } - } - } - public struct UnprocessableContent: Sendable, Hashable { - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/422/content`. - @frozen public enum Body: Sendable, Hashable { - /// Structured error response following GitHub REST API conventions. - /// For 422 Unprocessable Entity the errors array contains validation - /// details; for other error status codes only message and - /// documentation_url are returned. - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/422/content/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// Summary message (e.g. "Validation Failed", "Not Found") - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/422/content/json/message`. - public var message: Swift.String - /// A single validation error - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/422/content/json/ErrorsPayload`. - public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/422/content/json/ErrorsPayload/code`. - @frozen public enum CodePayload: String, Codable, Hashable, Sendable, CaseIterable { - case missing = "missing" - case missingField = "missing_field" - case invalid = "invalid" - case alreadyExists = "already_exists" - case unprocessable = "unprocessable" - case custom = "custom" - } - /// Machine-readable error code - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/422/content/json/ErrorsPayload/code`. - public var code: Operations.AgentTasksGetTaskById.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload.CodePayload - /// Human-readable message (populated when code is "custom") - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/422/content/json/ErrorsPayload/message`. - public var message: Swift.String? - /// Creates a new `ErrorsPayloadPayload`. - /// - /// - Parameters: - /// - code: Machine-readable error code - /// - message: Human-readable message (populated when code is "custom") - public init( - code: Operations.AgentTasksGetTaskById.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload.CodePayload, - message: Swift.String? = nil - ) { - self.code = code - self.message = message - } - public enum CodingKeys: String, CodingKey { - case code - case message - } - } - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/422/content/json/errors`. - public typealias ErrorsPayload = [Operations.AgentTasksGetTaskById.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayloadPayload] - /// List of validation errors (present only for 422 responses) - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/422/content/json/errors`. - public var errors: Operations.AgentTasksGetTaskById.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayload? - /// URL to relevant API documentation - /// - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/422/content/json/documentation_url`. - public var documentationUrl: Swift.String - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - message: Summary message (e.g. "Validation Failed", "Not Found") - /// - errors: List of validation errors (present only for 422 responses) - /// - documentationUrl: URL to relevant API documentation - public init( - message: Swift.String, - errors: Operations.AgentTasksGetTaskById.Output.UnprocessableContent.Body.JsonPayload.ErrorsPayload? = nil, - documentationUrl: Swift.String - ) { - self.message = message - self.errors = errors - self.documentationUrl = documentationUrl - } - public enum CodingKeys: String, CodingKey { - case message - case errors - case documentationUrl = "documentation_url" - } - } - /// - Remark: Generated from `#/paths/agents/tasks/{task_id}/GET/responses/422/content/application\/json`. - case json(Operations.AgentTasksGetTaskById.Output.UnprocessableContent.Body.JsonPayload) - /// 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.AgentTasksGetTaskById.Output.UnprocessableContent.Body.JsonPayload { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.AgentTasksGetTaskById.Output.UnprocessableContent.Body - /// Creates a new `UnprocessableContent`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.AgentTasksGetTaskById.Output.UnprocessableContent.Body) { - self.body = body - } - } - /// Validation Failed - /// - /// - Remark: Generated from `#/paths//agents/tasks/{task_id}/get(agent-tasks/get-task-by-id)/responses/422`. - /// - /// HTTP response code: `422 unprocessableContent`. - case unprocessableContent(Operations.AgentTasksGetTaskById.Output.UnprocessableContent) - /// The associated value of the enum case if `self` is `.unprocessableContent`. - /// - /// - Throws: An error if `self` is not `.unprocessableContent`. - /// - SeeAlso: `.unprocessableContent`. - public var unprocessableContent: Operations.AgentTasksGetTaskById.Output.UnprocessableContent { - get throws { - switch self { - case let .unprocessableContent(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "unprocessableContent", - 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 - ] - } - } - } -} +public enum Operations {} diff --git a/Sources/copilot/Client.swift b/Sources/copilot/Client.swift index 5cb15a72c77..5f24874937c 100644 --- a/Sources/copilot/Client.swift +++ b/Sources/copilot/Client.swift @@ -596,6 +596,284 @@ public struct Client: APIProtocol { } ) } + /// Set the coding agent policy for an enterprise + /// + /// Sets the policy for Copilot coding agent usage across an enterprise. + /// + /// Enterprise owners can configure whether Copilot coding agent is enabled for all + /// organizations, disabled for all organizations, configured by individual organization + /// admins, or enabled for selected organizations only. + /// + /// Only enterprise owners can set the coding agent policy for their enterprise. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `PUT /enterprises/{enterprise}/copilot/policies/coding_agent`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/put(copilot/set-enterprise-coding-agent-policy)`. + public func copilotSetEnterpriseCodingAgentPolicy(_ input: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input) async throws -> Operations.CopilotSetEnterpriseCodingAgentPolicy.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSetEnterpriseCodingAgentPolicy.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/enterprises/{}/copilot/policies/coding_agent", + parameters: [ + input.path.enterprise + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .put + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case let .json(value): + body = try converter.setRequiredRequestBodyAsJSON( + value, + headerFields: &request.headerFields, + contentType: "application/json; charset=utf-8" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 204: + return .noContent(.init()) + 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)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Add organizations to the enterprise coding agent policy + /// + /// Enables Copilot coding agent for the specified organizations within the enterprise. + /// + /// The enterprise's coding agent policy must be set to `enabled_for_selected_orgs` before + /// using this endpoint. Organizations can be specified by login or matched via custom properties. + /// + /// Only organizations that have Copilot enabled and belong to the enterprise will be affected. + /// + /// Only enterprise owners can add organizations to the coding agent policy. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `POST /enterprises/{enterprise}/copilot/policies/coding_agent/organizations`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/post(copilot/add-organizations-to-enterprise-coding-agent-policy)`. + public func copilotAddOrganizationsToEnterpriseCodingAgentPolicy(_ input: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input) async throws -> Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/enterprises/{}/copilot/policies/coding_agent/organizations", + parameters: [ + input.path.enterprise + ] + ) + 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 let .json(value): + body = try converter.setRequiredRequestBodyAsJSON( + value, + headerFields: &request.headerFields, + contentType: "application/json; charset=utf-8" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 204: + return .noContent(.init()) + 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)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Remove organizations from the enterprise coding agent policy + /// + /// Disables Copilot coding agent for the specified organizations within the enterprise. + /// + /// The enterprise's coding agent policy must be set to `enabled_for_selected_orgs` before + /// using this endpoint. Organizations can be specified by login or matched via custom properties. + /// + /// Only organizations that have Copilot enabled and belong to the enterprise will be affected. + /// + /// Only enterprise owners can remove organizations from the coding agent policy. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `DELETE /enterprises/{enterprise}/copilot/policies/coding_agent/organizations`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/delete(copilot/remove-organizations-from-enterprise-coding-agent-policy)`. + public func copilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy(_ input: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input) async throws -> Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/enterprises/{}/copilot/policies/coding_agent/organizations", + parameters: [ + input.path.enterprise + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case let .json(value): + body = try converter.setRequiredRequestBodyAsJSON( + value, + headerFields: &request.headerFields, + contentType: "application/json; charset=utf-8" + ) + } + return (request, body) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 204: + return .noContent(.init()) + 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)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } /// Get Copilot seat information and settings for an organization /// /// > [!NOTE] diff --git a/Sources/copilot/Types.swift b/Sources/copilot/Types.swift index ac0074f2626..6d97985d5f7 100644 --- a/Sources/copilot/Types.swift +++ b/Sources/copilot/Types.swift @@ -63,6 +63,53 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `GET /enterprises/{enterprise}/copilot/metrics/reports/users-28-day/latest`. /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/metrics/reports/users-28-day/latest/get(copilot/copilot-users-usage-metrics)`. func copilotCopilotUsersUsageMetrics(_ input: Operations.CopilotCopilotUsersUsageMetrics.Input) async throws -> Operations.CopilotCopilotUsersUsageMetrics.Output + /// Set the coding agent policy for an enterprise + /// + /// Sets the policy for Copilot coding agent usage across an enterprise. + /// + /// Enterprise owners can configure whether Copilot coding agent is enabled for all + /// organizations, disabled for all organizations, configured by individual organization + /// admins, or enabled for selected organizations only. + /// + /// Only enterprise owners can set the coding agent policy for their enterprise. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `PUT /enterprises/{enterprise}/copilot/policies/coding_agent`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/put(copilot/set-enterprise-coding-agent-policy)`. + func copilotSetEnterpriseCodingAgentPolicy(_ input: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input) async throws -> Operations.CopilotSetEnterpriseCodingAgentPolicy.Output + /// Add organizations to the enterprise coding agent policy + /// + /// Enables Copilot coding agent for the specified organizations within the enterprise. + /// + /// The enterprise's coding agent policy must be set to `enabled_for_selected_orgs` before + /// using this endpoint. Organizations can be specified by login or matched via custom properties. + /// + /// Only organizations that have Copilot enabled and belong to the enterprise will be affected. + /// + /// Only enterprise owners can add organizations to the coding agent policy. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `POST /enterprises/{enterprise}/copilot/policies/coding_agent/organizations`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/post(copilot/add-organizations-to-enterprise-coding-agent-policy)`. + func copilotAddOrganizationsToEnterpriseCodingAgentPolicy(_ input: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input) async throws -> Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Output + /// Remove organizations from the enterprise coding agent policy + /// + /// Disables Copilot coding agent for the specified organizations within the enterprise. + /// + /// The enterprise's coding agent policy must be set to `enabled_for_selected_orgs` before + /// using this endpoint. Organizations can be specified by login or matched via custom properties. + /// + /// Only organizations that have Copilot enabled and belong to the enterprise will be affected. + /// + /// Only enterprise owners can remove organizations from the coding agent policy. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `DELETE /enterprises/{enterprise}/copilot/policies/coding_agent/organizations`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/delete(copilot/remove-organizations-from-enterprise-coding-agent-policy)`. + func copilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy(_ input: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input) async throws -> Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Output /// Get Copilot seat information and settings for an organization /// /// > [!NOTE] @@ -504,6 +551,83 @@ extension APIProtocol { headers: headers )) } + /// Set the coding agent policy for an enterprise + /// + /// Sets the policy for Copilot coding agent usage across an enterprise. + /// + /// Enterprise owners can configure whether Copilot coding agent is enabled for all + /// organizations, disabled for all organizations, configured by individual organization + /// admins, or enabled for selected organizations only. + /// + /// Only enterprise owners can set the coding agent policy for their enterprise. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `PUT /enterprises/{enterprise}/copilot/policies/coding_agent`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/put(copilot/set-enterprise-coding-agent-policy)`. + public func copilotSetEnterpriseCodingAgentPolicy( + path: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input.Path, + headers: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input.Headers = .init(), + body: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input.Body + ) async throws -> Operations.CopilotSetEnterpriseCodingAgentPolicy.Output { + try await copilotSetEnterpriseCodingAgentPolicy(Operations.CopilotSetEnterpriseCodingAgentPolicy.Input( + path: path, + headers: headers, + body: body + )) + } + /// Add organizations to the enterprise coding agent policy + /// + /// Enables Copilot coding agent for the specified organizations within the enterprise. + /// + /// The enterprise's coding agent policy must be set to `enabled_for_selected_orgs` before + /// using this endpoint. Organizations can be specified by login or matched via custom properties. + /// + /// Only organizations that have Copilot enabled and belong to the enterprise will be affected. + /// + /// Only enterprise owners can add organizations to the coding agent policy. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `POST /enterprises/{enterprise}/copilot/policies/coding_agent/organizations`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/post(copilot/add-organizations-to-enterprise-coding-agent-policy)`. + public func copilotAddOrganizationsToEnterpriseCodingAgentPolicy( + path: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Path, + headers: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Headers = .init(), + body: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Body + ) async throws -> Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Output { + try await copilotAddOrganizationsToEnterpriseCodingAgentPolicy(Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input( + path: path, + headers: headers, + body: body + )) + } + /// Remove organizations from the enterprise coding agent policy + /// + /// Disables Copilot coding agent for the specified organizations within the enterprise. + /// + /// The enterprise's coding agent policy must be set to `enabled_for_selected_orgs` before + /// using this endpoint. Organizations can be specified by login or matched via custom properties. + /// + /// Only organizations that have Copilot enabled and belong to the enterprise will be affected. + /// + /// Only enterprise owners can remove organizations from the coding agent policy. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `DELETE /enterprises/{enterprise}/copilot/policies/coding_agent/organizations`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/delete(copilot/remove-organizations-from-enterprise-coding-agent-policy)`. + public func copilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy( + path: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Path, + headers: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Headers = .init(), + body: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Body + ) async throws -> Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Output { + try await copilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy(Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input( + path: path, + headers: headers, + body: body + )) + } /// Get Copilot seat information and settings for an organization /// /// > [!NOTE] @@ -1285,6 +1409,55 @@ public enum Components { case errors } } + /// Scim Error + /// + /// - Remark: Generated from `#/components/schemas/scim-error`. + public struct ScimError: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/scim-error/message`. + public var message: Swift.String? + /// - Remark: Generated from `#/components/schemas/scim-error/documentation_url`. + public var documentationUrl: Swift.String? + /// - Remark: Generated from `#/components/schemas/scim-error/detail`. + public var detail: Swift.String? + /// - Remark: Generated from `#/components/schemas/scim-error/status`. + public var status: Swift.Int? + /// - Remark: Generated from `#/components/schemas/scim-error/scimType`. + public var scimType: Swift.String? + /// - Remark: Generated from `#/components/schemas/scim-error/schemas`. + public var schemas: [Swift.String]? + /// Creates a new `ScimError`. + /// + /// - Parameters: + /// - message: + /// - documentationUrl: + /// - detail: + /// - status: + /// - scimType: + /// - schemas: + public init( + message: Swift.String? = nil, + documentationUrl: Swift.String? = nil, + detail: Swift.String? = nil, + status: Swift.Int? = nil, + scimType: Swift.String? = nil, + schemas: [Swift.String]? = nil + ) { + self.message = message + self.documentationUrl = documentationUrl + self.detail = detail + self.status = status + self.scimType = scimType + self.schemas = schemas + } + public enum CodingKeys: String, CodingKey { + case message + case documentationUrl = "documentation_url" + case detail + case status + case scimType + case schemas + } + } /// Validation Error /// /// - Remark: Generated from `#/components/schemas/validation-error`. @@ -4604,6 +4777,58 @@ public enum Components { self.body = body } } + public struct BadRequest: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/bad_request/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/bad_request/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 + default: + try throwUnexpectedResponseBody( + expectedContent: "application/json", + body: self + ) + } + } + } + /// - Remark: Generated from `#/components/responses/bad_request/content/application\/scim+json`. + case applicationScimJson(Components.Schemas.ScimError) + /// The associated value of the enum case if `self` is `.applicationScimJson`. + /// + /// - Throws: An error if `self` is not `.applicationScimJson`. + /// - SeeAlso: `.applicationScimJson`. + public var applicationScimJson: Components.Schemas.ScimError { + get throws { + switch self { + case let .applicationScimJson(body): + return body + default: + try throwUnexpectedResponseBody( + expectedContent: "application/scim+json", + body: self + ) + } + } + } + } + /// Received HTTP response body + public var body: Components.Responses.BadRequest.Body + /// Creates a new `BadRequest`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Components.Responses.BadRequest.Body) { + self.body = body + } + } public struct ValidationFailed: Sendable, Hashable { /// - Remark: Generated from `#/components/responses/validation_failed/content`. @frozen public enum Body: Sendable, Hashable { @@ -5678,6 +5903,624 @@ public enum Operations { } } } + /// Set the coding agent policy for an enterprise + /// + /// Sets the policy for Copilot coding agent usage across an enterprise. + /// + /// Enterprise owners can configure whether Copilot coding agent is enabled for all + /// organizations, disabled for all organizations, configured by individual organization + /// admins, or enabled for selected organizations only. + /// + /// Only enterprise owners can set the coding agent policy for their enterprise. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `PUT /enterprises/{enterprise}/copilot/policies/coding_agent`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/put(copilot/set-enterprise-coding-agent-policy)`. + public enum CopilotSetEnterpriseCodingAgentPolicy { + public static let id: Swift.String = "copilot/set-enterprise-coding-agent-policy" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/PUT/path`. + public struct Path: Sendable, Hashable { + /// The slug version of the enterprise name. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/PUT/path/enterprise`. + public var enterprise: Components.Parameters.Enterprise + /// Creates a new `Path`. + /// + /// - Parameters: + /// - enterprise: The slug version of the enterprise name. + public init(enterprise: Components.Parameters.Enterprise) { + self.enterprise = enterprise + } + } + public var path: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input.Path + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/PUT/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.CopilotSetEnterpriseCodingAgentPolicy.Input.Headers + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/PUT/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/PUT/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The policy state for Copilot coding agent in the enterprise. Can be one of `enabled_for_all_orgs`, `disabled_for_all_orgs`, `enabled_for_selected_orgs`, or `configured_by_org_admins`. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/PUT/requestBody/json/policy_state`. + @frozen public enum PolicyStatePayload: String, Codable, Hashable, Sendable, CaseIterable { + case enabledForAllOrgs = "enabled_for_all_orgs" + case disabledForAllOrgs = "disabled_for_all_orgs" + case enabledForSelectedOrgs = "enabled_for_selected_orgs" + case configuredByOrgAdmins = "configured_by_org_admins" + } + /// The policy state for Copilot coding agent in the enterprise. Can be one of `enabled_for_all_orgs`, `disabled_for_all_orgs`, `enabled_for_selected_orgs`, or `configured_by_org_admins`. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/PUT/requestBody/json/policy_state`. + public var policyState: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input.Body.JsonPayload.PolicyStatePayload + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - policyState: The policy state for Copilot coding agent in the enterprise. Can be one of `enabled_for_all_orgs`, `disabled_for_all_orgs`, `enabled_for_selected_orgs`, or `configured_by_org_admins`. + public init(policyState: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input.Body.JsonPayload.PolicyStatePayload) { + self.policyState = policyState + } + public enum CodingKeys: String, CodingKey { + case policyState = "policy_state" + } + } + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/PUT/requestBody/content/application\/json`. + case json(Operations.CopilotSetEnterpriseCodingAgentPolicy.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input.Path, + headers: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input.Headers = .init(), + body: Operations.CopilotSetEnterpriseCodingAgentPolicy.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + /// A header with no content is returned. + /// + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/put(copilot/set-enterprise-coding-agent-policy)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Components.Responses.NoContent) + /// A header with no content is returned. + /// + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/put(copilot/set-enterprise-coding-agent-policy)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + public static var noContent: Self { + .noContent(.init()) + } + /// The associated value of the enum case if `self` is `.noContent`. + /// + /// - Throws: An error if `self` is not `.noContent`. + /// - SeeAlso: `.noContent`. + public var noContent: Components.Responses.NoContent { + get throws { + switch self { + case let .noContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "noContent", + response: self + ) + } + } + } + /// Bad Request + /// + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/put(copilot/set-enterprise-coding-agent-policy)/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 + ) + } + } + } + /// 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 + ] + } + } + } + /// Add organizations to the enterprise coding agent policy + /// + /// Enables Copilot coding agent for the specified organizations within the enterprise. + /// + /// The enterprise's coding agent policy must be set to `enabled_for_selected_orgs` before + /// using this endpoint. Organizations can be specified by login or matched via custom properties. + /// + /// Only organizations that have Copilot enabled and belong to the enterprise will be affected. + /// + /// Only enterprise owners can add organizations to the coding agent policy. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `POST /enterprises/{enterprise}/copilot/policies/coding_agent/organizations`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/post(copilot/add-organizations-to-enterprise-coding-agent-policy)`. + public enum CopilotAddOrganizationsToEnterpriseCodingAgentPolicy { + public static let id: Swift.String = "copilot/add-organizations-to-enterprise-coding-agent-policy" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/path`. + public struct Path: Sendable, Hashable { + /// The slug version of the enterprise name. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/path/enterprise`. + public var enterprise: Components.Parameters.Enterprise + /// Creates a new `Path`. + /// + /// - Parameters: + /// - enterprise: The slug version of the enterprise name. + public init(enterprise: Components.Parameters.Enterprise) { + self.enterprise = enterprise + } + } + public var path: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Path + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/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.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Headers + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// List of organization logins within the enterprise to enable Copilot coding agent for. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/requestBody/json/organizations`. + public var organizations: [Swift.String]? + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/requestBody/json/CustomPropertiesPayload`. + public struct CustomPropertiesPayloadPayload: Codable, Hashable, Sendable { + /// The name of the custom property to filter by. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/requestBody/json/CustomPropertiesPayload/property_name`. + public var propertyName: Swift.String + /// The values of the custom property to match. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/requestBody/json/CustomPropertiesPayload/values`. + public var values: [Swift.String] + /// Creates a new `CustomPropertiesPayloadPayload`. + /// + /// - Parameters: + /// - propertyName: The name of the custom property to filter by. + /// - values: The values of the custom property to match. + public init( + propertyName: Swift.String, + values: [Swift.String] + ) { + self.propertyName = propertyName + self.values = values + } + public enum CodingKeys: String, CodingKey { + case propertyName = "property_name" + case values + } + } + /// List of custom property filters to match organizations. Organizations matching any of the specified property name/value pairs will be included. This is a one-time operation, setting the property on an organization in the future will not automatically update its coding agent policy. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/requestBody/json/custom_properties`. + public typealias CustomPropertiesPayload = [Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Body.JsonPayload.CustomPropertiesPayloadPayload] + /// List of custom property filters to match organizations. Organizations matching any of the specified property name/value pairs will be included. This is a one-time operation, setting the property on an organization in the future will not automatically update its coding agent policy. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/requestBody/json/custom_properties`. + public var customProperties: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Body.JsonPayload.CustomPropertiesPayload? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - organizations: List of organization logins within the enterprise to enable Copilot coding agent for. + /// - customProperties: List of custom property filters to match organizations. Organizations matching any of the specified property name/value pairs will be included. This is a one-time operation, setting the property on an organization in the future will not automatically update its coding agent policy. + public init( + organizations: [Swift.String]? = nil, + customProperties: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Body.JsonPayload.CustomPropertiesPayload? = nil + ) { + self.organizations = organizations + self.customProperties = customProperties + } + public enum CodingKeys: String, CodingKey { + case organizations + case customProperties = "custom_properties" + } + } + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/requestBody/content/application\/json`. + case json(Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Body.JsonPayload) + } + public var body: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Path, + headers: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Headers = .init(), + body: Operations.CopilotAddOrganizationsToEnterpriseCodingAgentPolicy.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + /// A header with no content is returned. + /// + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/post(copilot/add-organizations-to-enterprise-coding-agent-policy)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Components.Responses.NoContent) + /// A header with no content is returned. + /// + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/post(copilot/add-organizations-to-enterprise-coding-agent-policy)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + public static var noContent: Self { + .noContent(.init()) + } + /// The associated value of the enum case if `self` is `.noContent`. + /// + /// - Throws: An error if `self` is not `.noContent`. + /// - SeeAlso: `.noContent`. + public var noContent: Components.Responses.NoContent { + get throws { + switch self { + case let .noContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "noContent", + response: self + ) + } + } + } + /// Bad Request + /// + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/post(copilot/add-organizations-to-enterprise-coding-agent-policy)/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 + ) + } + } + } + /// 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 + ] + } + } + } + /// Remove organizations from the enterprise coding agent policy + /// + /// Disables Copilot coding agent for the specified organizations within the enterprise. + /// + /// The enterprise's coding agent policy must be set to `enabled_for_selected_orgs` before + /// using this endpoint. Organizations can be specified by login or matched via custom properties. + /// + /// Only organizations that have Copilot enabled and belong to the enterprise will be affected. + /// + /// Only enterprise owners can remove organizations from the coding agent policy. + /// + /// OAuth app tokens and personal access tokens (classic) need either the `manage_billing:copilot` or `admin:enterprise` scopes to use this endpoint. + /// + /// - Remark: HTTP `DELETE /enterprises/{enterprise}/copilot/policies/coding_agent/organizations`. + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/delete(copilot/remove-organizations-from-enterprise-coding-agent-policy)`. + public enum CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy { + public static let id: Swift.String = "copilot/remove-organizations-from-enterprise-coding-agent-policy" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/path`. + public struct Path: Sendable, Hashable { + /// The slug version of the enterprise name. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/path/enterprise`. + public var enterprise: Components.Parameters.Enterprise + /// Creates a new `Path`. + /// + /// - Parameters: + /// - enterprise: The slug version of the enterprise name. + public init(enterprise: Components.Parameters.Enterprise) { + self.enterprise = enterprise + } + } + public var path: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Path + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/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.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Headers + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// List of organization logins within the enterprise to disable Copilot coding agent for. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/requestBody/json/organizations`. + public var organizations: [Swift.String]? + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/requestBody/json/CustomPropertiesPayload`. + public struct CustomPropertiesPayloadPayload: Codable, Hashable, Sendable { + /// The name of the custom property to filter by. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/requestBody/json/CustomPropertiesPayload/property_name`. + public var propertyName: Swift.String + /// The values of the custom property to match. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/requestBody/json/CustomPropertiesPayload/values`. + public var values: [Swift.String] + /// Creates a new `CustomPropertiesPayloadPayload`. + /// + /// - Parameters: + /// - propertyName: The name of the custom property to filter by. + /// - values: The values of the custom property to match. + public init( + propertyName: Swift.String, + values: [Swift.String] + ) { + self.propertyName = propertyName + self.values = values + } + public enum CodingKeys: String, CodingKey { + case propertyName = "property_name" + case values + } + } + /// List of custom property filters to match organizations. Organizations matching any of the specified property name/value pairs will be included. This is a one-time operation, setting the property on an organization in the future will not automatically update its coding agent policy. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/requestBody/json/custom_properties`. + public typealias CustomPropertiesPayload = [Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Body.JsonPayload.CustomPropertiesPayloadPayload] + /// List of custom property filters to match organizations. Organizations matching any of the specified property name/value pairs will be included. This is a one-time operation, setting the property on an organization in the future will not automatically update its coding agent policy. + /// + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/requestBody/json/custom_properties`. + public var customProperties: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Body.JsonPayload.CustomPropertiesPayload? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - organizations: List of organization logins within the enterprise to disable Copilot coding agent for. + /// - customProperties: List of custom property filters to match organizations. Organizations matching any of the specified property name/value pairs will be included. This is a one-time operation, setting the property on an organization in the future will not automatically update its coding agent policy. + public init( + organizations: [Swift.String]? = nil, + customProperties: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Body.JsonPayload.CustomPropertiesPayload? = nil + ) { + self.organizations = organizations + self.customProperties = customProperties + } + public enum CodingKeys: String, CodingKey { + case organizations + case customProperties = "custom_properties" + } + } + /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/requestBody/content/application\/json`. + case json(Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Body.JsonPayload) + } + public var body: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Path, + headers: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Headers = .init(), + body: Operations.CopilotRemoveOrganizationsFromEnterpriseCodingAgentPolicy.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + /// A header with no content is returned. + /// + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/delete(copilot/remove-organizations-from-enterprise-coding-agent-policy)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Components.Responses.NoContent) + /// A header with no content is returned. + /// + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/delete(copilot/remove-organizations-from-enterprise-coding-agent-policy)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + public static var noContent: Self { + .noContent(.init()) + } + /// The associated value of the enum case if `self` is `.noContent`. + /// + /// - Throws: An error if `self` is not `.noContent`. + /// - SeeAlso: `.noContent`. + public var noContent: Components.Responses.NoContent { + get throws { + switch self { + case let .noContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "noContent", + response: self + ) + } + } + } + /// Bad Request + /// + /// - Remark: Generated from `#/paths//enterprises/{enterprise}/copilot/policies/coding_agent/organizations/delete(copilot/remove-organizations-from-enterprise-coding-agent-policy)/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 + ) + } + } + } + /// 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 Copilot seat information and settings for an organization /// /// > [!NOTE] diff --git a/Sources/dependabot/Client.swift b/Sources/dependabot/Client.swift index e69707b601d..716b10b154f 100644 --- a/Sources/dependabot/Client.swift +++ b/Sources/dependabot/Client.swift @@ -274,22 +274,23 @@ public struct Client: APIProtocol { } ) } - /// Lists the repositories Dependabot can access in an organization + /// List Dependabot alerts for an organization /// - /// Lists repositories that organization admins have allowed Dependabot to access when updating dependencies. - /// > [!NOTE] - /// > This operation supports both server-to-server and user-to-server access. - /// Unauthorized users will not see the existence of this endpoint. + /// Lists Dependabot alerts for an organization. /// - /// - Remark: HTTP `GET /organizations/{org}/dependabot/repository-access`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)`. - public func dependabotRepositoryAccessForOrg(_ input: Operations.DependabotRepositoryAccessForOrg.Input) async throws -> Operations.DependabotRepositoryAccessForOrg.Output { + /// The authenticated user must be an owner or security manager for the organization to use this endpoint. + /// + /// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. + /// + /// - Remark: HTTP `GET /orgs/{org}/dependabot/alerts`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)`. + public func dependabotListAlertsForOrg(_ input: Operations.DependabotListAlertsForOrg.Input) async throws -> Operations.DependabotListAlertsForOrg.Output { try await client.send( input: input, - forOperation: Operations.DependabotRepositoryAccessForOrg.id, + forOperation: Operations.DependabotListAlertsForOrg.id, serializer: { input in let path = try converter.renderedPath( - template: "/organizations/{}/dependabot/repository-access", + template: "/orgs/{}/dependabot/alerts", parameters: [ input.path.org ] @@ -303,8 +304,113 @@ public struct Client: APIProtocol { in: &request, style: .form, explode: true, - name: "page", - value: input.query.page + name: "classification", + value: input.query.classification + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "state", + value: input.query.state + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "severity", + value: input.query.severity + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "ecosystem", + value: input.query.ecosystem + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "package", + value: input.query.package + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "epss_percentage", + value: input.query.epssPercentage + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "artifact_registry_url", + value: input.query.artifactRegistryUrl + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "artifact_registry", + value: input.query.artifactRegistry + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "has", + value: input.query.has + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "assignee", + value: input.query.assignee + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "runtime_risk", + value: input.query.runtimeRisk + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "scope", + value: input.query.scope + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "sort", + value: input.query.sort + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "direction", + value: input.query.direction + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "before", + value: input.query.before + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "after", + value: input.query.after ) try converter.setQueryItemAsURI( in: &request, @@ -323,7 +429,7 @@ public struct Client: APIProtocol { switch response.status.code { case 200: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Operations.DependabotRepositoryAccessForOrg.Output.Ok.Body + let body: Operations.DependabotListAlertsForOrg.Output.Ok.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ @@ -333,7 +439,7 @@ public struct Client: APIProtocol { switch chosenContentType { case "application/json": body = try await converter.getResponseBodyAsJSON( - Components.Schemas.DependabotRepositoryAccessDetails.self, + [Components.Schemas.DependabotAlertWithRepository].self, from: responseBody, transforming: { value in .json(value) @@ -343,6 +449,39 @@ public struct Client: APIProtocol { preconditionFailure("bestContentType chose an invalid content type.") } return .ok(.init(body: body)) + case 304: + return .notModified(.init()) + 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 @@ -387,6 +526,28 @@ public struct Client: APIProtocol { preconditionFailure("bestContentType chose an invalid content type.") } return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailedSimple.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationErrorSimple.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .unprocessableContent(.init(body: body)) default: return .undocumented( statusCode: response.status.code, @@ -399,59 +560,75 @@ public struct Client: APIProtocol { } ) } - /// Updates Dependabot's repository access list for an organization - /// - /// Updates repositories according to the list of repositories that organization admins have given Dependabot access to when they've updated dependencies. + /// Lists the repositories Dependabot can access in an organization /// + /// Lists repositories that organization admins have allowed Dependabot to access when updating dependencies. /// > [!NOTE] /// > This operation supports both server-to-server and user-to-server access. /// Unauthorized users will not see the existence of this endpoint. /// - /// **Example request body:** - /// ```json - /// { - /// "repository_ids_to_add": [123, 456], - /// "repository_ids_to_remove": [789] - /// } - /// ``` - /// - /// - Remark: HTTP `PATCH /organizations/{org}/dependabot/repository-access`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)`. - public func dependabotUpdateRepositoryAccessForOrg(_ input: Operations.DependabotUpdateRepositoryAccessForOrg.Input) async throws -> Operations.DependabotUpdateRepositoryAccessForOrg.Output { + /// - Remark: HTTP `GET /orgs/{org}/dependabot/repository-access`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)`. + public func dependabotRepositoryAccessForOrg(_ input: Operations.DependabotRepositoryAccessForOrg.Input) async throws -> Operations.DependabotRepositoryAccessForOrg.Output { try await client.send( input: input, - forOperation: Operations.DependabotUpdateRepositoryAccessForOrg.id, + forOperation: Operations.DependabotRepositoryAccessForOrg.id, serializer: { input in let path = try converter.renderedPath( - template: "/organizations/{}/dependabot/repository-access", + template: "/orgs/{}/dependabot/repository-access", parameters: [ input.path.org ] ) var request: HTTPTypes.HTTPRequest = .init( soar_path: path, - method: .patch + method: .get ) suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "page", + value: input.query.page + ) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "per_page", + value: input.query.perPage + ) converter.setAcceptHeader( in: &request.headerFields, contentTypes: input.headers.accept ) - let body: OpenAPIRuntime.HTTPBody? - switch input.body { - case let .json(value): - body = try converter.setRequiredRequestBodyAsJSON( - value, - headerFields: &request.headerFields, - contentType: "application/json; charset=utf-8" - ) - } - return (request, body) + return (request, nil) }, deserializer: { response, responseBody in switch response.status.code { - case 204: - return .noContent(.init()) + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.DependabotRepositoryAccessForOrg.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.DependabotRepositoryAccessDetails.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 @@ -508,32 +685,38 @@ public struct Client: APIProtocol { } ) } - /// Set the default repository access level for Dependabot + /// Updates Dependabot's repository access list for an organization /// - /// Sets the default level of repository access Dependabot will have while performing an update. Available values are: - /// - 'public' - Dependabot will only have access to public repositories, unless access is explicitly granted to non-public repositories. - /// - 'internal' - Dependabot will only have access to public and internal repositories, unless access is explicitly granted to private repositories. + /// Updates repositories according to the list of repositories that organization admins have given Dependabot access to when they've updated dependencies. /// + /// > [!NOTE] + /// > This operation supports both server-to-server and user-to-server access. /// Unauthorized users will not see the existence of this endpoint. /// - /// This operation supports both server-to-server and user-to-server access. + /// **Example request body:** + /// ```json + /// { + /// "repository_ids_to_add": [123, 456], + /// "repository_ids_to_remove": [789] + /// } + /// ``` /// - /// - Remark: HTTP `PUT /organizations/{org}/dependabot/repository-access/default-level`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)`. - public func dependabotSetRepositoryAccessDefaultLevel(_ input: Operations.DependabotSetRepositoryAccessDefaultLevel.Input) async throws -> Operations.DependabotSetRepositoryAccessDefaultLevel.Output { + /// - Remark: HTTP `PATCH /orgs/{org}/dependabot/repository-access`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)`. + public func dependabotUpdateRepositoryAccessForOrg(_ input: Operations.DependabotUpdateRepositoryAccessForOrg.Input) async throws -> Operations.DependabotUpdateRepositoryAccessForOrg.Output { try await client.send( input: input, - forOperation: Operations.DependabotSetRepositoryAccessDefaultLevel.id, + forOperation: Operations.DependabotUpdateRepositoryAccessForOrg.id, serializer: { input in let path = try converter.renderedPath( - template: "/organizations/{}/dependabot/repository-access/default-level", + template: "/orgs/{}/dependabot/repository-access", parameters: [ input.path.org ] ) var request: HTTPTypes.HTTPRequest = .init( soar_path: path, - method: .put + method: .patch ) suppressMutabilityWarning(&request) converter.setAcceptHeader( @@ -611,214 +794,53 @@ public struct Client: APIProtocol { } ) } - /// List Dependabot alerts for an organization + /// Set the default repository access level for Dependabot /// - /// Lists Dependabot alerts for an organization. + /// Sets the default level of repository access Dependabot will have while performing an update. Available values are: + /// - 'public' - Dependabot will only have access to public repositories, unless access is explicitly granted to non-public repositories. + /// - 'internal' - Dependabot will only have access to public and internal repositories, unless access is explicitly granted to private repositories. /// - /// The authenticated user must be an owner or security manager for the organization to use this endpoint. + /// Unauthorized users will not see the existence of this endpoint. /// - /// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. + /// This operation supports both server-to-server and user-to-server access. /// - /// - Remark: HTTP `GET /orgs/{org}/dependabot/alerts`. - /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)`. - public func dependabotListAlertsForOrg(_ input: Operations.DependabotListAlertsForOrg.Input) async throws -> Operations.DependabotListAlertsForOrg.Output { + /// - Remark: HTTP `PUT /orgs/{org}/dependabot/repository-access/default-level`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)`. + public func dependabotSetRepositoryAccessDefaultLevel(_ input: Operations.DependabotSetRepositoryAccessDefaultLevel.Input) async throws -> Operations.DependabotSetRepositoryAccessDefaultLevel.Output { try await client.send( input: input, - forOperation: Operations.DependabotListAlertsForOrg.id, + forOperation: Operations.DependabotSetRepositoryAccessDefaultLevel.id, serializer: { input in let path = try converter.renderedPath( - template: "/orgs/{}/dependabot/alerts", + template: "/orgs/{}/dependabot/repository-access/default-level", parameters: [ input.path.org ] ) var request: HTTPTypes.HTTPRequest = .init( soar_path: path, - method: .get + method: .put ) suppressMutabilityWarning(&request) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "classification", - value: input.query.classification - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "state", - value: input.query.state - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "severity", - value: input.query.severity - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "ecosystem", - value: input.query.ecosystem - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "package", - value: input.query.package - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "epss_percentage", - value: input.query.epssPercentage - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "artifact_registry_url", - value: input.query.artifactRegistryUrl - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "artifact_registry", - value: input.query.artifactRegistry - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "has", - value: input.query.has - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "assignee", - value: input.query.assignee - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "runtime_risk", - value: input.query.runtimeRisk - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "scope", - value: input.query.scope - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "sort", - value: input.query.sort - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "direction", - value: input.query.direction - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "before", - value: input.query.before - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "after", - value: input.query.after - ) - try converter.setQueryItemAsURI( - in: &request, - style: .form, - explode: true, - name: "per_page", - value: input.query.perPage - ) converter.setAcceptHeader( in: &request.headerFields, contentTypes: input.headers.accept ) - return (request, nil) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case let .json(value): + body = try converter.setRequiredRequestBodyAsJSON( + 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.DependabotListAlertsForOrg.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.DependabotAlertWithRepository].self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .ok(.init(body: body)) - case 304: - return .notModified(.init()) - 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 204: + return .noContent(.init()) case 403: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) let body: Components.Responses.Forbidden.Body @@ -863,28 +885,6 @@ public struct Client: APIProtocol { preconditionFailure("bestContentType chose an invalid content type.") } return .notFound(.init(body: body)) - case 422: - let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Components.Responses.ValidationFailedSimple.Body - let chosenContentType = try converter.bestContentType( - received: contentType, - options: [ - "application/json" - ] - ) - switch chosenContentType { - case "application/json": - body = try await converter.getResponseBodyAsJSON( - Components.Schemas.ValidationErrorSimple.self, - from: responseBody, - transforming: { value in - .json(value) - } - ) - default: - preconditionFailure("bestContentType chose an invalid content type.") - } - return .unprocessableContent(.init(body: body)) default: return .undocumented( statusCode: response.status.code, diff --git a/Sources/dependabot/Types.swift b/Sources/dependabot/Types.swift index 7da680974cc..f3e34fbb733 100644 --- a/Sources/dependabot/Types.swift +++ b/Sources/dependabot/Types.swift @@ -24,6 +24,17 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `GET /enterprises/{enterprise}/dependabot/alerts`. /// - Remark: Generated from `#/paths//enterprises/{enterprise}/dependabot/alerts/get(dependabot/list-alerts-for-enterprise)`. func dependabotListAlertsForEnterprise(_ input: Operations.DependabotListAlertsForEnterprise.Input) async throws -> Operations.DependabotListAlertsForEnterprise.Output + /// List Dependabot alerts for an organization + /// + /// Lists Dependabot alerts for an organization. + /// + /// The authenticated user must be an owner or security manager for the organization to use this endpoint. + /// + /// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. + /// + /// - Remark: HTTP `GET /orgs/{org}/dependabot/alerts`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)`. + func dependabotListAlertsForOrg(_ input: Operations.DependabotListAlertsForOrg.Input) async throws -> Operations.DependabotListAlertsForOrg.Output /// Lists the repositories Dependabot can access in an organization /// /// Lists repositories that organization admins have allowed Dependabot to access when updating dependencies. @@ -31,8 +42,8 @@ public protocol APIProtocol: Sendable { /// > This operation supports both server-to-server and user-to-server access. /// Unauthorized users will not see the existence of this endpoint. /// - /// - Remark: HTTP `GET /organizations/{org}/dependabot/repository-access`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)`. + /// - Remark: HTTP `GET /orgs/{org}/dependabot/repository-access`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)`. func dependabotRepositoryAccessForOrg(_ input: Operations.DependabotRepositoryAccessForOrg.Input) async throws -> Operations.DependabotRepositoryAccessForOrg.Output /// Updates Dependabot's repository access list for an organization /// @@ -50,8 +61,8 @@ public protocol APIProtocol: Sendable { /// } /// ``` /// - /// - Remark: HTTP `PATCH /organizations/{org}/dependabot/repository-access`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)`. + /// - Remark: HTTP `PATCH /orgs/{org}/dependabot/repository-access`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)`. func dependabotUpdateRepositoryAccessForOrg(_ input: Operations.DependabotUpdateRepositoryAccessForOrg.Input) async throws -> Operations.DependabotUpdateRepositoryAccessForOrg.Output /// Set the default repository access level for Dependabot /// @@ -63,20 +74,9 @@ public protocol APIProtocol: Sendable { /// /// This operation supports both server-to-server and user-to-server access. /// - /// - Remark: HTTP `PUT /organizations/{org}/dependabot/repository-access/default-level`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)`. + /// - Remark: HTTP `PUT /orgs/{org}/dependabot/repository-access/default-level`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)`. func dependabotSetRepositoryAccessDefaultLevel(_ input: Operations.DependabotSetRepositoryAccessDefaultLevel.Input) async throws -> Operations.DependabotSetRepositoryAccessDefaultLevel.Output - /// List Dependabot alerts for an organization - /// - /// Lists Dependabot alerts for an organization. - /// - /// The authenticated user must be an owner or security manager for the organization to use this endpoint. - /// - /// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. - /// - /// - Remark: HTTP `GET /orgs/{org}/dependabot/alerts`. - /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)`. - func dependabotListAlertsForOrg(_ input: Operations.DependabotListAlertsForOrg.Input) async throws -> Operations.DependabotListAlertsForOrg.Output /// List organization secrets /// /// Lists all secrets available in an organization without revealing their @@ -267,6 +267,27 @@ extension APIProtocol { headers: headers )) } + /// List Dependabot alerts for an organization + /// + /// Lists Dependabot alerts for an organization. + /// + /// The authenticated user must be an owner or security manager for the organization to use this endpoint. + /// + /// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. + /// + /// - Remark: HTTP `GET /orgs/{org}/dependabot/alerts`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)`. + public func dependabotListAlertsForOrg( + path: Operations.DependabotListAlertsForOrg.Input.Path, + query: Operations.DependabotListAlertsForOrg.Input.Query = .init(), + headers: Operations.DependabotListAlertsForOrg.Input.Headers = .init() + ) async throws -> Operations.DependabotListAlertsForOrg.Output { + try await dependabotListAlertsForOrg(Operations.DependabotListAlertsForOrg.Input( + path: path, + query: query, + headers: headers + )) + } /// Lists the repositories Dependabot can access in an organization /// /// Lists repositories that organization admins have allowed Dependabot to access when updating dependencies. @@ -274,8 +295,8 @@ extension APIProtocol { /// > This operation supports both server-to-server and user-to-server access. /// Unauthorized users will not see the existence of this endpoint. /// - /// - Remark: HTTP `GET /organizations/{org}/dependabot/repository-access`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)`. + /// - Remark: HTTP `GET /orgs/{org}/dependabot/repository-access`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)`. public func dependabotRepositoryAccessForOrg( path: Operations.DependabotRepositoryAccessForOrg.Input.Path, query: Operations.DependabotRepositoryAccessForOrg.Input.Query = .init(), @@ -303,8 +324,8 @@ extension APIProtocol { /// } /// ``` /// - /// - Remark: HTTP `PATCH /organizations/{org}/dependabot/repository-access`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)`. + /// - Remark: HTTP `PATCH /orgs/{org}/dependabot/repository-access`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)`. public func dependabotUpdateRepositoryAccessForOrg( path: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Path, headers: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Headers = .init(), @@ -326,8 +347,8 @@ extension APIProtocol { /// /// This operation supports both server-to-server and user-to-server access. /// - /// - Remark: HTTP `PUT /organizations/{org}/dependabot/repository-access/default-level`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)`. + /// - Remark: HTTP `PUT /orgs/{org}/dependabot/repository-access/default-level`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)`. public func dependabotSetRepositoryAccessDefaultLevel( path: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Path, headers: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Headers = .init(), @@ -339,27 +360,6 @@ extension APIProtocol { body: body )) } - /// List Dependabot alerts for an organization - /// - /// Lists Dependabot alerts for an organization. - /// - /// The authenticated user must be an owner or security manager for the organization to use this endpoint. - /// - /// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. - /// - /// - Remark: HTTP `GET /orgs/{org}/dependabot/alerts`. - /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)`. - public func dependabotListAlertsForOrg( - path: Operations.DependabotListAlertsForOrg.Input.Path, - query: Operations.DependabotListAlertsForOrg.Input.Query = .init(), - headers: Operations.DependabotListAlertsForOrg.Input.Headers = .init() - ) async throws -> Operations.DependabotListAlertsForOrg.Output { - try await dependabotListAlertsForOrg(Operations.DependabotListAlertsForOrg.Input( - path: path, - query: query, - headers: headers - )) - } /// List organization secrets /// /// Lists all secrets available in an organization without revealing their @@ -3615,6 +3615,16 @@ public enum Components { case customProperties = "custom_properties" } } + /// An object without any properties. + /// + /// - Remark: Generated from `#/components/schemas/empty-object`. + public struct EmptyObject: Codable, Hashable, Sendable { + /// Creates a new `EmptyObject`. + public init() {} + public init(from decoder: any Swift.Decoder) throws { + try decoder.ensureNoAdditionalProperties(knownKeys: []) + } + } /// A GitHub repository. /// /// - Remark: Generated from `#/components/schemas/nullable-simple-repository`. @@ -4043,16 +4053,6 @@ public enum Components { ]) } } - /// An object without any properties. - /// - /// - Remark: Generated from `#/components/schemas/empty-object`. - public struct EmptyObject: Codable, Hashable, Sendable { - /// Creates a new `EmptyObject`. - public init() {} - public init(from decoder: any Swift.Decoder) throws { - try decoder.ensureNoAdditionalProperties(knownKeys: []) - } - } /// Secrets for GitHub Dependabot for an organization. /// /// - Remark: Generated from `#/components/schemas/organization-dependabot-secret`. @@ -5302,23 +5302,24 @@ public enum Operations { } } } - /// Lists the repositories Dependabot can access in an organization + /// List Dependabot alerts for an organization /// - /// Lists repositories that organization admins have allowed Dependabot to access when updating dependencies. - /// > [!NOTE] - /// > This operation supports both server-to-server and user-to-server access. - /// Unauthorized users will not see the existence of this endpoint. + /// Lists Dependabot alerts for an organization. /// - /// - Remark: HTTP `GET /organizations/{org}/dependabot/repository-access`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)`. - public enum DependabotRepositoryAccessForOrg { - public static let id: Swift.String = "dependabot/repository-access-for-org" + /// The authenticated user must be an owner or security manager for the organization to use this endpoint. + /// + /// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. + /// + /// - Remark: HTTP `GET /orgs/{org}/dependabot/alerts`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)`. + public enum DependabotListAlertsForOrg { + public static let id: Swift.String = "dependabot/list-alerts-for-org" public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/GET/path`. + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/path`. public struct Path: Sendable, Hashable { /// The organization name. The name is not case sensitive. /// - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/GET/path/org`. + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/path/org`. public var org: Components.Parameters.Org /// Creates a new `Path`. /// @@ -5328,99 +5329,285 @@ public enum Operations { self.org = org } } - public var path: Operations.DependabotRepositoryAccessForOrg.Input.Path - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/GET/query`. + public var path: Operations.DependabotListAlertsForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query`. public struct Query: Sendable, Hashable { - /// The page number of results to fetch. + /// A comma-separated list of vulnerability classifications. If specified, only alerts for vulnerabilities with these classifications will be returned. /// - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/GET/query/page`. - public var page: Swift.Int? - /// Number of results per page. + /// Can be: `malware`, `general` /// - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/GET/query/per_page`. - public var perPage: Swift.Int? - /// Creates a new `Query`. + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/classification`. + public var classification: Components.Parameters.DependabotAlertCommaSeparatedClassifications? + /// A comma-separated list of states. If specified, only alerts with these states will be returned. /// - /// - Parameters: - /// - page: The page number of results to fetch. - /// - perPage: Number of results per page. - public init( - page: Swift.Int? = nil, - perPage: Swift.Int? = nil - ) { - self.page = page - self.perPage = perPage - } - } - public var query: Operations.DependabotRepositoryAccessForOrg.Input.Query - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/GET/header`. - public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] - /// Creates a new `Headers`. + /// Can be: `auto_dismissed`, `dismissed`, `fixed`, `open` /// - /// - Parameters: - /// - accept: - public init(accept: [OpenAPIRuntime.AcceptHeaderContentType] = .defaultValues()) { - self.accept = accept - } - } - public var headers: Operations.DependabotRepositoryAccessForOrg.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - path: - /// - query: - /// - headers: - public init( - path: Operations.DependabotRepositoryAccessForOrg.Input.Path, - query: Operations.DependabotRepositoryAccessForOrg.Input.Query = .init(), - headers: Operations.DependabotRepositoryAccessForOrg.Input.Headers = .init() - ) { - self.path = path - self.query = query - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/GET/responses/200/content/application\/json`. - case json(Components.Schemas.DependabotRepositoryAccessDetails) - /// 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.DependabotRepositoryAccessDetails { - get throws { - switch self { - case let .json(body): - return body - } + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/state`. + public var state: Components.Parameters.DependabotAlertCommaSeparatedStates? + /// A comma-separated list of severities. If specified, only alerts with these severities will be returned. + /// + /// Can be: `low`, `medium`, `high`, `critical` + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/severity`. + public var severity: Components.Parameters.DependabotAlertCommaSeparatedSeverities? + /// A comma-separated list of ecosystems. If specified, only alerts for these ecosystems will be returned. + /// + /// Can be: `composer`, `go`, `maven`, `npm`, `nuget`, `pip`, `pub`, `rubygems`, `rust` + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/ecosystem`. + public var ecosystem: Components.Parameters.DependabotAlertCommaSeparatedEcosystems? + /// A comma-separated list of package names. If specified, only alerts for these packages will be returned. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/package`. + public var package: Components.Parameters.DependabotAlertCommaSeparatedPackages? + /// CVE Exploit Prediction Scoring System (EPSS) percentage. Can be specified as: + /// - An exact number (`n`) + /// - Comparators such as `>n`, `=n`, `<=n` + /// - A range like `n..n`, where `n` is a number from 0.0 to 1.0 + /// + /// Filters the list of alerts based on EPSS percentages. If specified, only alerts with the provided EPSS percentages will be returned. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/epss_percentage`. + public var epssPercentage: Components.Parameters.DependabotAlertCommaSeparatedEpss? + /// A comma-separated list of artifact registry URLs. If specified, only alerts for repositories with storage records matching these URLs will be returned. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/artifact_registry_url`. + public var artifactRegistryUrl: Components.Parameters.DependabotAlertCommaSeparatedArtifactRegistryUrls? + /// A comma-separated list of Artifact Registry name strings. If specified, only alerts for repositories with storage records matching these registries will be returned. + /// + /// Can be: `jfrog-artifactory` + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/artifact_registry`. + public var artifactRegistry: Components.Parameters.DependabotAlertCommaSeparatedArtifactRegistry? + /// - Remark: Generated from `#/components/parameters/dependabot-alert-org-scope-comma-separated-has`. + @frozen public enum DependabotAlertOrgScopeCommaSeparatedHas: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/parameters/dependabot-alert-org-scope-comma-separated-has/case1`. + case case1(Swift.String) + /// - Remark: Generated from `#/components/parameters/dependabot-alert-org-scope-comma-separated-has/Case2Payload`. + @frozen public enum Case2PayloadPayload: String, Codable, Hashable, Sendable, CaseIterable { + case patch = "patch" + case deployment = "deployment" + } + /// - Remark: Generated from `#/components/parameters/dependabot-alert-org-scope-comma-separated-has/case2`. + public typealias Case2Payload = [Components.Parameters.DependabotAlertOrgScopeCommaSeparatedHas.Case2PayloadPayload] + /// - Remark: Generated from `#/components/parameters/dependabot-alert-org-scope-comma-separated-has/case2`. + case case2(Components.Parameters.DependabotAlertOrgScopeCommaSeparatedHas.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) } } } - /// Received HTTP response body - public var body: Operations.DependabotRepositoryAccessForOrg.Output.Ok.Body - /// Creates a new `Ok`. + /// Filters the list of alerts based on whether the alert has the given value. If specified, only alerts meeting this criterion will be returned. + /// Multiple `has` filters can be passed to filter for alerts that have all of the values. /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.DependabotRepositoryAccessForOrg.Output.Ok.Body) { - self.body = body - } - } + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/has`. + public var has: Components.Parameters.DependabotAlertOrgScopeCommaSeparatedHas? + /// Filter alerts by assignees. + /// Provide a comma-separated list of user handles (e.g., `octocat` or `octocat,hubot`) to return alerts assigned to any of the specified users. + /// Use `*` to list alerts with at least one assignee or `none` to list alerts with no assignees. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/assignee`. + public var assignee: Components.Parameters.DependabotAlertCommaSeparatedAssignees? + /// A comma-separated list of runtime risk strings. If specified, only alerts for repositories with deployment records matching these risks will be returned. + /// + /// Can be: `critical-resource`, `internet-exposed`, `sensitive-data`, `lateral-movement` + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/runtime_risk`. + public var runtimeRisk: Components.Parameters.DependabotAlertCommaSeparatedRuntimeRisk? + /// - Remark: Generated from `#/components/parameters/dependabot-alert-scope`. + @frozen public enum DependabotAlertScope: String, Codable, Hashable, Sendable, CaseIterable { + case development = "development" + case runtime = "runtime" + } + /// The scope of the vulnerable dependency. If specified, only alerts with this scope will be returned. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/scope`. + public var scope: Components.Parameters.DependabotAlertScope? + /// - Remark: Generated from `#/components/parameters/dependabot-alert-sort`. + @frozen public enum DependabotAlertSort: String, Codable, Hashable, Sendable, CaseIterable { + case created = "created" + case updated = "updated" + case epssPercentage = "epss_percentage" + } + /// The property by which to sort the results. + /// `created` means when the alert was created. + /// `updated` means when the alert's state last changed. + /// `epss_percentage` sorts alerts by the Exploit Prediction Scoring System (EPSS) percentage. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/sort`. + public var sort: Components.Parameters.DependabotAlertSort? + /// - Remark: Generated from `#/components/parameters/direction`. + @frozen public enum Direction: String, Codable, Hashable, Sendable, CaseIterable { + case asc = "asc" + case desc = "desc" + } + /// The direction to sort the results by. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/direction`. + public var direction: Components.Parameters.Direction? + /// A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. 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}/dependabot/alerts/GET/query/before`. + public var before: Components.Parameters.PaginationBefore? + /// A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. 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}/dependabot/alerts/GET/query/after`. + public var after: Components.Parameters.PaginationAfter? + /// 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}/dependabot/alerts/GET/query/per_page`. + public var perPage: Components.Parameters.PerPage? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - classification: A comma-separated list of vulnerability classifications. If specified, only alerts for vulnerabilities with these classifications will be returned. + /// - state: A comma-separated list of states. If specified, only alerts with these states will be returned. + /// - severity: A comma-separated list of severities. If specified, only alerts with these severities will be returned. + /// - ecosystem: A comma-separated list of ecosystems. If specified, only alerts for these ecosystems will be returned. + /// - package: A comma-separated list of package names. If specified, only alerts for these packages will be returned. + /// - epssPercentage: CVE Exploit Prediction Scoring System (EPSS) percentage. Can be specified as: + /// - artifactRegistryUrl: A comma-separated list of artifact registry URLs. If specified, only alerts for repositories with storage records matching these URLs will be returned. + /// - artifactRegistry: A comma-separated list of Artifact Registry name strings. If specified, only alerts for repositories with storage records matching these registries will be returned. + /// - has: Filters the list of alerts based on whether the alert has the given value. If specified, only alerts meeting this criterion will be returned. + /// - assignee: Filter alerts by assignees. + /// - runtimeRisk: A comma-separated list of runtime risk strings. If specified, only alerts for repositories with deployment records matching these risks will be returned. + /// - scope: The scope of the vulnerable dependency. If specified, only alerts with this scope will be returned. + /// - sort: The property by which to sort the results. + /// - direction: The direction to sort the results by. + /// - before: A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. 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)." + /// - after: A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. 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)." + /// - 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)." + public init( + classification: Components.Parameters.DependabotAlertCommaSeparatedClassifications? = nil, + state: Components.Parameters.DependabotAlertCommaSeparatedStates? = nil, + severity: Components.Parameters.DependabotAlertCommaSeparatedSeverities? = nil, + ecosystem: Components.Parameters.DependabotAlertCommaSeparatedEcosystems? = nil, + package: Components.Parameters.DependabotAlertCommaSeparatedPackages? = nil, + epssPercentage: Components.Parameters.DependabotAlertCommaSeparatedEpss? = nil, + artifactRegistryUrl: Components.Parameters.DependabotAlertCommaSeparatedArtifactRegistryUrls? = nil, + artifactRegistry: Components.Parameters.DependabotAlertCommaSeparatedArtifactRegistry? = nil, + has: Components.Parameters.DependabotAlertOrgScopeCommaSeparatedHas? = nil, + assignee: Components.Parameters.DependabotAlertCommaSeparatedAssignees? = nil, + runtimeRisk: Components.Parameters.DependabotAlertCommaSeparatedRuntimeRisk? = nil, + scope: Components.Parameters.DependabotAlertScope? = nil, + sort: Components.Parameters.DependabotAlertSort? = nil, + direction: Components.Parameters.Direction? = nil, + before: Components.Parameters.PaginationBefore? = nil, + after: Components.Parameters.PaginationAfter? = nil, + perPage: Components.Parameters.PerPage? = nil + ) { + self.classification = classification + self.state = state + self.severity = severity + self.ecosystem = ecosystem + self.package = package + self.epssPercentage = epssPercentage + self.artifactRegistryUrl = artifactRegistryUrl + self.artifactRegistry = artifactRegistry + self.has = has + self.assignee = assignee + self.runtimeRisk = runtimeRisk + self.scope = scope + self.sort = sort + self.direction = direction + self.before = before + self.after = after + self.perPage = perPage + } + } + public var query: Operations.DependabotListAlertsForOrg.Input.Query + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/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.DependabotListAlertsForOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + public init( + path: Operations.DependabotListAlertsForOrg.Input.Path, + query: Operations.DependabotListAlertsForOrg.Input.Query = .init(), + headers: Operations.DependabotListAlertsForOrg.Input.Headers = .init() + ) { + self.path = path + self.query = query + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/responses/200/content/application\/json`. + case json([Components.Schemas.DependabotAlertWithRepository]) + /// 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.DependabotAlertWithRepository] { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.DependabotListAlertsForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.DependabotListAlertsForOrg.Output.Ok.Body) { + self.body = body + } + } /// Response /// - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)/responses/200`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/200`. /// /// HTTP response code: `200 ok`. - case ok(Operations.DependabotRepositoryAccessForOrg.Output.Ok) + case ok(Operations.DependabotListAlertsForOrg.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.DependabotRepositoryAccessForOrg.Output.Ok { + public var ok: Operations.DependabotListAlertsForOrg.Output.Ok { get throws { switch self { case let .ok(response): @@ -5433,9 +5620,63 @@ public enum Operations { } } } + /// Not modified + /// + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/304`. + /// + /// HTTP response code: `304 notModified`. + case notModified(Components.Responses.NotModified) + /// Not modified + /// + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/304`. + /// + /// HTTP response code: `304 notModified`. + public static var notModified: Self { + .notModified(.init()) + } + /// The associated value of the enum case if `self` is `.notModified`. + /// + /// - Throws: An error if `self` is not `.notModified`. + /// - SeeAlso: `.notModified`. + public var notModified: Components.Responses.NotModified { + get throws { + switch self { + case let .notModified(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notModified", + response: self + ) + } + } + } + /// Bad Request + /// + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-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}/dependabot/repository-access/get(dependabot/repository-access-for-org)/responses/403`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/403`. /// /// HTTP response code: `403 forbidden`. case forbidden(Components.Responses.Forbidden) @@ -5458,7 +5699,7 @@ public enum Operations { } /// Resource not found /// - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)/responses/404`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/404`. /// /// HTTP response code: `404 notFound`. case notFound(Components.Responses.NotFound) @@ -5479,63 +5720,83 @@ public enum Operations { } } } - /// Undocumented response. + /// Validation failed, or the endpoint has been spammed. /// - /// 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" + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailedSimple) + /// 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.ValidationFailedSimple { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + 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 + .json, + .applicationScimJson ] } } } - /// Updates Dependabot's repository access list for an organization - /// - /// Updates repositories according to the list of repositories that organization admins have given Dependabot access to when they've updated dependencies. + /// Lists the repositories Dependabot can access in an organization /// + /// Lists repositories that organization admins have allowed Dependabot to access when updating dependencies. /// > [!NOTE] /// > This operation supports both server-to-server and user-to-server access. /// Unauthorized users will not see the existence of this endpoint. /// - /// **Example request body:** - /// ```json - /// { - /// "repository_ids_to_add": [123, 456], - /// "repository_ids_to_remove": [789] - /// } - /// ``` - /// - /// - Remark: HTTP `PATCH /organizations/{org}/dependabot/repository-access`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)`. - public enum DependabotUpdateRepositoryAccessForOrg { - public static let id: Swift.String = "dependabot/update-repository-access-for-org" + /// - Remark: HTTP `GET /orgs/{org}/dependabot/repository-access`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)`. + public enum DependabotRepositoryAccessForOrg { + public static let id: Swift.String = "dependabot/repository-access-for-org" public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/PATCH/path`. + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/GET/path`. public struct Path: Sendable, Hashable { /// The organization name. The name is not case sensitive. /// - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/PATCH/path/org`. + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/GET/path/org`. public var org: Components.Parameters.Org /// Creates a new `Path`. /// @@ -5545,99 +5806,106 @@ public enum Operations { self.org = org } } - public var path: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Path - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/PATCH/header`. + public var path: Operations.DependabotRepositoryAccessForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/GET/query`. + public struct Query: Sendable, Hashable { + /// The page number of results to fetch. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/GET/query/page`. + public var page: Swift.Int? + /// Number of results per page. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/GET/query/per_page`. + public var perPage: Swift.Int? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - page: The page number of results to fetch. + /// - perPage: Number of results per page. + public init( + page: Swift.Int? = nil, + perPage: Swift.Int? = nil + ) { + self.page = page + self.perPage = perPage + } + } + public var query: Operations.DependabotRepositoryAccessForOrg.Input.Query + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/GET/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + 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.DependabotUpdateRepositoryAccessForOrg.Input.Headers - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/PATCH/requestBody`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/PATCH/requestBody/json`. - public struct JsonPayload: Codable, Hashable, Sendable { - /// List of repository IDs to add. - /// - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/PATCH/requestBody/json/repository_ids_to_add`. - public var repositoryIdsToAdd: [Swift.Int]? - /// List of repository IDs to remove. - /// - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/PATCH/requestBody/json/repository_ids_to_remove`. - public var repositoryIdsToRemove: [Swift.Int]? - /// Creates a new `JsonPayload`. - /// - /// - Parameters: - /// - repositoryIdsToAdd: List of repository IDs to add. - /// - repositoryIdsToRemove: List of repository IDs to remove. - public init( - repositoryIdsToAdd: [Swift.Int]? = nil, - repositoryIdsToRemove: [Swift.Int]? = nil - ) { - self.repositoryIdsToAdd = repositoryIdsToAdd - self.repositoryIdsToRemove = repositoryIdsToRemove - } - public enum CodingKeys: String, CodingKey { - case repositoryIdsToAdd = "repository_ids_to_add" - case repositoryIdsToRemove = "repository_ids_to_remove" - } - } - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/PATCH/requestBody/content/application\/json`. - case json(Operations.DependabotUpdateRepositoryAccessForOrg.Input.Body.JsonPayload) - } - public var body: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Body + public var headers: Operations.DependabotRepositoryAccessForOrg.Input.Headers /// Creates a new `Input`. /// /// - Parameters: /// - path: + /// - query: /// - headers: - /// - body: public init( - path: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Path, - headers: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Headers = .init(), - body: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Body + path: Operations.DependabotRepositoryAccessForOrg.Input.Path, + query: Operations.DependabotRepositoryAccessForOrg.Input.Query = .init(), + headers: Operations.DependabotRepositoryAccessForOrg.Input.Headers = .init() ) { self.path = path + self.query = query self.headers = headers - self.body = body } } @frozen public enum Output: Sendable, Hashable { - public struct NoContent: Sendable, Hashable { - /// Creates a new `NoContent`. - public init() {} + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/GET/responses/200/content/application\/json`. + case json(Components.Schemas.DependabotRepositoryAccessDetails) + /// 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.DependabotRepositoryAccessDetails { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.DependabotRepositoryAccessForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.DependabotRepositoryAccessForOrg.Output.Ok.Body) { + self.body = body + } } /// Response /// - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)/responses/204`. - /// - /// HTTP response code: `204 noContent`. - case noContent(Operations.DependabotUpdateRepositoryAccessForOrg.Output.NoContent) - /// Response - /// - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)/responses/204`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)/responses/200`. /// - /// HTTP response code: `204 noContent`. - public static var noContent: Self { - .noContent(.init()) - } - /// The associated value of the enum case if `self` is `.noContent`. + /// HTTP response code: `200 ok`. + case ok(Operations.DependabotRepositoryAccessForOrg.Output.Ok) + /// The associated value of the enum case if `self` is `.ok`. /// - /// - Throws: An error if `self` is not `.noContent`. - /// - SeeAlso: `.noContent`. - public var noContent: Operations.DependabotUpdateRepositoryAccessForOrg.Output.NoContent { + /// - Throws: An error if `self` is not `.ok`. + /// - SeeAlso: `.ok`. + public var ok: Operations.DependabotRepositoryAccessForOrg.Output.Ok { get throws { switch self { - case let .noContent(response): + case let .ok(response): return response default: try throwUnexpectedResponseStatus( - expectedStatus: "noContent", + expectedStatus: "ok", response: self ) } @@ -5645,7 +5913,7 @@ public enum Operations { } /// Forbidden /// - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)/responses/403`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)/responses/403`. /// /// HTTP response code: `403 forbidden`. case forbidden(Components.Responses.Forbidden) @@ -5668,7 +5936,7 @@ public enum Operations { } /// Resource not found /// - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)/responses/404`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/get(dependabot/repository-access-for-org)/responses/404`. /// /// HTTP response code: `404 notFound`. case notFound(Components.Responses.NotFound) @@ -5720,26 +5988,32 @@ public enum Operations { } } } - /// Set the default repository access level for Dependabot + /// Updates Dependabot's repository access list for an organization /// - /// Sets the default level of repository access Dependabot will have while performing an update. Available values are: - /// - 'public' - Dependabot will only have access to public repositories, unless access is explicitly granted to non-public repositories. - /// - 'internal' - Dependabot will only have access to public and internal repositories, unless access is explicitly granted to private repositories. + /// Updates repositories according to the list of repositories that organization admins have given Dependabot access to when they've updated dependencies. /// + /// > [!NOTE] + /// > This operation supports both server-to-server and user-to-server access. /// Unauthorized users will not see the existence of this endpoint. /// - /// This operation supports both server-to-server and user-to-server access. + /// **Example request body:** + /// ```json + /// { + /// "repository_ids_to_add": [123, 456], + /// "repository_ids_to_remove": [789] + /// } + /// ``` /// - /// - Remark: HTTP `PUT /organizations/{org}/dependabot/repository-access/default-level`. - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)`. - public enum DependabotSetRepositoryAccessDefaultLevel { - public static let id: Swift.String = "dependabot/set-repository-access-default-level" + /// - Remark: HTTP `PATCH /orgs/{org}/dependabot/repository-access`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)`. + public enum DependabotUpdateRepositoryAccessForOrg { + public static let id: Swift.String = "dependabot/update-repository-access-for-org" public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/default-level/PUT/path`. + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/PATCH/path`. public struct Path: Sendable, Hashable { /// The organization name. The name is not case sensitive. /// - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/default-level/PUT/path/org`. + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/PATCH/path/org`. public var org: Components.Parameters.Org /// Creates a new `Path`. /// @@ -5749,545 +6023,300 @@ public enum Operations { self.org = org } } - public var path: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Path - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/default-level/PUT/header`. + public var path: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/PATCH/header`. public struct Headers: Sendable, Hashable { - public var accept: [OpenAPIRuntime.AcceptHeaderContentType] + 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.DependabotSetRepositoryAccessDefaultLevel.Input.Headers - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/default-level/PUT/requestBody`. + public var headers: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Headers + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/PATCH/requestBody`. @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/default-level/PUT/requestBody/json`. + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/PATCH/requestBody/json`. public struct JsonPayload: Codable, Hashable, Sendable { - /// The default repository access level for Dependabot updates. + /// List of repository IDs to add. /// - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/default-level/PUT/requestBody/json/default_level`. - @frozen public enum DefaultLevelPayload: String, Codable, Hashable, Sendable, CaseIterable { - case _public = "public" - case _internal = "internal" - } - /// The default repository access level for Dependabot updates. + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/PATCH/requestBody/json/repository_ids_to_add`. + public var repositoryIdsToAdd: [Swift.Int]? + /// List of repository IDs to remove. /// - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/default-level/PUT/requestBody/json/default_level`. - public var defaultLevel: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Body.JsonPayload.DefaultLevelPayload + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/PATCH/requestBody/json/repository_ids_to_remove`. + public var repositoryIdsToRemove: [Swift.Int]? /// Creates a new `JsonPayload`. /// /// - Parameters: - /// - defaultLevel: The default repository access level for Dependabot updates. - public init(defaultLevel: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Body.JsonPayload.DefaultLevelPayload) { - self.defaultLevel = defaultLevel + /// - repositoryIdsToAdd: List of repository IDs to add. + /// - repositoryIdsToRemove: List of repository IDs to remove. + public init( + repositoryIdsToAdd: [Swift.Int]? = nil, + repositoryIdsToRemove: [Swift.Int]? = nil + ) { + self.repositoryIdsToAdd = repositoryIdsToAdd + self.repositoryIdsToRemove = repositoryIdsToRemove } public enum CodingKeys: String, CodingKey { - case defaultLevel = "default_level" + case repositoryIdsToAdd = "repository_ids_to_add" + case repositoryIdsToRemove = "repository_ids_to_remove" } } - /// - Remark: Generated from `#/paths/organizations/{org}/dependabot/repository-access/default-level/PUT/requestBody/content/application\/json`. - case json(Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Body.JsonPayload) + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/PATCH/requestBody/content/application\/json`. + case json(Operations.DependabotUpdateRepositoryAccessForOrg.Input.Body.JsonPayload) } - public var body: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Body + public var body: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Body /// Creates a new `Input`. /// /// - Parameters: /// - path: /// - headers: /// - body: - public init( - path: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Path, - headers: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Headers = .init(), - body: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Body - ) { - self.path = path - self.headers = headers - self.body = body - } - } - @frozen public enum Output: Sendable, Hashable { - public struct NoContent: Sendable, Hashable { - /// Creates a new `NoContent`. - public init() {} - } - /// Response - /// - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)/responses/204`. - /// - /// HTTP response code: `204 noContent`. - case noContent(Operations.DependabotSetRepositoryAccessDefaultLevel.Output.NoContent) - /// Response - /// - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)/responses/204`. - /// - /// HTTP response code: `204 noContent`. - public static var noContent: Self { - .noContent(.init()) - } - /// The associated value of the enum case if `self` is `.noContent`. - /// - /// - Throws: An error if `self` is not `.noContent`. - /// - SeeAlso: `.noContent`. - public var noContent: Operations.DependabotSetRepositoryAccessDefaultLevel.Output.NoContent { - get throws { - switch self { - case let .noContent(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "noContent", - response: self - ) - } - } - } - /// Forbidden - /// - /// - Remark: Generated from `#/paths//organizations/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)/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}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)/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 Dependabot alerts for an organization - /// - /// Lists Dependabot alerts for an organization. - /// - /// The authenticated user must be an owner or security manager for the organization to use this endpoint. - /// - /// OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. - /// - /// - Remark: HTTP `GET /orgs/{org}/dependabot/alerts`. - /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)`. - public enum DependabotListAlertsForOrg { - public static let id: Swift.String = "dependabot/list-alerts-for-org" - public struct Input: Sendable, Hashable { - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/path`. - public struct Path: Sendable, Hashable { - /// The organization name. The name is not case sensitive. - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/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.DependabotListAlertsForOrg.Input.Path - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query`. - public struct Query: Sendable, Hashable { - /// A comma-separated list of vulnerability classifications. If specified, only alerts for vulnerabilities with these classifications will be returned. - /// - /// Can be: `malware`, `general` - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/classification`. - public var classification: Components.Parameters.DependabotAlertCommaSeparatedClassifications? - /// A comma-separated list of states. If specified, only alerts with these states will be returned. - /// - /// Can be: `auto_dismissed`, `dismissed`, `fixed`, `open` - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/state`. - public var state: Components.Parameters.DependabotAlertCommaSeparatedStates? - /// A comma-separated list of severities. If specified, only alerts with these severities will be returned. - /// - /// Can be: `low`, `medium`, `high`, `critical` - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/severity`. - public var severity: Components.Parameters.DependabotAlertCommaSeparatedSeverities? - /// A comma-separated list of ecosystems. If specified, only alerts for these ecosystems will be returned. - /// - /// Can be: `composer`, `go`, `maven`, `npm`, `nuget`, `pip`, `pub`, `rubygems`, `rust` - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/ecosystem`. - public var ecosystem: Components.Parameters.DependabotAlertCommaSeparatedEcosystems? - /// A comma-separated list of package names. If specified, only alerts for these packages will be returned. - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/package`. - public var package: Components.Parameters.DependabotAlertCommaSeparatedPackages? - /// CVE Exploit Prediction Scoring System (EPSS) percentage. Can be specified as: - /// - An exact number (`n`) - /// - Comparators such as `>n`, `=n`, `<=n` - /// - A range like `n..n`, where `n` is a number from 0.0 to 1.0 - /// - /// Filters the list of alerts based on EPSS percentages. If specified, only alerts with the provided EPSS percentages will be returned. - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/epss_percentage`. - public var epssPercentage: Components.Parameters.DependabotAlertCommaSeparatedEpss? - /// A comma-separated list of artifact registry URLs. If specified, only alerts for repositories with storage records matching these URLs will be returned. - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/artifact_registry_url`. - public var artifactRegistryUrl: Components.Parameters.DependabotAlertCommaSeparatedArtifactRegistryUrls? - /// A comma-separated list of Artifact Registry name strings. If specified, only alerts for repositories with storage records matching these registries will be returned. - /// - /// Can be: `jfrog-artifactory` - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/artifact_registry`. - public var artifactRegistry: Components.Parameters.DependabotAlertCommaSeparatedArtifactRegistry? - /// - Remark: Generated from `#/components/parameters/dependabot-alert-org-scope-comma-separated-has`. - @frozen public enum DependabotAlertOrgScopeCommaSeparatedHas: Codable, Hashable, Sendable { - /// - Remark: Generated from `#/components/parameters/dependabot-alert-org-scope-comma-separated-has/case1`. - case case1(Swift.String) - /// - Remark: Generated from `#/components/parameters/dependabot-alert-org-scope-comma-separated-has/Case2Payload`. - @frozen public enum Case2PayloadPayload: String, Codable, Hashable, Sendable, CaseIterable { - case patch = "patch" - case deployment = "deployment" - } - /// - Remark: Generated from `#/components/parameters/dependabot-alert-org-scope-comma-separated-has/case2`. - public typealias Case2Payload = [Components.Parameters.DependabotAlertOrgScopeCommaSeparatedHas.Case2PayloadPayload] - /// - Remark: Generated from `#/components/parameters/dependabot-alert-org-scope-comma-separated-has/case2`. - case case2(Components.Parameters.DependabotAlertOrgScopeCommaSeparatedHas.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) - } - } - } - /// Filters the list of alerts based on whether the alert has the given value. If specified, only alerts meeting this criterion will be returned. - /// Multiple `has` filters can be passed to filter for alerts that have all of the values. - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/has`. - public var has: Components.Parameters.DependabotAlertOrgScopeCommaSeparatedHas? - /// Filter alerts by assignees. - /// Provide a comma-separated list of user handles (e.g., `octocat` or `octocat,hubot`) to return alerts assigned to any of the specified users. - /// Use `*` to list alerts with at least one assignee or `none` to list alerts with no assignees. - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/assignee`. - public var assignee: Components.Parameters.DependabotAlertCommaSeparatedAssignees? - /// A comma-separated list of runtime risk strings. If specified, only alerts for repositories with deployment records matching these risks will be returned. - /// - /// Can be: `critical-resource`, `internet-exposed`, `sensitive-data`, `lateral-movement` - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/runtime_risk`. - public var runtimeRisk: Components.Parameters.DependabotAlertCommaSeparatedRuntimeRisk? - /// - Remark: Generated from `#/components/parameters/dependabot-alert-scope`. - @frozen public enum DependabotAlertScope: String, Codable, Hashable, Sendable, CaseIterable { - case development = "development" - case runtime = "runtime" - } - /// The scope of the vulnerable dependency. If specified, only alerts with this scope will be returned. - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/scope`. - public var scope: Components.Parameters.DependabotAlertScope? - /// - Remark: Generated from `#/components/parameters/dependabot-alert-sort`. - @frozen public enum DependabotAlertSort: String, Codable, Hashable, Sendable, CaseIterable { - case created = "created" - case updated = "updated" - case epssPercentage = "epss_percentage" - } - /// The property by which to sort the results. - /// `created` means when the alert was created. - /// `updated` means when the alert's state last changed. - /// `epss_percentage` sorts alerts by the Exploit Prediction Scoring System (EPSS) percentage. - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/sort`. - public var sort: Components.Parameters.DependabotAlertSort? - /// - Remark: Generated from `#/components/parameters/direction`. - @frozen public enum Direction: String, Codable, Hashable, Sendable, CaseIterable { - case asc = "asc" - case desc = "desc" - } - /// The direction to sort the results by. - /// - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/query/direction`. - public var direction: Components.Parameters.Direction? - /// A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. 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}/dependabot/alerts/GET/query/before`. - public var before: Components.Parameters.PaginationBefore? - /// A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. 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}/dependabot/alerts/GET/query/after`. - public var after: Components.Parameters.PaginationAfter? - /// 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}/dependabot/alerts/GET/query/per_page`. - public var perPage: Components.Parameters.PerPage? - /// Creates a new `Query`. - /// - /// - Parameters: - /// - classification: A comma-separated list of vulnerability classifications. If specified, only alerts for vulnerabilities with these classifications will be returned. - /// - state: A comma-separated list of states. If specified, only alerts with these states will be returned. - /// - severity: A comma-separated list of severities. If specified, only alerts with these severities will be returned. - /// - ecosystem: A comma-separated list of ecosystems. If specified, only alerts for these ecosystems will be returned. - /// - package: A comma-separated list of package names. If specified, only alerts for these packages will be returned. - /// - epssPercentage: CVE Exploit Prediction Scoring System (EPSS) percentage. Can be specified as: - /// - artifactRegistryUrl: A comma-separated list of artifact registry URLs. If specified, only alerts for repositories with storage records matching these URLs will be returned. - /// - artifactRegistry: A comma-separated list of Artifact Registry name strings. If specified, only alerts for repositories with storage records matching these registries will be returned. - /// - has: Filters the list of alerts based on whether the alert has the given value. If specified, only alerts meeting this criterion will be returned. - /// - assignee: Filter alerts by assignees. - /// - runtimeRisk: A comma-separated list of runtime risk strings. If specified, only alerts for repositories with deployment records matching these risks will be returned. - /// - scope: The scope of the vulnerable dependency. If specified, only alerts with this scope will be returned. - /// - sort: The property by which to sort the results. - /// - direction: The direction to sort the results by. - /// - before: A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. 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)." - /// - after: A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. 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)." - /// - 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)." - public init( - classification: Components.Parameters.DependabotAlertCommaSeparatedClassifications? = nil, - state: Components.Parameters.DependabotAlertCommaSeparatedStates? = nil, - severity: Components.Parameters.DependabotAlertCommaSeparatedSeverities? = nil, - ecosystem: Components.Parameters.DependabotAlertCommaSeparatedEcosystems? = nil, - package: Components.Parameters.DependabotAlertCommaSeparatedPackages? = nil, - epssPercentage: Components.Parameters.DependabotAlertCommaSeparatedEpss? = nil, - artifactRegistryUrl: Components.Parameters.DependabotAlertCommaSeparatedArtifactRegistryUrls? = nil, - artifactRegistry: Components.Parameters.DependabotAlertCommaSeparatedArtifactRegistry? = nil, - has: Components.Parameters.DependabotAlertOrgScopeCommaSeparatedHas? = nil, - assignee: Components.Parameters.DependabotAlertCommaSeparatedAssignees? = nil, - runtimeRisk: Components.Parameters.DependabotAlertCommaSeparatedRuntimeRisk? = nil, - scope: Components.Parameters.DependabotAlertScope? = nil, - sort: Components.Parameters.DependabotAlertSort? = nil, - direction: Components.Parameters.Direction? = nil, - before: Components.Parameters.PaginationBefore? = nil, - after: Components.Parameters.PaginationAfter? = nil, - perPage: Components.Parameters.PerPage? = nil - ) { - self.classification = classification - self.state = state - self.severity = severity - self.ecosystem = ecosystem - self.package = package - self.epssPercentage = epssPercentage - self.artifactRegistryUrl = artifactRegistryUrl - self.artifactRegistry = artifactRegistry - self.has = has - self.assignee = assignee - self.runtimeRisk = runtimeRisk - self.scope = scope - self.sort = sort - self.direction = direction - self.before = before - self.after = after - self.perPage = perPage - } - } - public var query: Operations.DependabotListAlertsForOrg.Input.Query - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/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.DependabotListAlertsForOrg.Input.Headers - /// Creates a new `Input`. - /// - /// - Parameters: - /// - path: - /// - query: - /// - headers: - public init( - path: Operations.DependabotListAlertsForOrg.Input.Path, - query: Operations.DependabotListAlertsForOrg.Input.Query = .init(), - headers: Operations.DependabotListAlertsForOrg.Input.Headers = .init() - ) { - self.path = path - self.query = query - self.headers = headers - } - } - @frozen public enum Output: Sendable, Hashable { - public struct Ok: Sendable, Hashable { - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/responses/200/content`. - @frozen public enum Body: Sendable, Hashable { - /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/alerts/GET/responses/200/content/application\/json`. - case json([Components.Schemas.DependabotAlertWithRepository]) - /// 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.DependabotAlertWithRepository] { - get throws { - switch self { - case let .json(body): - return body - } - } - } - } - /// Received HTTP response body - public var body: Operations.DependabotListAlertsForOrg.Output.Ok.Body - /// Creates a new `Ok`. - /// - /// - Parameters: - /// - body: Received HTTP response body - public init(body: Operations.DependabotListAlertsForOrg.Output.Ok.Body) { - self.body = body - } + public init( + path: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Path, + headers: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Headers = .init(), + body: Operations.DependabotUpdateRepositoryAccessForOrg.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct NoContent: Sendable, Hashable { + /// Creates a new `NoContent`. + public init() {} } /// Response /// - /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/200`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)/responses/204`. /// - /// HTTP response code: `200 ok`. - case ok(Operations.DependabotListAlertsForOrg.Output.Ok) - /// The associated value of the enum case if `self` is `.ok`. + /// HTTP response code: `204 noContent`. + case noContent(Operations.DependabotUpdateRepositoryAccessForOrg.Output.NoContent) + /// Response /// - /// - Throws: An error if `self` is not `.ok`. - /// - SeeAlso: `.ok`. - public var ok: Operations.DependabotListAlertsForOrg.Output.Ok { + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + public static var noContent: Self { + .noContent(.init()) + } + /// The associated value of the enum case if `self` is `.noContent`. + /// + /// - Throws: An error if `self` is not `.noContent`. + /// - SeeAlso: `.noContent`. + public var noContent: Operations.DependabotUpdateRepositoryAccessForOrg.Output.NoContent { get throws { switch self { - case let .ok(response): + case let .noContent(response): return response default: try throwUnexpectedResponseStatus( - expectedStatus: "ok", + expectedStatus: "noContent", response: self ) } } } - /// Not modified - /// - /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/304`. + /// Forbidden /// - /// HTTP response code: `304 notModified`. - case notModified(Components.Responses.NotModified) - /// Not modified + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-org)/responses/403`. /// - /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/304`. + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. /// - /// HTTP response code: `304 notModified`. - public static var notModified: Self { - .notModified(.init()) + /// - 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 + ) + } + } } - /// The associated value of the enum case if `self` is `.notModified`. + /// Resource not found /// - /// - Throws: An error if `self` is not `.notModified`. - /// - SeeAlso: `.notModified`. - public var notModified: Components.Responses.NotModified { + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/patch(dependabot/update-repository-access-for-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 .notModified(response): + case let .notFound(response): return response default: try throwUnexpectedResponseStatus( - expectedStatus: "notModified", + expectedStatus: "notFound", response: self ) } } } - /// Bad Request + /// Undocumented response. /// - /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/400`. + /// 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 + ] + } + } + } + /// Set the default repository access level for Dependabot + /// + /// Sets the default level of repository access Dependabot will have while performing an update. Available values are: + /// - 'public' - Dependabot will only have access to public repositories, unless access is explicitly granted to non-public repositories. + /// - 'internal' - Dependabot will only have access to public and internal repositories, unless access is explicitly granted to private repositories. + /// + /// Unauthorized users will not see the existence of this endpoint. + /// + /// This operation supports both server-to-server and user-to-server access. + /// + /// - Remark: HTTP `PUT /orgs/{org}/dependabot/repository-access/default-level`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)`. + public enum DependabotSetRepositoryAccessDefaultLevel { + public static let id: Swift.String = "dependabot/set-repository-access-default-level" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/default-level/PUT/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/default-level/PUT/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.DependabotSetRepositoryAccessDefaultLevel.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/default-level/PUT/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.DependabotSetRepositoryAccessDefaultLevel.Input.Headers + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/default-level/PUT/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/default-level/PUT/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The default repository access level for Dependabot updates. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/default-level/PUT/requestBody/json/default_level`. + @frozen public enum DefaultLevelPayload: String, Codable, Hashable, Sendable, CaseIterable { + case _public = "public" + case _internal = "internal" + } + /// The default repository access level for Dependabot updates. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/default-level/PUT/requestBody/json/default_level`. + public var defaultLevel: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Body.JsonPayload.DefaultLevelPayload + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - defaultLevel: The default repository access level for Dependabot updates. + public init(defaultLevel: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Body.JsonPayload.DefaultLevelPayload) { + self.defaultLevel = defaultLevel + } + public enum CodingKeys: String, CodingKey { + case defaultLevel = "default_level" + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/dependabot/repository-access/default-level/PUT/requestBody/content/application\/json`. + case json(Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Body.JsonPayload) + } + public var body: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Body + /// Creates a new `Input`. /// - /// HTTP response code: `400 badRequest`. - case badRequest(Components.Responses.BadRequest) - /// The associated value of the enum case if `self` is `.badRequest`. + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Path, + headers: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Headers = .init(), + body: Operations.DependabotSetRepositoryAccessDefaultLevel.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct NoContent: Sendable, Hashable { + /// Creates a new `NoContent`. + public init() {} + } + /// Response /// - /// - Throws: An error if `self` is not `.badRequest`. - /// - SeeAlso: `.badRequest`. - public var badRequest: Components.Responses.BadRequest { + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Operations.DependabotSetRepositoryAccessDefaultLevel.Output.NoContent) + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + public static var noContent: Self { + .noContent(.init()) + } + /// The associated value of the enum case if `self` is `.noContent`. + /// + /// - Throws: An error if `self` is not `.noContent`. + /// - SeeAlso: `.noContent`. + public var noContent: Operations.DependabotSetRepositoryAccessDefaultLevel.Output.NoContent { get throws { switch self { - case let .badRequest(response): + case let .noContent(response): return response default: try throwUnexpectedResponseStatus( - expectedStatus: "badRequest", + expectedStatus: "noContent", response: self ) } @@ -6295,7 +6324,7 @@ public enum Operations { } /// Forbidden /// - /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/403`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)/responses/403`. /// /// HTTP response code: `403 forbidden`. case forbidden(Components.Responses.Forbidden) @@ -6318,7 +6347,7 @@ public enum Operations { } /// Resource not found /// - /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/404`. + /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/repository-access/default-level/put(dependabot/set-repository-access-default-level)/responses/404`. /// /// HTTP response code: `404 notFound`. case notFound(Components.Responses.NotFound) @@ -6339,29 +6368,6 @@ public enum Operations { } } } - /// Validation failed, or the endpoint has been spammed. - /// - /// - Remark: Generated from `#/paths//orgs/{org}/dependabot/alerts/get(dependabot/list-alerts-for-org)/responses/422`. - /// - /// HTTP response code: `422 unprocessableContent`. - case unprocessableContent(Components.Responses.ValidationFailedSimple) - /// 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.ValidationFailedSimple { - get throws { - switch self { - case let .unprocessableContent(response): - return response - default: - try throwUnexpectedResponseStatus( - expectedStatus: "unprocessableContent", - response: self - ) - } - } - } /// Undocumented response. /// /// A response with a code that is not documented in the OpenAPI document. @@ -6369,14 +6375,11 @@ 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) } @@ -6387,14 +6390,11 @@ public enum Operations { return string case .json: return "application/json" - case .applicationScimJson: - return "application/scim+json" } } public static var allCases: [Self] { [ - .json, - .applicationScimJson + .json ] } } diff --git a/Sources/dependency-graph/Client.swift b/Sources/dependency-graph/Client.swift index 1714051070a..fb0a3de8565 100644 --- a/Sources/dependency-graph/Client.swift +++ b/Sources/dependency-graph/Client.swift @@ -280,6 +280,215 @@ public struct Client: APIProtocol { } ) } + /// Fetch a software bill of materials (SBOM) for a repository. + /// + /// Fetches a previously generated software bill of materials (SBOM) for a repository. + /// When the SBOM is ready, the response is a 302 redirect to a temporary download URL for the SBOM in SPDX JSON format. + /// The generated SBOM report may be retained for up to one week from the original request. + /// The temporary download URL returned by this endpoint expires separately, and its expiry is set when the fetch request is made. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/get(dependency-graph/fetch-sbom-report)`. + public func dependencyGraphFetchSbomReport(_ input: Operations.DependencyGraphFetchSbomReport.Input) async throws -> Operations.DependencyGraphFetchSbomReport.Output { + try await client.send( + input: input, + forOperation: Operations.DependencyGraphFetchSbomReport.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/repos/{}/{}/dependency-graph/sbom/fetch-report/{}", + parameters: [ + input.path.owner, + input.path.repo, + input.path.sbomUuid + ] + ) + 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 302: + let headers: Operations.DependencyGraphFetchSbomReport.Output.Found.Headers = .init(location: try converter.getOptionalHeaderFieldAsURI( + in: response.headerFields, + name: "Location", + as: Components.Headers.Location.self + )) + return .found(.init(headers: headers)) + case 202: + return .accepted(.init()) + 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)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Request generation of a software bill of materials (SBOM) for a repository. + /// + /// Triggers a job to generate a software bill of materials (SBOM) for a repository in SPDX JSON format. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/dependency-graph/sbom/generate-report`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/generate-report/get(dependency-graph/generate-sbom-report)`. + public func dependencyGraphGenerateSbomReport(_ input: Operations.DependencyGraphGenerateSbomReport.Input) async throws -> Operations.DependencyGraphGenerateSbomReport.Output { + try await client.send( + input: input, + forOperation: Operations.DependencyGraphGenerateSbomReport.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/repos/{}/{}/dependency-graph/sbom/generate-report", + 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 201: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.DependencyGraphGenerateSbomReport.Output.Created.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Operations.DependencyGraphGenerateSbomReport.Output.Created.Body.JsonPayload.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .created(.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)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } /// Create a snapshot of dependencies for a repository /// /// Create a new snapshot of a repository's dependencies. diff --git a/Sources/dependency-graph/Types.swift b/Sources/dependency-graph/Types.swift index 86f5351bedc..39ea992de7e 100644 --- a/Sources/dependency-graph/Types.swift +++ b/Sources/dependency-graph/Types.swift @@ -25,6 +25,23 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `GET /repos/{owner}/{repo}/dependency-graph/sbom`. /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/get(dependency-graph/export-sbom)`. func dependencyGraphExportSbom(_ input: Operations.DependencyGraphExportSbom.Input) async throws -> Operations.DependencyGraphExportSbom.Output + /// Fetch a software bill of materials (SBOM) for a repository. + /// + /// Fetches a previously generated software bill of materials (SBOM) for a repository. + /// When the SBOM is ready, the response is a 302 redirect to a temporary download URL for the SBOM in SPDX JSON format. + /// The generated SBOM report may be retained for up to one week from the original request. + /// The temporary download URL returned by this endpoint expires separately, and its expiry is set when the fetch request is made. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/get(dependency-graph/fetch-sbom-report)`. + func dependencyGraphFetchSbomReport(_ input: Operations.DependencyGraphFetchSbomReport.Input) async throws -> Operations.DependencyGraphFetchSbomReport.Output + /// Request generation of a software bill of materials (SBOM) for a repository. + /// + /// Triggers a job to generate a software bill of materials (SBOM) for a repository in SPDX JSON format. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/dependency-graph/sbom/generate-report`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/generate-report/get(dependency-graph/generate-sbom-report)`. + func dependencyGraphGenerateSbomReport(_ input: Operations.DependencyGraphGenerateSbomReport.Input) async throws -> Operations.DependencyGraphGenerateSbomReport.Output /// Create a snapshot of dependencies for a repository /// /// Create a new snapshot of a repository's dependencies. @@ -72,6 +89,39 @@ extension APIProtocol { headers: headers )) } + /// Fetch a software bill of materials (SBOM) for a repository. + /// + /// Fetches a previously generated software bill of materials (SBOM) for a repository. + /// When the SBOM is ready, the response is a 302 redirect to a temporary download URL for the SBOM in SPDX JSON format. + /// The generated SBOM report may be retained for up to one week from the original request. + /// The temporary download URL returned by this endpoint expires separately, and its expiry is set when the fetch request is made. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/get(dependency-graph/fetch-sbom-report)`. + public func dependencyGraphFetchSbomReport( + path: Operations.DependencyGraphFetchSbomReport.Input.Path, + headers: Operations.DependencyGraphFetchSbomReport.Input.Headers = .init() + ) async throws -> Operations.DependencyGraphFetchSbomReport.Output { + try await dependencyGraphFetchSbomReport(Operations.DependencyGraphFetchSbomReport.Input( + path: path, + headers: headers + )) + } + /// Request generation of a software bill of materials (SBOM) for a repository. + /// + /// Triggers a job to generate a software bill of materials (SBOM) for a repository in SPDX JSON format. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/dependency-graph/sbom/generate-report`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/generate-report/get(dependency-graph/generate-sbom-report)`. + public func dependencyGraphGenerateSbomReport( + path: Operations.DependencyGraphGenerateSbomReport.Input.Path, + headers: Operations.DependencyGraphGenerateSbomReport.Input.Headers = .init() + ) async throws -> Operations.DependencyGraphGenerateSbomReport.Output { + try await dependencyGraphGenerateSbomReport(Operations.DependencyGraphGenerateSbomReport.Input( + path: path, + headers: headers + )) + } /// Create a snapshot of dependencies for a repository /// /// Create a new snapshot of a repository's dependencies. @@ -1214,6 +1264,8 @@ public enum Components { public enum Headers { /// - Remark: Generated from `#/components/headers/link`. public typealias Link = Swift.String + /// - Remark: Generated from `#/components/headers/location`. + public typealias Location = Swift.String } } @@ -1656,6 +1708,437 @@ public enum Operations { } } } + /// Fetch a software bill of materials (SBOM) for a repository. + /// + /// Fetches a previously generated software bill of materials (SBOM) for a repository. + /// When the SBOM is ready, the response is a 302 redirect to a temporary download URL for the SBOM in SPDX JSON format. + /// The generated SBOM report may be retained for up to one week from the original request. + /// The temporary download URL returned by this endpoint expires separately, and its expiry is set when the fetch request is made. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/get(dependency-graph/fetch-sbom-report)`. + public enum DependencyGraphFetchSbomReport { + public static let id: Swift.String = "dependency-graph/fetch-sbom-report" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/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}/dependency-graph/sbom/fetch-report/{sbom_uuid}/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}/dependency-graph/sbom/fetch-report/{sbom_uuid}/GET/path/repo`. + public var repo: Components.Parameters.Repo + /// The unique identifier of the SBOM export. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/GET/path/sbom_uuid`. + public var sbomUuid: Swift.String + /// 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. + /// - sbomUuid: The unique identifier of the SBOM export. + public init( + owner: Components.Parameters.Owner, + repo: Components.Parameters.Repo, + sbomUuid: Swift.String + ) { + self.owner = owner + self.repo = repo + self.sbomUuid = sbomUuid + } + } + public var path: Operations.DependencyGraphFetchSbomReport.Input.Path + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/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.DependencyGraphFetchSbomReport.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.DependencyGraphFetchSbomReport.Input.Path, + headers: Operations.DependencyGraphFetchSbomReport.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Found: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/GET/responses/302/headers`. + public struct Headers: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/GET/responses/302/headers/Location`. + public var location: Components.Headers.Location? + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - location: + public init(location: Components.Headers.Location? = nil) { + self.location = location + } + } + /// Received HTTP response headers + public var headers: Operations.DependencyGraphFetchSbomReport.Output.Found.Headers + /// Creates a new `Found`. + /// + /// - Parameters: + /// - headers: Received HTTP response headers + public init(headers: Operations.DependencyGraphFetchSbomReport.Output.Found.Headers = .init()) { + self.headers = headers + } + } + /// Redirects to a temporary download URL for the completed SBOM. + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/get(dependency-graph/fetch-sbom-report)/responses/302`. + /// + /// HTTP response code: `302 found`. + case found(Operations.DependencyGraphFetchSbomReport.Output.Found) + /// The associated value of the enum case if `self` is `.found`. + /// + /// - Throws: An error if `self` is not `.found`. + /// - SeeAlso: `.found`. + public var found: Operations.DependencyGraphFetchSbomReport.Output.Found { + get throws { + switch self { + case let .found(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "found", + response: self + ) + } + } + } + public struct Accepted: Sendable, Hashable { + /// Creates a new `Accepted`. + public init() {} + } + /// SBOM is still being processed, no content is returned. + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/get(dependency-graph/fetch-sbom-report)/responses/202`. + /// + /// HTTP response code: `202 accepted`. + case accepted(Operations.DependencyGraphFetchSbomReport.Output.Accepted) + /// SBOM is still being processed, no content is returned. + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/get(dependency-graph/fetch-sbom-report)/responses/202`. + /// + /// HTTP response code: `202 accepted`. + public static var accepted: Self { + .accepted(.init()) + } + /// The associated value of the enum case if `self` is `.accepted`. + /// + /// - Throws: An error if `self` is not `.accepted`. + /// - SeeAlso: `.accepted`. + public var accepted: Operations.DependencyGraphFetchSbomReport.Output.Accepted { + get throws { + switch self { + case let .accepted(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "accepted", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/get(dependency-graph/fetch-sbom-report)/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//repos/{owner}/{repo}/dependency-graph/sbom/fetch-report/{sbom_uuid}/get(dependency-graph/fetch-sbom-report)/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 + ) + } + } + } + /// 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 + ] + } + } + } + /// Request generation of a software bill of materials (SBOM) for a repository. + /// + /// Triggers a job to generate a software bill of materials (SBOM) for a repository in SPDX JSON format. + /// + /// - Remark: HTTP `GET /repos/{owner}/{repo}/dependency-graph/sbom/generate-report`. + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/generate-report/get(dependency-graph/generate-sbom-report)`. + public enum DependencyGraphGenerateSbomReport { + public static let id: Swift.String = "dependency-graph/generate-sbom-report" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/dependency-graph/sbom/generate-report/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}/dependency-graph/sbom/generate-report/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}/dependency-graph/sbom/generate-report/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.DependencyGraphGenerateSbomReport.Input.Path + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/dependency-graph/sbom/generate-report/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.DependencyGraphGenerateSbomReport.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.DependencyGraphGenerateSbomReport.Input.Path, + headers: Operations.DependencyGraphGenerateSbomReport.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Created: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/dependency-graph/sbom/generate-report/GET/responses/201/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/dependency-graph/sbom/generate-report/GET/responses/201/content/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// URL to poll for the SBOM export result. + /// + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/dependency-graph/sbom/generate-report/GET/responses/201/content/json/sbom_url`. + public var sbomUrl: Swift.String? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - sbomUrl: URL to poll for the SBOM export result. + public init(sbomUrl: Swift.String? = nil) { + self.sbomUrl = sbomUrl + } + public enum CodingKeys: String, CodingKey { + case sbomUrl = "sbom_url" + } + } + /// - Remark: Generated from `#/paths/repos/{owner}/{repo}/dependency-graph/sbom/generate-report/GET/responses/201/content/application\/json`. + case json(Operations.DependencyGraphGenerateSbomReport.Output.Created.Body.JsonPayload) + /// 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.DependencyGraphGenerateSbomReport.Output.Created.Body.JsonPayload { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.DependencyGraphGenerateSbomReport.Output.Created.Body + /// Creates a new `Created`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.DependencyGraphGenerateSbomReport.Output.Created.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/generate-report/get(dependency-graph/generate-sbom-report)/responses/201`. + /// + /// HTTP response code: `201 created`. + case created(Operations.DependencyGraphGenerateSbomReport.Output.Created) + /// The associated value of the enum case if `self` is `.created`. + /// + /// - Throws: An error if `self` is not `.created`. + /// - SeeAlso: `.created`. + public var created: Operations.DependencyGraphGenerateSbomReport.Output.Created { + get throws { + switch self { + case let .created(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "created", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//repos/{owner}/{repo}/dependency-graph/sbom/generate-report/get(dependency-graph/generate-sbom-report)/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//repos/{owner}/{repo}/dependency-graph/sbom/generate-report/get(dependency-graph/generate-sbom-report)/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 + ) + } + } + } + /// 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 snapshot of dependencies for a repository /// /// Create a new snapshot of a repository's dependencies. diff --git a/Sources/orgs/Client.swift b/Sources/orgs/Client.swift index 572e09b97ed..2841ab06187 100644 --- a/Sources/orgs/Client.swift +++ b/Sources/orgs/Client.swift @@ -682,7 +682,7 @@ public struct Client: APIProtocol { return .forbidden(.init(body: body)) case 404: let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) - let body: Components.Responses.NotFound.Body + let body: Operations.OrgsSetClusterDeploymentRecords.Output.NotFound.Body let chosenContentType = try converter.bestContentType( received: contentType, options: [ diff --git a/Sources/orgs/Types.swift b/Sources/orgs/Types.swift index 8148a7ac0b0..557b42f71d8 100644 --- a/Sources/orgs/Types.swift +++ b/Sources/orgs/Types.swift @@ -8051,6 +8051,10 @@ public enum Components { public var visibility: Components.Schemas.OrganizationUpdateIssueField.VisibilityPayload? /// - Remark: Generated from `#/components/schemas/organization-update-issue-field/OptionsPayload`. public struct OptionsPayloadPayload: Codable, Hashable, Sendable { + /// The id of an existing option to retain or update. Omit this when creating a new option. + /// + /// - Remark: Generated from `#/components/schemas/organization-update-issue-field/OptionsPayload/id`. + public var id: Swift.Int? /// Name of the option. /// /// - Remark: Generated from `#/components/schemas/organization-update-issue-field/OptionsPayload/name`. @@ -8083,33 +8087,37 @@ public enum Components { /// Creates a new `OptionsPayloadPayload`. /// /// - Parameters: + /// - id: The id of an existing option to retain or update. Omit this when creating a new option. /// - name: Name of the option. /// - description: Description of the option. /// - color: Color for the option. /// - priority: Priority of the option for ordering. public init( + id: Swift.Int? = nil, name: Swift.String, description: Swift.String? = nil, color: Components.Schemas.OrganizationUpdateIssueField.OptionsPayloadPayload.ColorPayload, priority: Swift.Int ) { + self.id = id self.name = name self.description = description self.color = color self.priority = priority } public enum CodingKeys: String, CodingKey { + case id case name case description case color case priority } } - /// Options for single select fields. Only applicable when updating single_select fields. + /// Options for single select fields. Only applicable when updating single_select fields. When provided, this array **replaces** the entire existing set of options rather than adding to or updating individual options. To retain or update an existing option, include it in the array with its `id`. Options sent without an `id` are treated as new options and may cause existing options to be deleted and recreated. /// /// - Remark: Generated from `#/components/schemas/organization-update-issue-field/options`. public typealias OptionsPayload = [Components.Schemas.OrganizationUpdateIssueField.OptionsPayloadPayload] - /// Options for single select fields. Only applicable when updating single_select fields. + /// Options for single select fields. Only applicable when updating single_select fields. When provided, this array **replaces** the entire existing set of options rather than adding to or updating individual options. To retain or update an existing option, include it in the array with its `id`. Options sent without an `id` are treated as new options and may cause existing options to be deleted and recreated. /// /// - Remark: Generated from `#/components/schemas/organization-update-issue-field/options`. public var options: Components.Schemas.OrganizationUpdateIssueField.OptionsPayload? @@ -8119,7 +8127,7 @@ public enum Components { /// - name: Name of the issue field. /// - description: Description of the issue field. /// - visibility: The visibility of the issue field. Can be `organization_members_only` (visible only within the organization) or `all` (visible to all users who can see issues). Only used when the visibility settings feature is enabled. - /// - options: Options for single select fields. Only applicable when updating single_select fields. + /// - options: Options for single select fields. Only applicable when updating single_select fields. When provided, this array **replaces** the entire existing set of options rather than adding to or updating individual options. To retain or update an existing option, include it in the array with its `id`. Options sent without an `id` are treated as new options and may cause existing options to be deleted and recreated. public init( name: Swift.String? = nil, description: Swift.String? = nil, @@ -12211,17 +12219,45 @@ public enum Operations { } } } + public struct NotFound: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/artifacts/metadata/deployment-record/cluster/{cluster}/POST/responses/404/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/artifacts/metadata/deployment-record/cluster/{cluster}/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.OrgsSetClusterDeploymentRecords.Output.NotFound.Body + /// Creates a new `NotFound`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.OrgsSetClusterDeploymentRecords.Output.NotFound.Body) { + self.body = body + } + } /// Resource not found /// /// - Remark: Generated from `#/paths//orgs/{org}/artifacts/metadata/deployment-record/cluster/{cluster}/post(orgs/set-cluster-deployment-records)/responses/404`. /// /// HTTP response code: `404 notFound`. - case notFound(Components.Responses.NotFound) + case notFound(Operations.OrgsSetClusterDeploymentRecords.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: Components.Responses.NotFound { + public var notFound: Operations.OrgsSetClusterDeploymentRecords.Output.NotFound { get throws { switch self { case let .notFound(response): diff --git a/Sources/secret-scanning/Client.swift b/Sources/secret-scanning/Client.swift index 0284e81c5ef..cbaac9bca6a 100644 --- a/Sources/secret-scanning/Client.swift +++ b/Sources/secret-scanning/Client.swift @@ -1229,10 +1229,10 @@ public struct Client: APIProtocol { } /// Get secret scanning scan history for a repository /// - /// Lists the latest default incremental and backfill scans by type for a repository. Scans from Copilot Secret Scanning are not included. + /// Lists the latest default incremental and backfill scans by type for a repository. /// /// > [!NOTE] - /// > This endpoint requires [GitHub Advanced Security](https://docs.github.com/get-started/learning-about-github/about-github-advanced-security)." + /// > This endpoint requires [GitHub Advanced Security](https://docs.github.com/get-started/learning-about-github/about-github-advanced-security). /// /// OAuth app tokens and personal access tokens (classic) need the `repo` or `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. /// diff --git a/Sources/secret-scanning/Types.swift b/Sources/secret-scanning/Types.swift index 8b7a3dd18e2..b4e870dabae 100644 --- a/Sources/secret-scanning/Types.swift +++ b/Sources/secret-scanning/Types.swift @@ -99,10 +99,10 @@ public protocol APIProtocol: Sendable { func secretScanningCreatePushProtectionBypass(_ input: Operations.SecretScanningCreatePushProtectionBypass.Input) async throws -> Operations.SecretScanningCreatePushProtectionBypass.Output /// Get secret scanning scan history for a repository /// - /// Lists the latest default incremental and backfill scans by type for a repository. Scans from Copilot Secret Scanning are not included. + /// Lists the latest default incremental and backfill scans by type for a repository. /// /// > [!NOTE] - /// > This endpoint requires [GitHub Advanced Security](https://docs.github.com/get-started/learning-about-github/about-github-advanced-security)." + /// > This endpoint requires [GitHub Advanced Security](https://docs.github.com/get-started/learning-about-github/about-github-advanced-security). /// /// OAuth app tokens and personal access tokens (classic) need the `repo` or `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. /// @@ -279,10 +279,10 @@ extension APIProtocol { } /// Get secret scanning scan history for a repository /// - /// Lists the latest default incremental and backfill scans by type for a repository. Scans from Copilot Secret Scanning are not included. + /// Lists the latest default incremental and backfill scans by type for a repository. /// /// > [!NOTE] - /// > This endpoint requires [GitHub Advanced Security](https://docs.github.com/get-started/learning-about-github/about-github-advanced-security)." + /// > This endpoint requires [GitHub Advanced Security](https://docs.github.com/get-started/learning-about-github/about-github-advanced-security). /// /// OAuth app tokens and personal access tokens (classic) need the `repo` or `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. /// @@ -2888,6 +2888,8 @@ public enum Components { public typealias CustomPatternBackfillScansPayload = [Components.Schemas.SecretScanningScanHistory.CustomPatternBackfillScansPayloadPayload] /// - Remark: Generated from `#/components/schemas/secret-scanning-scan-history/custom_pattern_backfill_scans`. public var customPatternBackfillScans: Components.Schemas.SecretScanningScanHistory.CustomPatternBackfillScansPayload? + /// - Remark: Generated from `#/components/schemas/secret-scanning-scan-history/generic_secrets_backfill_scans`. + public var genericSecretsBackfillScans: [Components.Schemas.SecretScanningScan]? /// Creates a new `SecretScanningScanHistory`. /// /// - Parameters: @@ -2895,22 +2897,26 @@ public enum Components { /// - patternUpdateScans: /// - backfillScans: /// - customPatternBackfillScans: + /// - genericSecretsBackfillScans: public init( incrementalScans: [Components.Schemas.SecretScanningScan]? = nil, patternUpdateScans: [Components.Schemas.SecretScanningScan]? = nil, backfillScans: [Components.Schemas.SecretScanningScan]? = nil, - customPatternBackfillScans: Components.Schemas.SecretScanningScanHistory.CustomPatternBackfillScansPayload? = nil + customPatternBackfillScans: Components.Schemas.SecretScanningScanHistory.CustomPatternBackfillScansPayload? = nil, + genericSecretsBackfillScans: [Components.Schemas.SecretScanningScan]? = nil ) { self.incrementalScans = incrementalScans self.patternUpdateScans = patternUpdateScans self.backfillScans = backfillScans self.customPatternBackfillScans = customPatternBackfillScans + self.genericSecretsBackfillScans = genericSecretsBackfillScans } public enum CodingKeys: String, CodingKey { case incrementalScans = "incremental_scans" case patternUpdateScans = "pattern_update_scans" case backfillScans = "backfill_scans" case customPatternBackfillScans = "custom_pattern_backfill_scans" + case genericSecretsBackfillScans = "generic_secrets_backfill_scans" } } } @@ -5727,10 +5733,10 @@ public enum Operations { } /// Get secret scanning scan history for a repository /// - /// Lists the latest default incremental and backfill scans by type for a repository. Scans from Copilot Secret Scanning are not included. + /// Lists the latest default incremental and backfill scans by type for a repository. /// /// > [!NOTE] - /// > This endpoint requires [GitHub Advanced Security](https://docs.github.com/get-started/learning-about-github/about-github-advanced-security)." + /// > This endpoint requires [GitHub Advanced Security](https://docs.github.com/get-started/learning-about-github/about-github-advanced-security). /// /// OAuth app tokens and personal access tokens (classic) need the `repo` or `security_events` scope to use this endpoint. If this endpoint is only used with public repositories, the token can use the `public_repo` scope instead. /// diff --git a/Submodule/github/rest-api-description b/Submodule/github/rest-api-description index 3ba1e7273bb..2b6e93c2823 160000 --- a/Submodule/github/rest-api-description +++ b/Submodule/github/rest-api-description @@ -1 +1 @@ -Subproject commit 3ba1e7273bb94c613cf608640e4a7a860310669b +Subproject commit 2b6e93c2823a6f5dc1f6a3727b6b53eafa407fb2