From ae1d002c158f304f542b193f4ec03c212b729a76 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 00:53:30 +0000 Subject: [PATCH 1/7] Bump Submodule/github/rest-api-description from `d786d3f` to `d3a3c2a` Bumps [Submodule/github/rest-api-description](https://github.com/github/rest-api-description) from `d786d3f` to `d3a3c2a`. - [Release notes](https://github.com/github/rest-api-description/releases) - [Commits](https://github.com/github/rest-api-description/compare/d786d3f083a842b342a5395a58ca01cd0faa71e6...d3a3c2a50bb45b5f437bdfd8e0c700091bb1fb7b) --- updated-dependencies: - dependency-name: Submodule/github/rest-api-description dependency-version: d3a3c2a50bb45b5f437bdfd8e0c700091bb1fb7b dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Submodule/github/rest-api-description | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Submodule/github/rest-api-description b/Submodule/github/rest-api-description index d786d3f083..d3a3c2a50b 160000 --- a/Submodule/github/rest-api-description +++ b/Submodule/github/rest-api-description @@ -1 +1 @@ -Subproject commit d786d3f083a842b342a5395a58ca01cd0faa71e6 +Subproject commit d3a3c2a50bb45b5f437bdfd8e0c700091bb1fb7b From 2a08ebf8447a50b7816d95a28be24eab008fb3a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 00:59:59 +0000 Subject: [PATCH 2/7] Commit via running: make Sources/apps --- Sources/apps/Types.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/apps/Types.swift b/Sources/apps/Types.swift index 619b2d00a6..2d38887abe 100644 --- a/Sources/apps/Types.swift +++ b/Sources/apps/Types.swift @@ -2608,14 +2608,14 @@ public enum Components { /// /// - Remark: Generated from `#/components/schemas/app-permissions/organization_copilot_seat_management`. public var organizationCopilotSeatManagement: Components.Schemas.AppPermissions.OrganizationCopilotSeatManagementPayload? - /// The level of permission to grant the access token to view and manage Copilot coding agent settings for an organization. + /// The level of permission to grant the access token to view and manage Copilot cloud agent settings for an organization. /// /// - Remark: Generated from `#/components/schemas/app-permissions/organization_copilot_agent_settings`. @frozen public enum OrganizationCopilotAgentSettingsPayload: String, Codable, Hashable, Sendable, CaseIterable { case read = "read" case write = "write" } - /// The level of permission to grant the access token to view and manage Copilot coding agent settings for an organization. + /// The level of permission to grant the access token to view and manage Copilot cloud agent settings for an organization. /// /// - Remark: Generated from `#/components/schemas/app-permissions/organization_copilot_agent_settings`. public var organizationCopilotAgentSettings: Components.Schemas.AppPermissions.OrganizationCopilotAgentSettingsPayload? @@ -2864,7 +2864,7 @@ public enum Components { /// - organizationCustomOrgRoles: The level of permission to grant the access token for custom organization roles management. /// - organizationCustomProperties: The level of permission to grant the access token for repository custom properties management at the organization level. /// - organizationCopilotSeatManagement: The level of permission to grant the access token for managing access to GitHub Copilot for members of an organization with a Copilot Business subscription. This property is in public preview and is subject to change. - /// - organizationCopilotAgentSettings: The level of permission to grant the access token to view and manage Copilot coding agent settings for an organization. + /// - organizationCopilotAgentSettings: The level of permission to grant the access token to view and manage Copilot cloud agent settings for an organization. /// - organizationAnnouncementBanners: The level of permission to grant the access token to view and manage announcement banners for an organization. /// - organizationEvents: The level of permission to grant the access token to view events triggered by an activity in an organization. /// - organizationHooks: The level of permission to grant the access token to manage the post-receive hooks for an organization. From 9559979c119dae3b3af272e1eda695b26999122a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 01:06:51 +0000 Subject: [PATCH 3/7] Commit via running: make Sources/orgs --- Sources/orgs/Types.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/orgs/Types.swift b/Sources/orgs/Types.swift index 557b42f71d..8f7d941e74 100644 --- a/Sources/orgs/Types.swift +++ b/Sources/orgs/Types.swift @@ -4330,14 +4330,14 @@ public enum Components { /// /// - Remark: Generated from `#/components/schemas/app-permissions/organization_copilot_seat_management`. public var organizationCopilotSeatManagement: Components.Schemas.AppPermissions.OrganizationCopilotSeatManagementPayload? - /// The level of permission to grant the access token to view and manage Copilot coding agent settings for an organization. + /// The level of permission to grant the access token to view and manage Copilot cloud agent settings for an organization. /// /// - Remark: Generated from `#/components/schemas/app-permissions/organization_copilot_agent_settings`. @frozen public enum OrganizationCopilotAgentSettingsPayload: String, Codable, Hashable, Sendable, CaseIterable { case read = "read" case write = "write" } - /// The level of permission to grant the access token to view and manage Copilot coding agent settings for an organization. + /// The level of permission to grant the access token to view and manage Copilot cloud agent settings for an organization. /// /// - Remark: Generated from `#/components/schemas/app-permissions/organization_copilot_agent_settings`. public var organizationCopilotAgentSettings: Components.Schemas.AppPermissions.OrganizationCopilotAgentSettingsPayload? @@ -4586,7 +4586,7 @@ public enum Components { /// - organizationCustomOrgRoles: The level of permission to grant the access token for custom organization roles management. /// - organizationCustomProperties: The level of permission to grant the access token for repository custom properties management at the organization level. /// - organizationCopilotSeatManagement: The level of permission to grant the access token for managing access to GitHub Copilot for members of an organization with a Copilot Business subscription. This property is in public preview and is subject to change. - /// - organizationCopilotAgentSettings: The level of permission to grant the access token to view and manage Copilot coding agent settings for an organization. + /// - organizationCopilotAgentSettings: The level of permission to grant the access token to view and manage Copilot cloud agent settings for an organization. /// - organizationAnnouncementBanners: The level of permission to grant the access token to view and manage announcement banners for an organization. /// - organizationEvents: The level of permission to grant the access token to view events triggered by an activity in an organization. /// - organizationHooks: The level of permission to grant the access token to manage the post-receive hooks for an organization. From 93aa99e2bc0d291ea42098878c45a5c1f86b9134 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 01:11:27 +0000 Subject: [PATCH 4/7] Commit via running: make Sources/copilot --- Sources/copilot/Client.swift | 42 +++++----- Sources/copilot/Types.swift | 156 +++++++++++++++++------------------ 2 files changed, 99 insertions(+), 99 deletions(-) diff --git a/Sources/copilot/Client.swift b/Sources/copilot/Client.swift index 5f24874937..5f144d3724 100644 --- a/Sources/copilot/Client.swift +++ b/Sources/copilot/Client.swift @@ -598,9 +598,9 @@ public struct Client: APIProtocol { } /// Set the coding agent policy for an enterprise /// - /// Sets the policy for Copilot coding agent usage across an enterprise. + /// Sets the policy for Copilot cloud agent usage across an enterprise. /// - /// Enterprise owners can configure whether Copilot coding agent is enabled for all + /// Enterprise owners can configure whether Copilot cloud agent is enabled for all /// organizations, disabled for all organizations, configured by individual organization /// admins, or enabled for selected organizations only. /// @@ -690,7 +690,7 @@ public struct Client: APIProtocol { } /// Add organizations to the enterprise coding agent policy /// - /// Enables Copilot coding agent for the specified organizations within the enterprise. + /// Enables Copilot cloud 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. @@ -783,7 +783,7 @@ public struct Client: APIProtocol { } /// Remove organizations from the enterprise coding agent policy /// - /// Disables Copilot coding agent for the specified organizations within the enterprise. + /// Disables Copilot cloud 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. @@ -1918,15 +1918,15 @@ public struct Client: APIProtocol { } ) } - /// Get Copilot coding agent permissions for an organization + /// Get Copilot cloud agent permissions for an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Gets information about which repositories in an organization have been enabled - /// or disabled for the Copilot coding agent. + /// or disabled for the Copilot cloud agent. /// - /// Organization owners can configure whether Copilot coding agent is enabled for + /// Organization owners can configure whether Copilot cloud agent is enabled for /// all repositories, selected repositories, or no repositories owned by organization. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -2079,14 +2079,14 @@ public struct Client: APIProtocol { } ) } - /// Set Copilot coding agent permissions for an organization + /// Set Copilot cloud agent permissions for an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Sets the policy for which repositories in an organization can use Copilot coding agent. + /// Sets the policy for which repositories in an organization can use Copilot cloud agent. /// - /// Organization owners can configure whether Copilot coding agent is enabled for + /// Organization owners can configure whether Copilot cloud agent is enabled for /// all repositories, selected repositories, or no repositories owned by the organization. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -2250,12 +2250,12 @@ public struct Client: APIProtocol { } ) } - /// List repositories enabled for Copilot coding agent in an organization + /// List repositories enabled for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Lists the selected repositories that are enabled for Copilot coding agent in an organization. + /// Lists the selected repositories that are enabled for Copilot cloud agent in an organization. /// /// Organization owners can use this endpoint when the coding agent repository policy /// is set to `selected` to see which repositories have been enabled. @@ -2446,13 +2446,13 @@ public struct Client: APIProtocol { } ) } - /// Set selected repositories for Copilot coding agent in an organization + /// Set selected repositories for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Replaces the list of selected repositories that are enabled for Copilot coding - /// agent in an organization. This method can only be called when the coding agent + /// Replaces the list of selected repositories that are enabled for Copilot cloud + /// agent in an organization. This method can only be called when the cloud agent /// repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -2638,14 +2638,14 @@ public struct Client: APIProtocol { } ) } - /// Enable a repository for Copilot coding agent in an organization + /// Enable a repository for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Adds a repository to the list of selected repositories enabled for Copilot - /// coding agent in an organization. This method can only be called when the - /// coding agent repository policy is set to `selected`. + /// cloud agent in an organization. This method can only be called when the + /// cloud agent repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. /// @@ -2822,14 +2822,14 @@ public struct Client: APIProtocol { } ) } - /// Disable a repository for Copilot coding agent in an organization + /// Disable a repository for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Removes a repository from the list of selected repositories enabled for Copilot - /// coding agent in an organization. This method can only be called when the - /// coding agent repository policy is set to `selected`. + /// cloud agent in an organization. This method can only be called when the + /// cloud agent repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scopes to use this endpoint. /// diff --git a/Sources/copilot/Types.swift b/Sources/copilot/Types.swift index 6d97985d5f..c19efbfb24 100644 --- a/Sources/copilot/Types.swift +++ b/Sources/copilot/Types.swift @@ -65,9 +65,9 @@ public protocol APIProtocol: Sendable { 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. + /// Sets the policy for Copilot cloud agent usage across an enterprise. /// - /// Enterprise owners can configure whether Copilot coding agent is enabled for all + /// Enterprise owners can configure whether Copilot cloud agent is enabled for all /// organizations, disabled for all organizations, configured by individual organization /// admins, or enabled for selected organizations only. /// @@ -80,7 +80,7 @@ public protocol APIProtocol: Sendable { 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. + /// Enables Copilot cloud 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. @@ -96,7 +96,7 @@ public protocol APIProtocol: Sendable { 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. + /// Disables Copilot cloud 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. @@ -216,15 +216,15 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `DELETE /orgs/{org}/copilot/billing/selected_users`. /// - Remark: Generated from `#/paths//orgs/{org}/copilot/billing/selected_users/delete(copilot/cancel-copilot-seat-assignment-for-users)`. func copilotCancelCopilotSeatAssignmentForUsers(_ input: Operations.CopilotCancelCopilotSeatAssignmentForUsers.Input) async throws -> Operations.CopilotCancelCopilotSeatAssignmentForUsers.Output - /// Get Copilot coding agent permissions for an organization + /// Get Copilot cloud agent permissions for an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Gets information about which repositories in an organization have been enabled - /// or disabled for the Copilot coding agent. + /// or disabled for the Copilot cloud agent. /// - /// Organization owners can configure whether Copilot coding agent is enabled for + /// Organization owners can configure whether Copilot cloud agent is enabled for /// all repositories, selected repositories, or no repositories owned by organization. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -232,14 +232,14 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `GET /orgs/{org}/copilot/coding-agent/permissions`. /// - Remark: Generated from `#/paths//orgs/{org}/copilot/coding-agent/permissions/get(copilot/get-copilot-coding-agent-permissions-organization)`. func copilotGetCopilotCodingAgentPermissionsOrganization(_ input: Operations.CopilotGetCopilotCodingAgentPermissionsOrganization.Input) async throws -> Operations.CopilotGetCopilotCodingAgentPermissionsOrganization.Output - /// Set Copilot coding agent permissions for an organization + /// Set Copilot cloud agent permissions for an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Sets the policy for which repositories in an organization can use Copilot coding agent. + /// Sets the policy for which repositories in an organization can use Copilot cloud agent. /// - /// Organization owners can configure whether Copilot coding agent is enabled for + /// Organization owners can configure whether Copilot cloud agent is enabled for /// all repositories, selected repositories, or no repositories owned by the organization. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -247,12 +247,12 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `PUT /orgs/{org}/copilot/coding-agent/permissions`. /// - Remark: Generated from `#/paths//orgs/{org}/copilot/coding-agent/permissions/put(copilot/set-copilot-coding-agent-permissions-organization)`. func copilotSetCopilotCodingAgentPermissionsOrganization(_ input: Operations.CopilotSetCopilotCodingAgentPermissionsOrganization.Input) async throws -> Operations.CopilotSetCopilotCodingAgentPermissionsOrganization.Output - /// List repositories enabled for Copilot coding agent in an organization + /// List repositories enabled for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Lists the selected repositories that are enabled for Copilot coding agent in an organization. + /// Lists the selected repositories that are enabled for Copilot cloud agent in an organization. /// /// Organization owners can use this endpoint when the coding agent repository policy /// is set to `selected` to see which repositories have been enabled. @@ -262,13 +262,13 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `GET /orgs/{org}/copilot/coding-agent/permissions/repositories`. /// - Remark: Generated from `#/paths//orgs/{org}/copilot/coding-agent/permissions/repositories/get(copilot/list-copilot-coding-agent-selected-repositories-for-organization)`. func copilotListCopilotCodingAgentSelectedRepositoriesForOrganization(_ input: Operations.CopilotListCopilotCodingAgentSelectedRepositoriesForOrganization.Input) async throws -> Operations.CopilotListCopilotCodingAgentSelectedRepositoriesForOrganization.Output - /// Set selected repositories for Copilot coding agent in an organization + /// Set selected repositories for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Replaces the list of selected repositories that are enabled for Copilot coding - /// agent in an organization. This method can only be called when the coding agent + /// Replaces the list of selected repositories that are enabled for Copilot cloud + /// agent in an organization. This method can only be called when the cloud agent /// repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -276,28 +276,28 @@ public protocol APIProtocol: Sendable { /// - Remark: HTTP `PUT /orgs/{org}/copilot/coding-agent/permissions/repositories`. /// - Remark: Generated from `#/paths//orgs/{org}/copilot/coding-agent/permissions/repositories/put(copilot/set-copilot-coding-agent-selected-repositories-for-organization)`. func copilotSetCopilotCodingAgentSelectedRepositoriesForOrganization(_ input: Operations.CopilotSetCopilotCodingAgentSelectedRepositoriesForOrganization.Input) async throws -> Operations.CopilotSetCopilotCodingAgentSelectedRepositoriesForOrganization.Output - /// Enable a repository for Copilot coding agent in an organization + /// Enable a repository for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Adds a repository to the list of selected repositories enabled for Copilot - /// coding agent in an organization. This method can only be called when the - /// coding agent repository policy is set to `selected`. + /// cloud agent in an organization. This method can only be called when the + /// cloud agent repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. /// /// - Remark: HTTP `PUT /orgs/{org}/copilot/coding-agent/permissions/repositories/{repository_id}`. /// - Remark: Generated from `#/paths//orgs/{org}/copilot/coding-agent/permissions/repositories/{repository_id}/put(copilot/enable-copilot-coding-agent-for-repository-in-organization)`. func copilotEnableCopilotCodingAgentForRepositoryInOrganization(_ input: Operations.CopilotEnableCopilotCodingAgentForRepositoryInOrganization.Input) async throws -> Operations.CopilotEnableCopilotCodingAgentForRepositoryInOrganization.Output - /// Disable a repository for Copilot coding agent in an organization + /// Disable a repository for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Removes a repository from the list of selected repositories enabled for Copilot - /// coding agent in an organization. This method can only be called when the - /// coding agent repository policy is set to `selected`. + /// cloud agent in an organization. This method can only be called when the + /// cloud agent repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scopes to use this endpoint. /// @@ -553,9 +553,9 @@ extension APIProtocol { } /// Set the coding agent policy for an enterprise /// - /// Sets the policy for Copilot coding agent usage across an enterprise. + /// Sets the policy for Copilot cloud agent usage across an enterprise. /// - /// Enterprise owners can configure whether Copilot coding agent is enabled for all + /// Enterprise owners can configure whether Copilot cloud agent is enabled for all /// organizations, disabled for all organizations, configured by individual organization /// admins, or enabled for selected organizations only. /// @@ -578,7 +578,7 @@ extension APIProtocol { } /// Add organizations to the enterprise coding agent policy /// - /// Enables Copilot coding agent for the specified organizations within the enterprise. + /// Enables Copilot cloud 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. @@ -604,7 +604,7 @@ extension APIProtocol { } /// Remove organizations from the enterprise coding agent policy /// - /// Disables Copilot coding agent for the specified organizations within the enterprise. + /// Disables Copilot cloud 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. @@ -792,15 +792,15 @@ extension APIProtocol { body: body )) } - /// Get Copilot coding agent permissions for an organization + /// Get Copilot cloud agent permissions for an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Gets information about which repositories in an organization have been enabled - /// or disabled for the Copilot coding agent. + /// or disabled for the Copilot cloud agent. /// - /// Organization owners can configure whether Copilot coding agent is enabled for + /// Organization owners can configure whether Copilot cloud agent is enabled for /// all repositories, selected repositories, or no repositories owned by organization. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -816,14 +816,14 @@ extension APIProtocol { headers: headers )) } - /// Set Copilot coding agent permissions for an organization + /// Set Copilot cloud agent permissions for an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Sets the policy for which repositories in an organization can use Copilot coding agent. + /// Sets the policy for which repositories in an organization can use Copilot cloud agent. /// - /// Organization owners can configure whether Copilot coding agent is enabled for + /// Organization owners can configure whether Copilot cloud agent is enabled for /// all repositories, selected repositories, or no repositories owned by the organization. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -841,12 +841,12 @@ extension APIProtocol { body: body )) } - /// List repositories enabled for Copilot coding agent in an organization + /// List repositories enabled for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Lists the selected repositories that are enabled for Copilot coding agent in an organization. + /// Lists the selected repositories that are enabled for Copilot cloud agent in an organization. /// /// Organization owners can use this endpoint when the coding agent repository policy /// is set to `selected` to see which repositories have been enabled. @@ -866,13 +866,13 @@ extension APIProtocol { headers: headers )) } - /// Set selected repositories for Copilot coding agent in an organization + /// Set selected repositories for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Replaces the list of selected repositories that are enabled for Copilot coding - /// agent in an organization. This method can only be called when the coding agent + /// Replaces the list of selected repositories that are enabled for Copilot cloud + /// agent in an organization. This method can only be called when the cloud agent /// repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -890,14 +890,14 @@ extension APIProtocol { body: body )) } - /// Enable a repository for Copilot coding agent in an organization + /// Enable a repository for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Adds a repository to the list of selected repositories enabled for Copilot - /// coding agent in an organization. This method can only be called when the - /// coding agent repository policy is set to `selected`. + /// cloud agent in an organization. This method can only be called when the + /// cloud agent repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. /// @@ -912,14 +912,14 @@ extension APIProtocol { headers: headers )) } - /// Disable a repository for Copilot coding agent in an organization + /// Disable a repository for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Removes a repository from the list of selected repositories enabled for Copilot - /// coding agent in an organization. This method can only be called when the - /// coding agent repository policy is set to `selected`. + /// cloud agent in an organization. This method can only be called when the + /// cloud agent repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scopes to use this endpoint. /// @@ -5905,9 +5905,9 @@ public enum Operations { } /// Set the coding agent policy for an enterprise /// - /// Sets the policy for Copilot coding agent usage across an enterprise. + /// Sets the policy for Copilot cloud agent usage across an enterprise. /// - /// Enterprise owners can configure whether Copilot coding agent is enabled for all + /// Enterprise owners can configure whether Copilot cloud agent is enabled for all /// organizations, disabled for all organizations, configured by individual organization /// admins, or enabled for selected organizations only. /// @@ -5951,7 +5951,7 @@ public enum Operations { @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`. + /// The policy state for Copilot cloud 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 { @@ -5960,14 +5960,14 @@ public enum Operations { 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`. + /// The policy state for Copilot cloud 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`. + /// - policyState: The policy state for Copilot cloud 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 } @@ -6089,7 +6089,7 @@ public enum Operations { } /// Add organizations to the enterprise coding agent policy /// - /// Enables Copilot coding agent for the specified organizations within the enterprise. + /// Enables Copilot cloud 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. @@ -6136,7 +6136,7 @@ public enum Operations { @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. + /// List of organization logins within the enterprise to enable Copilot cloud agent for. /// /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/POST/requestBody/json/organizations`. public var organizations: [Swift.String]? @@ -6178,7 +6178,7 @@ public enum Operations { /// Creates a new `JsonPayload`. /// /// - Parameters: - /// - organizations: List of organization logins within the enterprise to enable Copilot coding agent for. + /// - organizations: List of organization logins within the enterprise to enable Copilot cloud 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, @@ -6306,7 +6306,7 @@ public enum Operations { } /// Remove organizations from the enterprise coding agent policy /// - /// Disables Copilot coding agent for the specified organizations within the enterprise. + /// Disables Copilot cloud 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. @@ -6353,7 +6353,7 @@ public enum Operations { @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. + /// List of organization logins within the enterprise to disable Copilot cloud agent for. /// /// - Remark: Generated from `#/paths/enterprises/{enterprise}/copilot/policies/coding_agent/organizations/DELETE/requestBody/json/organizations`. public var organizations: [Swift.String]? @@ -6395,7 +6395,7 @@ public enum Operations { /// Creates a new `JsonPayload`. /// /// - Parameters: - /// - organizations: List of organization logins within the enterprise to disable Copilot coding agent for. + /// - organizations: List of organization logins within the enterprise to disable Copilot cloud 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, @@ -8347,15 +8347,15 @@ public enum Operations { } } } - /// Get Copilot coding agent permissions for an organization + /// Get Copilot cloud agent permissions for an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Gets information about which repositories in an organization have been enabled - /// or disabled for the Copilot coding agent. + /// or disabled for the Copilot cloud agent. /// - /// Organization owners can configure whether Copilot coding agent is enabled for + /// Organization owners can configure whether Copilot cloud agent is enabled for /// all repositories, selected repositories, or no repositories owned by organization. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -8411,7 +8411,7 @@ public enum Operations { @frozen public enum Body: Sendable, Hashable { /// - Remark: Generated from `#/paths/orgs/{org}/copilot/coding-agent/permissions/GET/responses/200/content/json`. public struct JsonPayload: Codable, Hashable, Sendable { - /// The policy for which repositories can use Copilot coding agent. Can be one of `all`, `selected`, or `none`. + /// The policy for which repositories can use Copilot cloud agent. Can be one of `all`, `selected`, or `none`. /// /// - Remark: Generated from `#/paths/orgs/{org}/copilot/coding-agent/permissions/GET/responses/200/content/json/enabled_repositories`. @frozen public enum EnabledRepositoriesPayload: String, Codable, Hashable, Sendable, CaseIterable { @@ -8419,7 +8419,7 @@ public enum Operations { case selected = "selected" case none = "none" } - /// The policy for which repositories can use Copilot coding agent. Can be one of `all`, `selected`, or `none`. + /// The policy for which repositories can use Copilot cloud agent. Can be one of `all`, `selected`, or `none`. /// /// - Remark: Generated from `#/paths/orgs/{org}/copilot/coding-agent/permissions/GET/responses/200/content/json/enabled_repositories`. public var enabledRepositories: Operations.CopilotGetCopilotCodingAgentPermissionsOrganization.Output.Ok.Body.JsonPayload.EnabledRepositoriesPayload @@ -8430,7 +8430,7 @@ public enum Operations { /// Creates a new `JsonPayload`. /// /// - Parameters: - /// - enabledRepositories: The policy for which repositories can use Copilot coding agent. Can be one of `all`, `selected`, or `none`. + /// - enabledRepositories: The policy for which repositories can use Copilot cloud agent. Can be one of `all`, `selected`, or `none`. /// - selectedRepositoriesUrl: The URL for the selected repositories endpoint. Only present when `enabled_repositories` is `selected`. public init( enabledRepositories: Operations.CopilotGetCopilotCodingAgentPermissionsOrganization.Output.Ok.Body.JsonPayload.EnabledRepositoriesPayload, @@ -8615,14 +8615,14 @@ public enum Operations { } } } - /// Set Copilot coding agent permissions for an organization + /// Set Copilot cloud agent permissions for an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Sets the policy for which repositories in an organization can use Copilot coding agent. + /// Sets the policy for which repositories in an organization can use Copilot cloud agent. /// - /// Organization owners can configure whether Copilot coding agent is enabled for + /// Organization owners can configure whether Copilot cloud agent is enabled for /// all repositories, selected repositories, or no repositories owned by the organization. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -8663,7 +8663,7 @@ public enum Operations { @frozen public enum Body: Sendable, Hashable { /// - Remark: Generated from `#/paths/orgs/{org}/copilot/coding-agent/permissions/PUT/requestBody/json`. public struct JsonPayload: Codable, Hashable, Sendable { - /// The policy for which repositories can use Copilot coding agent. Can be one of `all`, `selected`, or `none`. + /// The policy for which repositories can use Copilot cloud agent. Can be one of `all`, `selected`, or `none`. /// /// - Remark: Generated from `#/paths/orgs/{org}/copilot/coding-agent/permissions/PUT/requestBody/json/enabled_repositories`. @frozen public enum EnabledRepositoriesPayload: String, Codable, Hashable, Sendable, CaseIterable { @@ -8671,14 +8671,14 @@ public enum Operations { case selected = "selected" case none = "none" } - /// The policy for which repositories can use Copilot coding agent. Can be one of `all`, `selected`, or `none`. + /// The policy for which repositories can use Copilot cloud agent. Can be one of `all`, `selected`, or `none`. /// /// - Remark: Generated from `#/paths/orgs/{org}/copilot/coding-agent/permissions/PUT/requestBody/json/enabled_repositories`. public var enabledRepositories: Operations.CopilotSetCopilotCodingAgentPermissionsOrganization.Input.Body.JsonPayload.EnabledRepositoriesPayload /// Creates a new `JsonPayload`. /// /// - Parameters: - /// - enabledRepositories: The policy for which repositories can use Copilot coding agent. Can be one of `all`, `selected`, or `none`. + /// - enabledRepositories: The policy for which repositories can use Copilot cloud agent. Can be one of `all`, `selected`, or `none`. public init(enabledRepositories: Operations.CopilotSetCopilotCodingAgentPermissionsOrganization.Input.Body.JsonPayload.EnabledRepositoriesPayload) { self.enabledRepositories = enabledRepositories } @@ -8888,12 +8888,12 @@ public enum Operations { } } } - /// List repositories enabled for Copilot coding agent in an organization + /// List repositories enabled for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Lists the selected repositories that are enabled for Copilot coding agent in an organization. + /// Lists the selected repositories that are enabled for Copilot cloud agent in an organization. /// /// Organization owners can use this endpoint when the coding agent repository policy /// is set to `selected` to see which repositories have been enabled. @@ -9193,13 +9193,13 @@ public enum Operations { } } } - /// Set selected repositories for Copilot coding agent in an organization + /// Set selected repositories for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// - /// Replaces the list of selected repositories that are enabled for Copilot coding - /// agent in an organization. This method can only be called when the coding agent + /// Replaces the list of selected repositories that are enabled for Copilot cloud + /// agent in an organization. This method can only be called when the cloud agent /// repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. @@ -9240,14 +9240,14 @@ public enum Operations { @frozen public enum Body: Sendable, Hashable { /// - Remark: Generated from `#/paths/orgs/{org}/copilot/coding-agent/permissions/repositories/PUT/requestBody/json`. public struct JsonPayload: Codable, Hashable, Sendable { - /// List of repository IDs to enable for Copilot coding agent. + /// List of repository IDs to enable for Copilot cloud agent. /// /// - Remark: Generated from `#/paths/orgs/{org}/copilot/coding-agent/permissions/repositories/PUT/requestBody/json/selected_repository_ids`. public var selectedRepositoryIds: [Swift.Int] /// Creates a new `JsonPayload`. /// /// - Parameters: - /// - selectedRepositoryIds: List of repository IDs to enable for Copilot coding agent. + /// - selectedRepositoryIds: List of repository IDs to enable for Copilot cloud agent. public init(selectedRepositoryIds: [Swift.Int]) { self.selectedRepositoryIds = selectedRepositoryIds } @@ -9480,14 +9480,14 @@ public enum Operations { } } } - /// Enable a repository for Copilot coding agent in an organization + /// Enable a repository for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Adds a repository to the list of selected repositories enabled for Copilot - /// coding agent in an organization. This method can only be called when the - /// coding agent repository policy is set to `selected`. + /// cloud agent in an organization. This method can only be called when the + /// cloud agent repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint. /// @@ -9750,14 +9750,14 @@ public enum Operations { } } } - /// Disable a repository for Copilot coding agent in an organization + /// Disable a repository for Copilot cloud agent in an organization /// /// > [!NOTE] /// > This endpoint is in public preview and is subject to change. /// /// Removes a repository from the list of selected repositories enabled for Copilot - /// coding agent in an organization. This method can only be called when the - /// coding agent repository policy is set to `selected`. + /// cloud agent in an organization. This method can only be called when the + /// cloud agent repository policy is set to `selected`. /// /// OAuth app tokens and personal access tokens (classic) need the `admin:org` scopes to use this endpoint. /// From 90a6c76928e62943b3124d53560a9450d5887cfc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 01:11:51 +0000 Subject: [PATCH 5/7] Commit via running: make Sources/copilot-spaces --- Sources/copilot-spaces/Client.swift | 3573 +++++++++++ Sources/copilot-spaces/Types.swift | 9253 +++++++++++++++++++++++++++ 2 files changed, 12826 insertions(+) create mode 100644 Sources/copilot-spaces/Client.swift create mode 100644 Sources/copilot-spaces/Types.swift diff --git a/Sources/copilot-spaces/Client.swift b/Sources/copilot-spaces/Client.swift new file mode 100644 index 0000000000..daf2356231 --- /dev/null +++ b/Sources/copilot-spaces/Client.swift @@ -0,0 +1,3573 @@ +// Generated by swift-openapi-generator, do not modify. +@_spi(Generated) import OpenAPIRuntime +#if os(Linux) +@preconcurrency import struct Foundation.URL +@preconcurrency import struct Foundation.Data +@preconcurrency import struct Foundation.Date +#else +import struct Foundation.URL +import struct Foundation.Data +import struct Foundation.Date +#endif +import HTTPTypes +/// GitHub's v3 REST API. +public struct Client: APIProtocol { + /// The underlying HTTP client. + private let client: UniversalClient + /// Creates a new client. + /// - Parameters: + /// - serverURL: The server URL that the client connects to. Any server + /// URLs defined in the OpenAPI document are available as static methods + /// on the ``Servers`` type. + /// - configuration: A set of configuration values for the client. + /// - transport: A transport that performs HTTP operations. + /// - middlewares: A list of middlewares to call before the transport. + public init( + serverURL: Foundation.URL, + configuration: Configuration = .init(), + transport: any ClientTransport, + middlewares: [any ClientMiddleware] = [] + ) { + self.client = .init( + serverURL: serverURL, + configuration: configuration, + transport: transport, + middlewares: middlewares + ) + } + private var converter: Converter { + client.converter + } + /// List organization Copilot Spaces + /// + /// Lists Copilot Spaces owned by an organization. The authenticated user must have read access to the organization's Copilot Spaces. + /// + /// Only Spaces that are readable by the authenticated user are returned. This includes public Spaces and internal Spaces if the user is a member of the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/get(copilot-spaces/list-for-org)`. + public func copilotSpacesListForOrg(_ input: Operations.CopilotSpacesListForOrg.Input) async throws -> Operations.CopilotSpacesListForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesListForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces", + parameters: [ + input.path.org + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "per_page", + value: input.query.perPage + ) + 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 + ) + 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.CopilotSpacesListForOrg.Output.Ok.Headers = .init(link: try converter.getOptionalHeaderFieldAsURI( + in: response.headerFields, + name: "Link", + as: Components.Headers.Link.self + )) + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.CopilotSpacesListForOrg.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Operations.CopilotSpacesListForOrg.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 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Create an organization Copilot Space + /// + /// Creates a new Copilot Space owned by an organization. The authenticated user must have permissions to create spaces in the organization. + /// + /// Organization members with appropriate permissions can create Copilot Spaces to be shared within their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/post(copilot-spaces/create-for-org)`. + public func copilotSpacesCreateForOrg(_ input: Operations.CopilotSpacesCreateForOrg.Input) async throws -> Operations.CopilotSpacesCreateForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesCreateForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces", + parameters: [ + input.path.org + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .post + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + let body: OpenAPIRuntime.HTTPBody? + switch input.body { + case 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.CopilotSpacesCreateForOrg.Output.Created.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.CopilotSpace.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .created(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 an organization Copilot Space + /// + /// Gets details about a specific Copilot Space owned by an organization. The authenticated user must have read access to the Space. + /// + /// Internal Spaces require the authenticated user to be a member of the organization or have been granted read permissions. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-org)`. + public func copilotSpacesGetForOrg(_ input: Operations.CopilotSpacesGetForOrg.Input) async throws -> Operations.CopilotSpacesGetForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesGetForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}", + parameters: [ + input.path.org, + input.path.spaceNumber + ] + ) + 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.CopilotSpacesGetForOrg.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.CopilotSpace.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Set an organization Copilot Space + /// + /// Updates a Copilot Space owned by an organization. The authenticated user must have permissions to update spaces in the organization. + /// + /// Organization members with appropriate permissions can update Copilot Spaces owned by their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-org)`. + public func copilotSpacesUpdateForOrg(_ input: Operations.CopilotSpacesUpdateForOrg.Input) async throws -> Operations.CopilotSpacesUpdateForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesUpdateForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}", + parameters: [ + input.path.org, + input.path.spaceNumber + ] + ) + 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 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.CopilotSpacesUpdateForOrg.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.CopilotSpace.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 + ) + ) + } + } + ) + } + /// Delete an organization Copilot Space + /// + /// Deletes a Copilot Space owned by an organization. The authenticated user must have permissions to delete spaces in the organization. + /// + /// **Warning:** This action is permanent and cannot be undone. Deleting a Copilot Space will remove all associated resources and configurations. + /// + /// Organization members with appropriate permissions can delete Copilot Spaces owned by their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need both the `read:org` and `repo` scopes to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-org)`. + public func copilotSpacesDeleteForOrg(_ input: Operations.CopilotSpacesDeleteForOrg.Input) async throws -> Operations.CopilotSpacesDeleteForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesDeleteForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}", + parameters: [ + input.path.org, + input.path.spaceNumber + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 204: + return .noContent(.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 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 collaborators for an organization Copilot Space + /// + /// Lists all collaborators for a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to view collaborators. + /// + /// Each collaborator entry specifies which user or team has access to the space and at what level (reader, writer, or admin). The space owner (organization) is excluded from this list. + /// + /// **Note:** Team collaborators listed here are teams that are defined in the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-org)`. + public func copilotSpacesListCollaboratorsForOrg(_ input: Operations.CopilotSpacesListCollaboratorsForOrg.Input) async throws -> Operations.CopilotSpacesListCollaboratorsForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesListCollaboratorsForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}/collaborators", + parameters: [ + input.path.org, + input.path.spaceNumber + ] + ) + 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.CopilotSpacesListCollaboratorsForOrg.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Operations.CopilotSpacesListCollaboratorsForOrg.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 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Add a collaborator to an organization Copilot Space + /// + /// Adds a collaborator (user or team) to a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// **Note:** When adding users as collaborators, they must already be members of the organization. + /// When adding teams as collaborators, they must be defined in the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-org)`. + public func copilotSpacesAddCollaboratorForOrg(_ input: Operations.CopilotSpacesAddCollaboratorForOrg.Input) async throws -> Operations.CopilotSpacesAddCollaboratorForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesAddCollaboratorForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}/collaborators", + parameters: [ + input.path.org, + input.path.spaceNumber + ] + ) + 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.CopilotSpacesAddCollaboratorForOrg.Output.Created.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.CopilotSpaceCollaborator.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .created(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 + ) + ) + } + } + ) + } + /// Set a collaborator role for an organization Copilot Space + /// + /// Updates the role of a collaborator for a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-org)`. + public func copilotSpacesUpdateCollaboratorForOrg(_ input: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input) async throws -> Operations.CopilotSpacesUpdateCollaboratorForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesUpdateCollaboratorForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}/collaborators/{}/{}", + parameters: [ + input.path.org, + input.path.spaceNumber, + input.path.actorType, + input.path.actorIdentifier + ] + ) + 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 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.CopilotSpacesUpdateCollaboratorForOrg.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.CopilotSpaceCollaborator.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 204: + return .noContent(.init()) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 + ) + ) + } + } + ) + } + /// Remove a collaborator from an organization Copilot Space + /// + /// Removes a collaborator from a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-org)`. + public func copilotSpacesRemoveCollaboratorForOrg(_ input: Operations.CopilotSpacesRemoveCollaboratorForOrg.Input) async throws -> Operations.CopilotSpacesRemoveCollaboratorForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesRemoveCollaboratorForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}/collaborators/{}/{}", + parameters: [ + input.path.org, + input.path.spaceNumber, + input.path.actorType, + input.path.actorIdentifier + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 204: + return .noContent(.init()) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// List resources for an organization Copilot Space + /// + /// Lists all resources attached to a specific Copilot Space owned by an organization. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-org)`. + public func copilotSpacesListResourcesForOrg(_ input: Operations.CopilotSpacesListResourcesForOrg.Input) async throws -> Operations.CopilotSpacesListResourcesForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesListResourcesForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}/resources", + parameters: [ + input.path.org, + input.path.spaceNumber + ] + ) + 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.CopilotSpacesListResourcesForOrg.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Operations.CopilotSpacesListResourcesForOrg.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 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Create a resource for an organization Copilot Space + /// + /// Creates a new resource in a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// The following resource types are supported: `repository`, `github_file`, `free_text`, `github_issue`, `github_pull_request`. + /// The `uploaded_text_file` and `media_content` types are not supported via this endpoint. + /// + /// For `github_file` resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a `200` status. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-org)`. + public func copilotSpacesCreateResourceForOrg(_ input: Operations.CopilotSpacesCreateResourceForOrg.Input) async throws -> Operations.CopilotSpacesCreateResourceForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesCreateResourceForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}/resources", + parameters: [ + input.path.org, + input.path.spaceNumber + ] + ) + 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.CopilotSpacesCreateResourceForOrg.Output.Created.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.CopilotSpaceResource.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .created(.init(body: body)) + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.CopilotSpacesCreateResourceForOrg.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.CopilotSpaceResource.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 resource for an organization Copilot Space + /// + /// Gets a specific resource attached to a Copilot Space owned by an organization. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-org)`. + public func copilotSpacesGetResourceForOrg(_ input: Operations.CopilotSpacesGetResourceForOrg.Input) async throws -> Operations.CopilotSpacesGetResourceForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesGetResourceForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}/resources/{}", + parameters: [ + input.path.org, + input.path.spaceNumber, + input.path.spaceResourceId + ] + ) + 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.CopilotSpacesGetResourceForOrg.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.CopilotSpaceResource.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Set a resource for an organization Copilot Space + /// + /// Updates the metadata of a resource in a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-org)`. + public func copilotSpacesUpdateResourceForOrg(_ input: Operations.CopilotSpacesUpdateResourceForOrg.Input) async throws -> Operations.CopilotSpacesUpdateResourceForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesUpdateResourceForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}/resources/{}", + parameters: [ + input.path.org, + input.path.spaceNumber, + input.path.spaceResourceId + ] + ) + 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 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.CopilotSpacesUpdateResourceForOrg.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.CopilotSpaceResource.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 + ) + ) + } + } + ) + } + /// Delete a resource from an organization Copilot Space + /// + /// Deletes a resource from a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-org)`. + public func copilotSpacesDeleteResourceForOrg(_ input: Operations.CopilotSpacesDeleteResourceForOrg.Input) async throws -> Operations.CopilotSpacesDeleteResourceForOrg.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesDeleteResourceForOrg.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/orgs/{}/copilot-spaces/{}/resources/{}", + parameters: [ + input.path.org, + input.path.spaceNumber, + input.path.spaceResourceId + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 204: + return .noContent(.init()) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// List Copilot Spaces for a user + /// + /// Lists Copilot Spaces owned by a user. The authenticated user must have read access to the user's Copilot Spaces. + /// + /// Only Spaces that are readable by the authenticated user are returned. This includes the user's own spaces, and public user spaces when accessing another user's spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/get(copilot-spaces/list-for-user)`. + public func copilotSpacesListForUser(_ input: Operations.CopilotSpacesListForUser.Input) async throws -> Operations.CopilotSpacesListForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesListForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces", + parameters: [ + input.path.username + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .get + ) + suppressMutabilityWarning(&request) + try converter.setQueryItemAsURI( + in: &request, + style: .form, + explode: true, + name: "per_page", + value: input.query.perPage + ) + 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 + ) + 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.CopilotSpacesListForUser.Output.Ok.Headers = .init(link: try converter.getOptionalHeaderFieldAsURI( + in: response.headerFields, + name: "Link", + as: Components.Headers.Link.self + )) + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.CopilotSpacesListForUser.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Operations.CopilotSpacesListForUser.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 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Create a Copilot Space for a user + /// + /// Creates a new Copilot Space owned by a user. Only the authenticated user can create spaces for their own account. + /// + /// Users can create personal Copilot Spaces for their individual use. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/post(copilot-spaces/create-for-user)`. + public func copilotSpacesCreateForUser(_ input: Operations.CopilotSpacesCreateForUser.Input) async throws -> Operations.CopilotSpacesCreateForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesCreateForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces", + parameters: [ + input.path.username + ] + ) + 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.CopilotSpacesCreateForUser.Output.Created.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.CopilotSpace.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .created(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 Copilot Space for a user + /// + /// Gets details about a specific Copilot Space owned by a user. The authenticated user must have read access to the Space. + /// + /// Private user spaces require the authenticated user to be the owner of the space. + /// Public user spaces are accessible to any authenticated user. + /// + /// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-user)`. + public func copilotSpacesGetForUser(_ input: Operations.CopilotSpacesGetForUser.Input) async throws -> Operations.CopilotSpacesGetForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesGetForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}", + parameters: [ + input.path.username, + input.path.spaceNumber + ] + ) + 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.CopilotSpacesGetForUser.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.CopilotSpace.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Set a Copilot Space for a user + /// + /// Updates a Copilot Space owned by a user. Only the authenticated user can update spaces for their own account. + /// + /// Users can update their personal Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-user)`. + public func copilotSpacesUpdateForUser(_ input: Operations.CopilotSpacesUpdateForUser.Input) async throws -> Operations.CopilotSpacesUpdateForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesUpdateForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}", + parameters: [ + input.path.username, + input.path.spaceNumber + ] + ) + 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 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.CopilotSpacesUpdateForUser.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.CopilotSpace.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 + ) + ) + } + } + ) + } + /// Delete a Copilot Space for a user + /// + /// Deletes a Copilot Space owned by a user. The authenticated user must be the owner of the space. + /// + /// **Warning:** This action is permanent and cannot be undone. Deleting a space will remove all associated resources and configurations. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-user)`. + public func copilotSpacesDeleteForUser(_ input: Operations.CopilotSpacesDeleteForUser.Input) async throws -> Operations.CopilotSpacesDeleteForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesDeleteForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}", + parameters: [ + input.path.username, + input.path.spaceNumber + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 204: + return .noContent(.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 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 collaborators for a Copilot Space for a user + /// + /// Lists all collaborators for a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// Each collaborator entry specifies which user has access to the space and at what level (reader, writer, or admin). The space owner is excluded from this list. + /// + /// Team collaborators are not supported for user-owned Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-user)`. + public func copilotSpacesListCollaboratorsForUser(_ input: Operations.CopilotSpacesListCollaboratorsForUser.Input) async throws -> Operations.CopilotSpacesListCollaboratorsForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesListCollaboratorsForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}/collaborators", + parameters: [ + input.path.username, + input.path.spaceNumber + ] + ) + 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.CopilotSpacesListCollaboratorsForUser.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Operations.CopilotSpacesListCollaboratorsForUser.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 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Add a collaborator to a Copilot Space for a user + /// + /// Adds a collaborator to a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// Team collaborators are not supported for user-owned Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-user)`. + public func copilotSpacesAddCollaboratorForUser(_ input: Operations.CopilotSpacesAddCollaboratorForUser.Input) async throws -> Operations.CopilotSpacesAddCollaboratorForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesAddCollaboratorForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}/collaborators", + parameters: [ + input.path.username, + input.path.spaceNumber + ] + ) + 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.CopilotSpacesAddCollaboratorForUser.Output.Created.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.CopilotSpaceCollaborator.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .created(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 + ) + ) + } + } + ) + } + /// Set a collaborator role for a Copilot Space for a user + /// + /// Updates the role of a collaborator for a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-user)`. + public func copilotSpacesUpdateCollaboratorForUser(_ input: Operations.CopilotSpacesUpdateCollaboratorForUser.Input) async throws -> Operations.CopilotSpacesUpdateCollaboratorForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesUpdateCollaboratorForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}/collaborators/{}/{}", + parameters: [ + input.path.username, + input.path.spaceNumber, + input.path.actorType, + input.path.actorIdentifier + ] + ) + 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 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.CopilotSpacesUpdateCollaboratorForUser.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.CopilotSpaceCollaborator.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 204: + return .noContent(.init()) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 + ) + ) + } + } + ) + } + /// Remove a collaborator from a Copilot Space for a user + /// + /// Removes a collaborator from a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-user)`. + public func copilotSpacesRemoveCollaboratorForUser(_ input: Operations.CopilotSpacesRemoveCollaboratorForUser.Input) async throws -> Operations.CopilotSpacesRemoveCollaboratorForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesRemoveCollaboratorForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}/collaborators/{}/{}", + parameters: [ + input.path.username, + input.path.spaceNumber, + input.path.actorType, + input.path.actorIdentifier + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 204: + return .noContent(.init()) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// List resources for a Copilot Space for a user + /// + /// Lists all resources attached to a specific Copilot Space owned by a user. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-user)`. + public func copilotSpacesListResourcesForUser(_ input: Operations.CopilotSpacesListResourcesForUser.Input) async throws -> Operations.CopilotSpacesListResourcesForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesListResourcesForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}/resources", + parameters: [ + input.path.username, + input.path.spaceNumber + ] + ) + 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.CopilotSpacesListResourcesForUser.Output.Ok.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Operations.CopilotSpacesListResourcesForUser.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 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Create a resource for a Copilot Space for a user + /// + /// Creates a new resource in a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// The following resource types are supported: `repository`, `github_file`, `free_text`, `github_issue`, `github_pull_request`. + /// The `uploaded_text_file` and `media_content` types are not supported via this endpoint. + /// + /// For `github_file` resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a `200` status. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-user)`. + public func copilotSpacesCreateResourceForUser(_ input: Operations.CopilotSpacesCreateResourceForUser.Input) async throws -> Operations.CopilotSpacesCreateResourceForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesCreateResourceForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}/resources", + parameters: [ + input.path.username, + input.path.spaceNumber + ] + ) + 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.CopilotSpacesCreateResourceForUser.Output.Created.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.CopilotSpaceResource.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .created(.init(body: body)) + case 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.CopilotSpacesCreateResourceForUser.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.CopilotSpaceResource.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 resource for a Copilot Space for a user + /// + /// Gets a specific resource attached to a Copilot Space owned by a user. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-user)`. + public func copilotSpacesGetResourceForUser(_ input: Operations.CopilotSpacesGetResourceForUser.Input) async throws -> Operations.CopilotSpacesGetResourceForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesGetResourceForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}/resources/{}", + parameters: [ + input.path.username, + input.path.spaceNumber, + input.path.spaceResourceId + ] + ) + 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.CopilotSpacesGetResourceForUser.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.CopilotSpaceResource.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } + /// Set a resource for a Copilot Space for a user + /// + /// Updates the metadata of a resource in a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-user)`. + public func copilotSpacesUpdateResourceForUser(_ input: Operations.CopilotSpacesUpdateResourceForUser.Input) async throws -> Operations.CopilotSpacesUpdateResourceForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesUpdateResourceForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}/resources/{}", + parameters: [ + input.path.username, + input.path.spaceNumber, + input.path.spaceResourceId + ] + ) + 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 200: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Operations.CopilotSpacesUpdateResourceForUser.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.CopilotSpaceResource.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .ok(.init(body: body)) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + case 422: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.ValidationFailed.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.ValidationError.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 + ) + ) + } + } + ) + } + /// Delete a resource from a Copilot Space for a user + /// + /// Deletes a resource from a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-user)`. + public func copilotSpacesDeleteResourceForUser(_ input: Operations.CopilotSpacesDeleteResourceForUser.Input) async throws -> Operations.CopilotSpacesDeleteResourceForUser.Output { + try await client.send( + input: input, + forOperation: Operations.CopilotSpacesDeleteResourceForUser.id, + serializer: { input in + let path = try converter.renderedPath( + template: "/users/{}/copilot-spaces/{}/resources/{}", + parameters: [ + input.path.username, + input.path.spaceNumber, + input.path.spaceResourceId + ] + ) + var request: HTTPTypes.HTTPRequest = .init( + soar_path: path, + method: .delete + ) + suppressMutabilityWarning(&request) + converter.setAcceptHeader( + in: &request.headerFields, + contentTypes: input.headers.accept + ) + return (request, nil) + }, + deserializer: { response, responseBody in + switch response.status.code { + case 204: + return .noContent(.init()) + case 403: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.Forbidden.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .forbidden(.init(body: body)) + case 404: + let contentType = converter.extractContentTypeIfPresent(in: response.headerFields) + let body: Components.Responses.NotFound.Body + let chosenContentType = try converter.bestContentType( + received: contentType, + options: [ + "application/json" + ] + ) + switch chosenContentType { + case "application/json": + body = try await converter.getResponseBodyAsJSON( + Components.Schemas.BasicError.self, + from: responseBody, + transforming: { value in + .json(value) + } + ) + default: + preconditionFailure("bestContentType chose an invalid content type.") + } + return .notFound(.init(body: body)) + default: + return .undocumented( + statusCode: response.status.code, + .init( + headerFields: response.headerFields, + body: responseBody + ) + ) + } + } + ) + } +} diff --git a/Sources/copilot-spaces/Types.swift b/Sources/copilot-spaces/Types.swift new file mode 100644 index 0000000000..42813ad98e --- /dev/null +++ b/Sources/copilot-spaces/Types.swift @@ -0,0 +1,9253 @@ +// Generated by swift-openapi-generator, do not modify. +@_spi(Generated) import OpenAPIRuntime +#if os(Linux) +@preconcurrency import struct Foundation.URL +@preconcurrency import struct Foundation.Data +@preconcurrency import struct Foundation.Date +#else +import struct Foundation.URL +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 organization Copilot Spaces + /// + /// Lists Copilot Spaces owned by an organization. The authenticated user must have read access to the organization's Copilot Spaces. + /// + /// Only Spaces that are readable by the authenticated user are returned. This includes public Spaces and internal Spaces if the user is a member of the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/get(copilot-spaces/list-for-org)`. + func copilotSpacesListForOrg(_ input: Operations.CopilotSpacesListForOrg.Input) async throws -> Operations.CopilotSpacesListForOrg.Output + /// Create an organization Copilot Space + /// + /// Creates a new Copilot Space owned by an organization. The authenticated user must have permissions to create spaces in the organization. + /// + /// Organization members with appropriate permissions can create Copilot Spaces to be shared within their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/post(copilot-spaces/create-for-org)`. + func copilotSpacesCreateForOrg(_ input: Operations.CopilotSpacesCreateForOrg.Input) async throws -> Operations.CopilotSpacesCreateForOrg.Output + /// Get an organization Copilot Space + /// + /// Gets details about a specific Copilot Space owned by an organization. The authenticated user must have read access to the Space. + /// + /// Internal Spaces require the authenticated user to be a member of the organization or have been granted read permissions. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-org)`. + func copilotSpacesGetForOrg(_ input: Operations.CopilotSpacesGetForOrg.Input) async throws -> Operations.CopilotSpacesGetForOrg.Output + /// Set an organization Copilot Space + /// + /// Updates a Copilot Space owned by an organization. The authenticated user must have permissions to update spaces in the organization. + /// + /// Organization members with appropriate permissions can update Copilot Spaces owned by their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-org)`. + func copilotSpacesUpdateForOrg(_ input: Operations.CopilotSpacesUpdateForOrg.Input) async throws -> Operations.CopilotSpacesUpdateForOrg.Output + /// Delete an organization Copilot Space + /// + /// Deletes a Copilot Space owned by an organization. The authenticated user must have permissions to delete spaces in the organization. + /// + /// **Warning:** This action is permanent and cannot be undone. Deleting a Copilot Space will remove all associated resources and configurations. + /// + /// Organization members with appropriate permissions can delete Copilot Spaces owned by their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need both the `read:org` and `repo` scopes to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-org)`. + func copilotSpacesDeleteForOrg(_ input: Operations.CopilotSpacesDeleteForOrg.Input) async throws -> Operations.CopilotSpacesDeleteForOrg.Output + /// List collaborators for an organization Copilot Space + /// + /// Lists all collaborators for a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to view collaborators. + /// + /// Each collaborator entry specifies which user or team has access to the space and at what level (reader, writer, or admin). The space owner (organization) is excluded from this list. + /// + /// **Note:** Team collaborators listed here are teams that are defined in the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-org)`. + func copilotSpacesListCollaboratorsForOrg(_ input: Operations.CopilotSpacesListCollaboratorsForOrg.Input) async throws -> Operations.CopilotSpacesListCollaboratorsForOrg.Output + /// Add a collaborator to an organization Copilot Space + /// + /// Adds a collaborator (user or team) to a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// **Note:** When adding users as collaborators, they must already be members of the organization. + /// When adding teams as collaborators, they must be defined in the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-org)`. + func copilotSpacesAddCollaboratorForOrg(_ input: Operations.CopilotSpacesAddCollaboratorForOrg.Input) async throws -> Operations.CopilotSpacesAddCollaboratorForOrg.Output + /// Set a collaborator role for an organization Copilot Space + /// + /// Updates the role of a collaborator for a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-org)`. + func copilotSpacesUpdateCollaboratorForOrg(_ input: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input) async throws -> Operations.CopilotSpacesUpdateCollaboratorForOrg.Output + /// Remove a collaborator from an organization Copilot Space + /// + /// Removes a collaborator from a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-org)`. + func copilotSpacesRemoveCollaboratorForOrg(_ input: Operations.CopilotSpacesRemoveCollaboratorForOrg.Input) async throws -> Operations.CopilotSpacesRemoveCollaboratorForOrg.Output + /// List resources for an organization Copilot Space + /// + /// Lists all resources attached to a specific Copilot Space owned by an organization. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-org)`. + func copilotSpacesListResourcesForOrg(_ input: Operations.CopilotSpacesListResourcesForOrg.Input) async throws -> Operations.CopilotSpacesListResourcesForOrg.Output + /// Create a resource for an organization Copilot Space + /// + /// Creates a new resource in a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// The following resource types are supported: `repository`, `github_file`, `free_text`, `github_issue`, `github_pull_request`. + /// The `uploaded_text_file` and `media_content` types are not supported via this endpoint. + /// + /// For `github_file` resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a `200` status. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-org)`. + func copilotSpacesCreateResourceForOrg(_ input: Operations.CopilotSpacesCreateResourceForOrg.Input) async throws -> Operations.CopilotSpacesCreateResourceForOrg.Output + /// Get a resource for an organization Copilot Space + /// + /// Gets a specific resource attached to a Copilot Space owned by an organization. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-org)`. + func copilotSpacesGetResourceForOrg(_ input: Operations.CopilotSpacesGetResourceForOrg.Input) async throws -> Operations.CopilotSpacesGetResourceForOrg.Output + /// Set a resource for an organization Copilot Space + /// + /// Updates the metadata of a resource in a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-org)`. + func copilotSpacesUpdateResourceForOrg(_ input: Operations.CopilotSpacesUpdateResourceForOrg.Input) async throws -> Operations.CopilotSpacesUpdateResourceForOrg.Output + /// Delete a resource from an organization Copilot Space + /// + /// Deletes a resource from a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-org)`. + func copilotSpacesDeleteResourceForOrg(_ input: Operations.CopilotSpacesDeleteResourceForOrg.Input) async throws -> Operations.CopilotSpacesDeleteResourceForOrg.Output + /// List Copilot Spaces for a user + /// + /// Lists Copilot Spaces owned by a user. The authenticated user must have read access to the user's Copilot Spaces. + /// + /// Only Spaces that are readable by the authenticated user are returned. This includes the user's own spaces, and public user spaces when accessing another user's spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/get(copilot-spaces/list-for-user)`. + func copilotSpacesListForUser(_ input: Operations.CopilotSpacesListForUser.Input) async throws -> Operations.CopilotSpacesListForUser.Output + /// Create a Copilot Space for a user + /// + /// Creates a new Copilot Space owned by a user. Only the authenticated user can create spaces for their own account. + /// + /// Users can create personal Copilot Spaces for their individual use. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/post(copilot-spaces/create-for-user)`. + func copilotSpacesCreateForUser(_ input: Operations.CopilotSpacesCreateForUser.Input) async throws -> Operations.CopilotSpacesCreateForUser.Output + /// Get a Copilot Space for a user + /// + /// Gets details about a specific Copilot Space owned by a user. The authenticated user must have read access to the Space. + /// + /// Private user spaces require the authenticated user to be the owner of the space. + /// Public user spaces are accessible to any authenticated user. + /// + /// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-user)`. + func copilotSpacesGetForUser(_ input: Operations.CopilotSpacesGetForUser.Input) async throws -> Operations.CopilotSpacesGetForUser.Output + /// Set a Copilot Space for a user + /// + /// Updates a Copilot Space owned by a user. Only the authenticated user can update spaces for their own account. + /// + /// Users can update their personal Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-user)`. + func copilotSpacesUpdateForUser(_ input: Operations.CopilotSpacesUpdateForUser.Input) async throws -> Operations.CopilotSpacesUpdateForUser.Output + /// Delete a Copilot Space for a user + /// + /// Deletes a Copilot Space owned by a user. The authenticated user must be the owner of the space. + /// + /// **Warning:** This action is permanent and cannot be undone. Deleting a space will remove all associated resources and configurations. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-user)`. + func copilotSpacesDeleteForUser(_ input: Operations.CopilotSpacesDeleteForUser.Input) async throws -> Operations.CopilotSpacesDeleteForUser.Output + /// List collaborators for a Copilot Space for a user + /// + /// Lists all collaborators for a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// Each collaborator entry specifies which user has access to the space and at what level (reader, writer, or admin). The space owner is excluded from this list. + /// + /// Team collaborators are not supported for user-owned Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-user)`. + func copilotSpacesListCollaboratorsForUser(_ input: Operations.CopilotSpacesListCollaboratorsForUser.Input) async throws -> Operations.CopilotSpacesListCollaboratorsForUser.Output + /// Add a collaborator to a Copilot Space for a user + /// + /// Adds a collaborator to a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// Team collaborators are not supported for user-owned Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-user)`. + func copilotSpacesAddCollaboratorForUser(_ input: Operations.CopilotSpacesAddCollaboratorForUser.Input) async throws -> Operations.CopilotSpacesAddCollaboratorForUser.Output + /// Set a collaborator role for a Copilot Space for a user + /// + /// Updates the role of a collaborator for a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-user)`. + func copilotSpacesUpdateCollaboratorForUser(_ input: Operations.CopilotSpacesUpdateCollaboratorForUser.Input) async throws -> Operations.CopilotSpacesUpdateCollaboratorForUser.Output + /// Remove a collaborator from a Copilot Space for a user + /// + /// Removes a collaborator from a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-user)`. + func copilotSpacesRemoveCollaboratorForUser(_ input: Operations.CopilotSpacesRemoveCollaboratorForUser.Input) async throws -> Operations.CopilotSpacesRemoveCollaboratorForUser.Output + /// List resources for a Copilot Space for a user + /// + /// Lists all resources attached to a specific Copilot Space owned by a user. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-user)`. + func copilotSpacesListResourcesForUser(_ input: Operations.CopilotSpacesListResourcesForUser.Input) async throws -> Operations.CopilotSpacesListResourcesForUser.Output + /// Create a resource for a Copilot Space for a user + /// + /// Creates a new resource in a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// The following resource types are supported: `repository`, `github_file`, `free_text`, `github_issue`, `github_pull_request`. + /// The `uploaded_text_file` and `media_content` types are not supported via this endpoint. + /// + /// For `github_file` resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a `200` status. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-user)`. + func copilotSpacesCreateResourceForUser(_ input: Operations.CopilotSpacesCreateResourceForUser.Input) async throws -> Operations.CopilotSpacesCreateResourceForUser.Output + /// Get a resource for a Copilot Space for a user + /// + /// Gets a specific resource attached to a Copilot Space owned by a user. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-user)`. + func copilotSpacesGetResourceForUser(_ input: Operations.CopilotSpacesGetResourceForUser.Input) async throws -> Operations.CopilotSpacesGetResourceForUser.Output + /// Set a resource for a Copilot Space for a user + /// + /// Updates the metadata of a resource in a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-user)`. + func copilotSpacesUpdateResourceForUser(_ input: Operations.CopilotSpacesUpdateResourceForUser.Input) async throws -> Operations.CopilotSpacesUpdateResourceForUser.Output + /// Delete a resource from a Copilot Space for a user + /// + /// Deletes a resource from a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-user)`. + func copilotSpacesDeleteResourceForUser(_ input: Operations.CopilotSpacesDeleteResourceForUser.Input) async throws -> Operations.CopilotSpacesDeleteResourceForUser.Output +} + +/// Convenience overloads for operation inputs. +extension APIProtocol { + /// List organization Copilot Spaces + /// + /// Lists Copilot Spaces owned by an organization. The authenticated user must have read access to the organization's Copilot Spaces. + /// + /// Only Spaces that are readable by the authenticated user are returned. This includes public Spaces and internal Spaces if the user is a member of the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/get(copilot-spaces/list-for-org)`. + public func copilotSpacesListForOrg( + path: Operations.CopilotSpacesListForOrg.Input.Path, + query: Operations.CopilotSpacesListForOrg.Input.Query = .init(), + headers: Operations.CopilotSpacesListForOrg.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesListForOrg.Output { + try await copilotSpacesListForOrg(Operations.CopilotSpacesListForOrg.Input( + path: path, + query: query, + headers: headers + )) + } + /// Create an organization Copilot Space + /// + /// Creates a new Copilot Space owned by an organization. The authenticated user must have permissions to create spaces in the organization. + /// + /// Organization members with appropriate permissions can create Copilot Spaces to be shared within their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/post(copilot-spaces/create-for-org)`. + public func copilotSpacesCreateForOrg( + path: Operations.CopilotSpacesCreateForOrg.Input.Path, + headers: Operations.CopilotSpacesCreateForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesCreateForOrg.Input.Body + ) async throws -> Operations.CopilotSpacesCreateForOrg.Output { + try await copilotSpacesCreateForOrg(Operations.CopilotSpacesCreateForOrg.Input( + path: path, + headers: headers, + body: body + )) + } + /// Get an organization Copilot Space + /// + /// Gets details about a specific Copilot Space owned by an organization. The authenticated user must have read access to the Space. + /// + /// Internal Spaces require the authenticated user to be a member of the organization or have been granted read permissions. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-org)`. + public func copilotSpacesGetForOrg( + path: Operations.CopilotSpacesGetForOrg.Input.Path, + headers: Operations.CopilotSpacesGetForOrg.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesGetForOrg.Output { + try await copilotSpacesGetForOrg(Operations.CopilotSpacesGetForOrg.Input( + path: path, + headers: headers + )) + } + /// Set an organization Copilot Space + /// + /// Updates a Copilot Space owned by an organization. The authenticated user must have permissions to update spaces in the organization. + /// + /// Organization members with appropriate permissions can update Copilot Spaces owned by their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-org)`. + public func copilotSpacesUpdateForOrg( + path: Operations.CopilotSpacesUpdateForOrg.Input.Path, + headers: Operations.CopilotSpacesUpdateForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateForOrg.Input.Body + ) async throws -> Operations.CopilotSpacesUpdateForOrg.Output { + try await copilotSpacesUpdateForOrg(Operations.CopilotSpacesUpdateForOrg.Input( + path: path, + headers: headers, + body: body + )) + } + /// Delete an organization Copilot Space + /// + /// Deletes a Copilot Space owned by an organization. The authenticated user must have permissions to delete spaces in the organization. + /// + /// **Warning:** This action is permanent and cannot be undone. Deleting a Copilot Space will remove all associated resources and configurations. + /// + /// Organization members with appropriate permissions can delete Copilot Spaces owned by their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need both the `read:org` and `repo` scopes to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-org)`. + public func copilotSpacesDeleteForOrg( + path: Operations.CopilotSpacesDeleteForOrg.Input.Path, + headers: Operations.CopilotSpacesDeleteForOrg.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesDeleteForOrg.Output { + try await copilotSpacesDeleteForOrg(Operations.CopilotSpacesDeleteForOrg.Input( + path: path, + headers: headers + )) + } + /// List collaborators for an organization Copilot Space + /// + /// Lists all collaborators for a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to view collaborators. + /// + /// Each collaborator entry specifies which user or team has access to the space and at what level (reader, writer, or admin). The space owner (organization) is excluded from this list. + /// + /// **Note:** Team collaborators listed here are teams that are defined in the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-org)`. + public func copilotSpacesListCollaboratorsForOrg( + path: Operations.CopilotSpacesListCollaboratorsForOrg.Input.Path, + headers: Operations.CopilotSpacesListCollaboratorsForOrg.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesListCollaboratorsForOrg.Output { + try await copilotSpacesListCollaboratorsForOrg(Operations.CopilotSpacesListCollaboratorsForOrg.Input( + path: path, + headers: headers + )) + } + /// Add a collaborator to an organization Copilot Space + /// + /// Adds a collaborator (user or team) to a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// **Note:** When adding users as collaborators, they must already be members of the organization. + /// When adding teams as collaborators, they must be defined in the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-org)`. + public func copilotSpacesAddCollaboratorForOrg( + path: Operations.CopilotSpacesAddCollaboratorForOrg.Input.Path, + headers: Operations.CopilotSpacesAddCollaboratorForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesAddCollaboratorForOrg.Input.Body + ) async throws -> Operations.CopilotSpacesAddCollaboratorForOrg.Output { + try await copilotSpacesAddCollaboratorForOrg(Operations.CopilotSpacesAddCollaboratorForOrg.Input( + path: path, + headers: headers, + body: body + )) + } + /// Set a collaborator role for an organization Copilot Space + /// + /// Updates the role of a collaborator for a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-org)`. + public func copilotSpacesUpdateCollaboratorForOrg( + path: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Path, + headers: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Body + ) async throws -> Operations.CopilotSpacesUpdateCollaboratorForOrg.Output { + try await copilotSpacesUpdateCollaboratorForOrg(Operations.CopilotSpacesUpdateCollaboratorForOrg.Input( + path: path, + headers: headers, + body: body + )) + } + /// Remove a collaborator from an organization Copilot Space + /// + /// Removes a collaborator from a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-org)`. + public func copilotSpacesRemoveCollaboratorForOrg( + path: Operations.CopilotSpacesRemoveCollaboratorForOrg.Input.Path, + headers: Operations.CopilotSpacesRemoveCollaboratorForOrg.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesRemoveCollaboratorForOrg.Output { + try await copilotSpacesRemoveCollaboratorForOrg(Operations.CopilotSpacesRemoveCollaboratorForOrg.Input( + path: path, + headers: headers + )) + } + /// List resources for an organization Copilot Space + /// + /// Lists all resources attached to a specific Copilot Space owned by an organization. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-org)`. + public func copilotSpacesListResourcesForOrg( + path: Operations.CopilotSpacesListResourcesForOrg.Input.Path, + headers: Operations.CopilotSpacesListResourcesForOrg.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesListResourcesForOrg.Output { + try await copilotSpacesListResourcesForOrg(Operations.CopilotSpacesListResourcesForOrg.Input( + path: path, + headers: headers + )) + } + /// Create a resource for an organization Copilot Space + /// + /// Creates a new resource in a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// The following resource types are supported: `repository`, `github_file`, `free_text`, `github_issue`, `github_pull_request`. + /// The `uploaded_text_file` and `media_content` types are not supported via this endpoint. + /// + /// For `github_file` resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a `200` status. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-org)`. + public func copilotSpacesCreateResourceForOrg( + path: Operations.CopilotSpacesCreateResourceForOrg.Input.Path, + headers: Operations.CopilotSpacesCreateResourceForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesCreateResourceForOrg.Input.Body + ) async throws -> Operations.CopilotSpacesCreateResourceForOrg.Output { + try await copilotSpacesCreateResourceForOrg(Operations.CopilotSpacesCreateResourceForOrg.Input( + path: path, + headers: headers, + body: body + )) + } + /// Get a resource for an organization Copilot Space + /// + /// Gets a specific resource attached to a Copilot Space owned by an organization. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-org)`. + public func copilotSpacesGetResourceForOrg( + path: Operations.CopilotSpacesGetResourceForOrg.Input.Path, + headers: Operations.CopilotSpacesGetResourceForOrg.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesGetResourceForOrg.Output { + try await copilotSpacesGetResourceForOrg(Operations.CopilotSpacesGetResourceForOrg.Input( + path: path, + headers: headers + )) + } + /// Set a resource for an organization Copilot Space + /// + /// Updates the metadata of a resource in a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-org)`. + public func copilotSpacesUpdateResourceForOrg( + path: Operations.CopilotSpacesUpdateResourceForOrg.Input.Path, + headers: Operations.CopilotSpacesUpdateResourceForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateResourceForOrg.Input.Body + ) async throws -> Operations.CopilotSpacesUpdateResourceForOrg.Output { + try await copilotSpacesUpdateResourceForOrg(Operations.CopilotSpacesUpdateResourceForOrg.Input( + path: path, + headers: headers, + body: body + )) + } + /// Delete a resource from an organization Copilot Space + /// + /// Deletes a resource from a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-org)`. + public func copilotSpacesDeleteResourceForOrg( + path: Operations.CopilotSpacesDeleteResourceForOrg.Input.Path, + headers: Operations.CopilotSpacesDeleteResourceForOrg.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesDeleteResourceForOrg.Output { + try await copilotSpacesDeleteResourceForOrg(Operations.CopilotSpacesDeleteResourceForOrg.Input( + path: path, + headers: headers + )) + } + /// List Copilot Spaces for a user + /// + /// Lists Copilot Spaces owned by a user. The authenticated user must have read access to the user's Copilot Spaces. + /// + /// Only Spaces that are readable by the authenticated user are returned. This includes the user's own spaces, and public user spaces when accessing another user's spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/get(copilot-spaces/list-for-user)`. + public func copilotSpacesListForUser( + path: Operations.CopilotSpacesListForUser.Input.Path, + query: Operations.CopilotSpacesListForUser.Input.Query = .init(), + headers: Operations.CopilotSpacesListForUser.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesListForUser.Output { + try await copilotSpacesListForUser(Operations.CopilotSpacesListForUser.Input( + path: path, + query: query, + headers: headers + )) + } + /// Create a Copilot Space for a user + /// + /// Creates a new Copilot Space owned by a user. Only the authenticated user can create spaces for their own account. + /// + /// Users can create personal Copilot Spaces for their individual use. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/post(copilot-spaces/create-for-user)`. + public func copilotSpacesCreateForUser( + path: Operations.CopilotSpacesCreateForUser.Input.Path, + headers: Operations.CopilotSpacesCreateForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesCreateForUser.Input.Body + ) async throws -> Operations.CopilotSpacesCreateForUser.Output { + try await copilotSpacesCreateForUser(Operations.CopilotSpacesCreateForUser.Input( + path: path, + headers: headers, + body: body + )) + } + /// Get a Copilot Space for a user + /// + /// Gets details about a specific Copilot Space owned by a user. The authenticated user must have read access to the Space. + /// + /// Private user spaces require the authenticated user to be the owner of the space. + /// Public user spaces are accessible to any authenticated user. + /// + /// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-user)`. + public func copilotSpacesGetForUser( + path: Operations.CopilotSpacesGetForUser.Input.Path, + headers: Operations.CopilotSpacesGetForUser.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesGetForUser.Output { + try await copilotSpacesGetForUser(Operations.CopilotSpacesGetForUser.Input( + path: path, + headers: headers + )) + } + /// Set a Copilot Space for a user + /// + /// Updates a Copilot Space owned by a user. Only the authenticated user can update spaces for their own account. + /// + /// Users can update their personal Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-user)`. + public func copilotSpacesUpdateForUser( + path: Operations.CopilotSpacesUpdateForUser.Input.Path, + headers: Operations.CopilotSpacesUpdateForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateForUser.Input.Body + ) async throws -> Operations.CopilotSpacesUpdateForUser.Output { + try await copilotSpacesUpdateForUser(Operations.CopilotSpacesUpdateForUser.Input( + path: path, + headers: headers, + body: body + )) + } + /// Delete a Copilot Space for a user + /// + /// Deletes a Copilot Space owned by a user. The authenticated user must be the owner of the space. + /// + /// **Warning:** This action is permanent and cannot be undone. Deleting a space will remove all associated resources and configurations. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-user)`. + public func copilotSpacesDeleteForUser( + path: Operations.CopilotSpacesDeleteForUser.Input.Path, + headers: Operations.CopilotSpacesDeleteForUser.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesDeleteForUser.Output { + try await copilotSpacesDeleteForUser(Operations.CopilotSpacesDeleteForUser.Input( + path: path, + headers: headers + )) + } + /// List collaborators for a Copilot Space for a user + /// + /// Lists all collaborators for a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// Each collaborator entry specifies which user has access to the space and at what level (reader, writer, or admin). The space owner is excluded from this list. + /// + /// Team collaborators are not supported for user-owned Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-user)`. + public func copilotSpacesListCollaboratorsForUser( + path: Operations.CopilotSpacesListCollaboratorsForUser.Input.Path, + headers: Operations.CopilotSpacesListCollaboratorsForUser.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesListCollaboratorsForUser.Output { + try await copilotSpacesListCollaboratorsForUser(Operations.CopilotSpacesListCollaboratorsForUser.Input( + path: path, + headers: headers + )) + } + /// Add a collaborator to a Copilot Space for a user + /// + /// Adds a collaborator to a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// Team collaborators are not supported for user-owned Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-user)`. + public func copilotSpacesAddCollaboratorForUser( + path: Operations.CopilotSpacesAddCollaboratorForUser.Input.Path, + headers: Operations.CopilotSpacesAddCollaboratorForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesAddCollaboratorForUser.Input.Body + ) async throws -> Operations.CopilotSpacesAddCollaboratorForUser.Output { + try await copilotSpacesAddCollaboratorForUser(Operations.CopilotSpacesAddCollaboratorForUser.Input( + path: path, + headers: headers, + body: body + )) + } + /// Set a collaborator role for a Copilot Space for a user + /// + /// Updates the role of a collaborator for a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-user)`. + public func copilotSpacesUpdateCollaboratorForUser( + path: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Path, + headers: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Body + ) async throws -> Operations.CopilotSpacesUpdateCollaboratorForUser.Output { + try await copilotSpacesUpdateCollaboratorForUser(Operations.CopilotSpacesUpdateCollaboratorForUser.Input( + path: path, + headers: headers, + body: body + )) + } + /// Remove a collaborator from a Copilot Space for a user + /// + /// Removes a collaborator from a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-user)`. + public func copilotSpacesRemoveCollaboratorForUser( + path: Operations.CopilotSpacesRemoveCollaboratorForUser.Input.Path, + headers: Operations.CopilotSpacesRemoveCollaboratorForUser.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesRemoveCollaboratorForUser.Output { + try await copilotSpacesRemoveCollaboratorForUser(Operations.CopilotSpacesRemoveCollaboratorForUser.Input( + path: path, + headers: headers + )) + } + /// List resources for a Copilot Space for a user + /// + /// Lists all resources attached to a specific Copilot Space owned by a user. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-user)`. + public func copilotSpacesListResourcesForUser( + path: Operations.CopilotSpacesListResourcesForUser.Input.Path, + headers: Operations.CopilotSpacesListResourcesForUser.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesListResourcesForUser.Output { + try await copilotSpacesListResourcesForUser(Operations.CopilotSpacesListResourcesForUser.Input( + path: path, + headers: headers + )) + } + /// Create a resource for a Copilot Space for a user + /// + /// Creates a new resource in a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// The following resource types are supported: `repository`, `github_file`, `free_text`, `github_issue`, `github_pull_request`. + /// The `uploaded_text_file` and `media_content` types are not supported via this endpoint. + /// + /// For `github_file` resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a `200` status. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-user)`. + public func copilotSpacesCreateResourceForUser( + path: Operations.CopilotSpacesCreateResourceForUser.Input.Path, + headers: Operations.CopilotSpacesCreateResourceForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesCreateResourceForUser.Input.Body + ) async throws -> Operations.CopilotSpacesCreateResourceForUser.Output { + try await copilotSpacesCreateResourceForUser(Operations.CopilotSpacesCreateResourceForUser.Input( + path: path, + headers: headers, + body: body + )) + } + /// Get a resource for a Copilot Space for a user + /// + /// Gets a specific resource attached to a Copilot Space owned by a user. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-user)`. + public func copilotSpacesGetResourceForUser( + path: Operations.CopilotSpacesGetResourceForUser.Input.Path, + headers: Operations.CopilotSpacesGetResourceForUser.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesGetResourceForUser.Output { + try await copilotSpacesGetResourceForUser(Operations.CopilotSpacesGetResourceForUser.Input( + path: path, + headers: headers + )) + } + /// Set a resource for a Copilot Space for a user + /// + /// Updates the metadata of a resource in a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-user)`. + public func copilotSpacesUpdateResourceForUser( + path: Operations.CopilotSpacesUpdateResourceForUser.Input.Path, + headers: Operations.CopilotSpacesUpdateResourceForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateResourceForUser.Input.Body + ) async throws -> Operations.CopilotSpacesUpdateResourceForUser.Output { + try await copilotSpacesUpdateResourceForUser(Operations.CopilotSpacesUpdateResourceForUser.Input( + path: path, + headers: headers, + body: body + )) + } + /// Delete a resource from a Copilot Space for a user + /// + /// Deletes a resource from a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-user)`. + public func copilotSpacesDeleteResourceForUser( + path: Operations.CopilotSpacesDeleteResourceForUser.Input.Path, + headers: Operations.CopilotSpacesDeleteResourceForUser.Input.Headers = .init() + ) async throws -> Operations.CopilotSpacesDeleteResourceForUser.Output { + try await copilotSpacesDeleteResourceForUser(Operations.CopilotSpacesDeleteResourceForUser.Input( + path: path, + headers: headers + )) + } +} + +/// Server URLs defined in the OpenAPI document. +public enum Servers { + public enum Server1 { + public static func url() throws -> Foundation.URL { + try Foundation.URL( + validatingOpenAPIServerURL: "https://api.github.com", + variables: [] + ) + } + } + @available(*, deprecated, renamed: "Servers.Server1.url") + public static func server1() throws -> Foundation.URL { + try Foundation.URL( + validatingOpenAPIServerURL: "https://api.github.com", + variables: [] + ) + } +} + +/// Types generated from the components section of the OpenAPI document. +public enum Components { + /// Types generated from the `#/components/schemas` section of the OpenAPI document. + public enum Schemas { + /// A GitHub user. + /// + /// - Remark: Generated from `#/components/schemas/simple-user`. + public struct SimpleUser: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/simple-user/name`. + public var name: Swift.String? + /// - Remark: Generated from `#/components/schemas/simple-user/email`. + public var email: Swift.String? + /// - Remark: Generated from `#/components/schemas/simple-user/login`. + public var login: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/id`. + public var id: Swift.Int64 + /// - Remark: Generated from `#/components/schemas/simple-user/node_id`. + public var nodeId: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/avatar_url`. + public var avatarUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/gravatar_id`. + public var gravatarId: Swift.String? + /// - Remark: Generated from `#/components/schemas/simple-user/url`. + public var url: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/html_url`. + public var htmlUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/followers_url`. + public var followersUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/following_url`. + public var followingUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/gists_url`. + public var gistsUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/starred_url`. + public var starredUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/subscriptions_url`. + public var subscriptionsUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/organizations_url`. + public var organizationsUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/repos_url`. + public var reposUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/events_url`. + public var eventsUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/received_events_url`. + public var receivedEventsUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/type`. + public var _type: Swift.String + /// - Remark: Generated from `#/components/schemas/simple-user/site_admin`. + public var siteAdmin: Swift.Bool + /// - Remark: Generated from `#/components/schemas/simple-user/starred_at`. + public var starredAt: Swift.String? + /// - Remark: Generated from `#/components/schemas/simple-user/user_view_type`. + public var userViewType: Swift.String? + /// Creates a new `SimpleUser`. + /// + /// - Parameters: + /// - name: + /// - email: + /// - login: + /// - id: + /// - nodeId: + /// - avatarUrl: + /// - gravatarId: + /// - url: + /// - htmlUrl: + /// - followersUrl: + /// - followingUrl: + /// - gistsUrl: + /// - starredUrl: + /// - subscriptionsUrl: + /// - organizationsUrl: + /// - reposUrl: + /// - eventsUrl: + /// - receivedEventsUrl: + /// - _type: + /// - siteAdmin: + /// - starredAt: + /// - userViewType: + public init( + name: Swift.String? = nil, + email: Swift.String? = nil, + login: Swift.String, + id: Swift.Int64, + nodeId: Swift.String, + avatarUrl: Swift.String, + gravatarId: Swift.String? = nil, + url: Swift.String, + htmlUrl: Swift.String, + followersUrl: Swift.String, + followingUrl: Swift.String, + gistsUrl: Swift.String, + starredUrl: Swift.String, + subscriptionsUrl: Swift.String, + organizationsUrl: Swift.String, + reposUrl: Swift.String, + eventsUrl: Swift.String, + receivedEventsUrl: Swift.String, + _type: Swift.String, + siteAdmin: Swift.Bool, + starredAt: Swift.String? = nil, + userViewType: Swift.String? = nil + ) { + self.name = name + self.email = email + self.login = login + self.id = id + self.nodeId = nodeId + self.avatarUrl = avatarUrl + self.gravatarId = gravatarId + self.url = url + self.htmlUrl = htmlUrl + self.followersUrl = followersUrl + self.followingUrl = followingUrl + self.gistsUrl = gistsUrl + self.starredUrl = starredUrl + self.subscriptionsUrl = subscriptionsUrl + self.organizationsUrl = organizationsUrl + self.reposUrl = reposUrl + self.eventsUrl = eventsUrl + self.receivedEventsUrl = receivedEventsUrl + self._type = _type + self.siteAdmin = siteAdmin + self.starredAt = starredAt + self.userViewType = userViewType + } + public enum CodingKeys: String, CodingKey { + case name + case email + case login + case id + case nodeId = "node_id" + case avatarUrl = "avatar_url" + case gravatarId = "gravatar_id" + case url + case htmlUrl = "html_url" + case followersUrl = "followers_url" + case followingUrl = "following_url" + case gistsUrl = "gists_url" + case starredUrl = "starred_url" + case subscriptionsUrl = "subscriptions_url" + case organizationsUrl = "organizations_url" + case reposUrl = "repos_url" + case eventsUrl = "events_url" + case receivedEventsUrl = "received_events_url" + case _type = "type" + case siteAdmin = "site_admin" + case starredAt = "starred_at" + case userViewType = "user_view_type" + } + } + /// Basic Error + /// + /// - Remark: Generated from `#/components/schemas/basic-error`. + public struct BasicError: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/basic-error/message`. + public var message: Swift.String? + /// - Remark: Generated from `#/components/schemas/basic-error/documentation_url`. + public var documentationUrl: Swift.String? + /// - Remark: Generated from `#/components/schemas/basic-error/url`. + public var url: Swift.String? + /// - Remark: Generated from `#/components/schemas/basic-error/status`. + public var status: Swift.String? + /// Creates a new `BasicError`. + /// + /// - Parameters: + /// - message: + /// - documentationUrl: + /// - url: + /// - status: + public init( + message: Swift.String? = nil, + documentationUrl: Swift.String? = nil, + url: Swift.String? = nil, + status: Swift.String? = nil + ) { + self.message = message + self.documentationUrl = documentationUrl + self.url = url + self.status = status + } + public enum CodingKeys: String, CodingKey { + case message + case documentationUrl = "documentation_url" + case url + case status + } + } + /// Validation Error + /// + /// - Remark: Generated from `#/components/schemas/validation-error`. + public struct ValidationError: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/validation-error/message`. + public var message: Swift.String + /// - Remark: Generated from `#/components/schemas/validation-error/documentation_url`. + public var documentationUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/validation-error/ErrorsPayload`. + public struct ErrorsPayloadPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/validation-error/ErrorsPayload/resource`. + public var resource: Swift.String? + /// - Remark: Generated from `#/components/schemas/validation-error/ErrorsPayload/field`. + public var field: Swift.String? + /// - Remark: Generated from `#/components/schemas/validation-error/ErrorsPayload/message`. + public var message: Swift.String? + /// - Remark: Generated from `#/components/schemas/validation-error/ErrorsPayload/code`. + public var code: Swift.String + /// - Remark: Generated from `#/components/schemas/validation-error/ErrorsPayload/index`. + public var index: Swift.Int? + /// - Remark: Generated from `#/components/schemas/validation-error/ErrorsPayload/value`. + @frozen public enum ValuePayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/validation-error/ErrorsPayload/value/case1`. + case case1(Swift.String?) + /// - Remark: Generated from `#/components/schemas/validation-error/ErrorsPayload/value/case2`. + case case2(Swift.Int?) + /// - Remark: Generated from `#/components/schemas/validation-error/ErrorsPayload/value/case3`. + case case3([Swift.String]?) + 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) + } + do { + self = .case3(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) + case let .case3(value): + try encoder.encodeToSingleValueContainer(value) + } + } + } + /// - Remark: Generated from `#/components/schemas/validation-error/ErrorsPayload/value`. + public var value: Components.Schemas.ValidationError.ErrorsPayloadPayload.ValuePayload? + /// Creates a new `ErrorsPayloadPayload`. + /// + /// - Parameters: + /// - resource: + /// - field: + /// - message: + /// - code: + /// - index: + /// - value: + public init( + resource: Swift.String? = nil, + field: Swift.String? = nil, + message: Swift.String? = nil, + code: Swift.String, + index: Swift.Int? = nil, + value: Components.Schemas.ValidationError.ErrorsPayloadPayload.ValuePayload? = nil + ) { + self.resource = resource + self.field = field + self.message = message + self.code = code + self.index = index + self.value = value + } + public enum CodingKeys: String, CodingKey { + case resource + case field + case message + case code + case index + case value + } + } + /// - Remark: Generated from `#/components/schemas/validation-error/errors`. + public typealias ErrorsPayload = [Components.Schemas.ValidationError.ErrorsPayloadPayload] + /// - Remark: Generated from `#/components/schemas/validation-error/errors`. + public var errors: Components.Schemas.ValidationError.ErrorsPayload? + /// Creates a new `ValidationError`. + /// + /// - Parameters: + /// - message: + /// - documentationUrl: + /// - errors: + public init( + message: Swift.String, + documentationUrl: Swift.String, + errors: Components.Schemas.ValidationError.ErrorsPayload? = nil + ) { + self.message = message + self.documentationUrl = documentationUrl + self.errors = errors + } + public enum CodingKeys: String, CodingKey { + case message + case documentationUrl = "documentation_url" + case errors + } + } + /// A GitHub organization. + /// + /// - Remark: Generated from `#/components/schemas/organization-simple`. + public struct OrganizationSimple: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/organization-simple/login`. + public var login: Swift.String + /// - Remark: Generated from `#/components/schemas/organization-simple/id`. + public var id: Swift.Int + /// - Remark: Generated from `#/components/schemas/organization-simple/node_id`. + public var nodeId: Swift.String + /// - Remark: Generated from `#/components/schemas/organization-simple/url`. + public var url: Swift.String + /// - Remark: Generated from `#/components/schemas/organization-simple/repos_url`. + public var reposUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/organization-simple/events_url`. + public var eventsUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/organization-simple/hooks_url`. + public var hooksUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/organization-simple/issues_url`. + public var issuesUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/organization-simple/members_url`. + public var membersUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/organization-simple/public_members_url`. + public var publicMembersUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/organization-simple/avatar_url`. + public var avatarUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/organization-simple/description`. + public var description: Swift.String? + /// Creates a new `OrganizationSimple`. + /// + /// - Parameters: + /// - login: + /// - id: + /// - nodeId: + /// - url: + /// - reposUrl: + /// - eventsUrl: + /// - hooksUrl: + /// - issuesUrl: + /// - membersUrl: + /// - publicMembersUrl: + /// - avatarUrl: + /// - description: + public init( + login: Swift.String, + id: Swift.Int, + nodeId: Swift.String, + url: Swift.String, + reposUrl: Swift.String, + eventsUrl: Swift.String, + hooksUrl: Swift.String, + issuesUrl: Swift.String, + membersUrl: Swift.String, + publicMembersUrl: Swift.String, + avatarUrl: Swift.String, + description: Swift.String? = nil + ) { + self.login = login + self.id = id + self.nodeId = nodeId + self.url = url + self.reposUrl = reposUrl + self.eventsUrl = eventsUrl + self.hooksUrl = hooksUrl + self.issuesUrl = issuesUrl + self.membersUrl = membersUrl + self.publicMembersUrl = publicMembersUrl + self.avatarUrl = avatarUrl + self.description = description + } + public enum CodingKeys: String, CodingKey { + case login + case id + case nodeId = "node_id" + case url + case reposUrl = "repos_url" + case eventsUrl = "events_url" + case hooksUrl = "hooks_url" + case issuesUrl = "issues_url" + case membersUrl = "members_url" + case publicMembersUrl = "public_members_url" + case avatarUrl = "avatar_url" + case description + } + } + /// A GitHub Copilot Space represents an interactive AI workspace where users can ask questions and get assistance. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space`. + public struct CopilotSpace: Codable, Hashable, Sendable { + /// The unique identifier of the space. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/id`. + public var id: Swift.Int64 + /// The number that identifies the space within its owner. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/number`. + public var number: Swift.Int + /// The display name of the space. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/name`. + public var name: Swift.String + /// A description of the space. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/description`. + public var description: Swift.String? + /// General instructions for the Copilot Space. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/general_instructions`. + public var generalInstructions: Swift.String? + /// The base role that determines default permissions. + /// - `no_access`: No default access + /// - `reader`: Default read permissions + /// - `writer`: Default write permissions (organization spaces only) + /// - `admin`: Default admin permissions (organization spaces only) + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/base_role`. + @frozen public enum BaseRolePayload: String, Codable, Hashable, Sendable, CaseIterable { + case reader = "reader" + case writer = "writer" + case admin = "admin" + case noAccess = "no_access" + } + /// The base role that determines default permissions. + /// - `no_access`: No default access + /// - `reader`: Default read permissions + /// - `writer`: Default write permissions (organization spaces only) + /// - `admin`: Default admin permissions (organization spaces only) + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/base_role`. + public var baseRole: Components.Schemas.CopilotSpace.BaseRolePayload + /// The user or organization that owns this space. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/owner`. + public struct OwnerPayload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/copilot-space/owner/value1`. + public var value1: Components.Schemas.SimpleUser? + /// - Remark: Generated from `#/components/schemas/copilot-space/owner/value2`. + public var value2: Components.Schemas.OrganizationSimple? + /// Creates a new `OwnerPayload`. + /// + /// - Parameters: + /// - value1: + /// - value2: + public init( + value1: Components.Schemas.SimpleUser? = nil, + value2: Components.Schemas.OrganizationSimple? = nil + ) { + self.value1 = value1 + self.value2 = value2 + } + public init(from decoder: any Swift.Decoder) throws { + var errors: [any Swift.Error] = [] + do { + self.value1 = try .init(from: decoder) + } catch { + errors.append(error) + } + do { + self.value2 = try .init(from: decoder) + } catch { + errors.append(error) + } + try Swift.DecodingError.verifyAtLeastOneSchemaIsNotNil( + [ + self.value1, + self.value2 + ], + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + public func encode(to encoder: any Swift.Encoder) throws { + try self.value1?.encode(to: encoder) + try self.value2?.encode(to: encoder) + } + } + /// The user or organization that owns this space. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/owner`. + public var owner: Components.Schemas.CopilotSpace.OwnerPayload + /// - Remark: Generated from `#/components/schemas/copilot-space/creator`. + public var creator: Components.Schemas.SimpleUser + /// The date and time the space was created. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/created_at`. + public var createdAt: Foundation.Date + /// The date and time the space was last updated. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/updated_at`. + public var updatedAt: Foundation.Date + /// The HTML URL of the space. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/html_url`. + public var htmlUrl: Swift.String + /// The API URL of the space. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/api_url`. + public var apiUrl: Swift.String + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload`. + public struct ResourcesAttributesPayloadPayload: Codable, Hashable, Sendable { + /// The unique identifier of the resource. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/id`. + public var id: Swift.Int64? + /// The type of resource. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/resource_type`. + @frozen public enum ResourceTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case repository = "repository" + case githubFile = "github_file" + case freeText = "free_text" + case githubIssue = "github_issue" + case githubPullRequest = "github_pull_request" + case mediaContent = "media_content" + case uploadedTextFile = "uploaded_text_file" + } + /// The type of resource. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/resource_type`. + public var resourceType: Components.Schemas.CopilotSpace.ResourcesAttributesPayloadPayload.ResourceTypePayload? + /// The unique identifier of the chat attachment for uploaded files or media content. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/copilot_chat_attachment_id`. + public var copilotChatAttachmentId: Swift.Int64? + /// The date and time the resource was created. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/created_at`. + public var createdAt: Foundation.Date? + /// The date and time the resource was last updated. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/updated_at`. + public var updatedAt: Foundation.Date? + /// Metadata specific to the resource type. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata`. + public struct MetadataPayload: Codable, Hashable, Sendable { + /// Repository ID for repository or file resources. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata/repository_id`. + public var repositoryId: Swift.Int? + /// File path for file resources. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata/file_path`. + public var filePath: Swift.String? + /// Text content for free text resources. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata/text`. + public var text: Swift.String? + /// Name for the resource. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata/name`. + public var name: Swift.String? + /// Issue or PR number. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata/number`. + public var number: Swift.Int? + /// Chat attachment ID for uploaded files or media. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata/copilot_chat_attachment_id`. + public var copilotChatAttachmentId: Swift.Int? + /// Media type for media content resources. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata/media_type`. + public var mediaType: Swift.String? + /// URL for media content resources. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata/url`. + public var url: Swift.String? + /// Height for media content resources. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata/height`. + public var height: Swift.Int? + /// Width for media content resources. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata/width`. + public var width: Swift.Int? + /// Creates a new `MetadataPayload`. + /// + /// - Parameters: + /// - repositoryId: Repository ID for repository or file resources. + /// - filePath: File path for file resources. + /// - text: Text content for free text resources. + /// - name: Name for the resource. + /// - number: Issue or PR number. + /// - copilotChatAttachmentId: Chat attachment ID for uploaded files or media. + /// - mediaType: Media type for media content resources. + /// - url: URL for media content resources. + /// - height: Height for media content resources. + /// - width: Width for media content resources. + public init( + repositoryId: Swift.Int? = nil, + filePath: Swift.String? = nil, + text: Swift.String? = nil, + name: Swift.String? = nil, + number: Swift.Int? = nil, + copilotChatAttachmentId: Swift.Int? = nil, + mediaType: Swift.String? = nil, + url: Swift.String? = nil, + height: Swift.Int? = nil, + width: Swift.Int? = nil + ) { + self.repositoryId = repositoryId + self.filePath = filePath + self.text = text + self.name = name + self.number = number + self.copilotChatAttachmentId = copilotChatAttachmentId + self.mediaType = mediaType + self.url = url + self.height = height + self.width = width + } + public enum CodingKeys: String, CodingKey { + case repositoryId = "repository_id" + case filePath = "file_path" + case text + case name + case number + case copilotChatAttachmentId = "copilot_chat_attachment_id" + case mediaType = "media_type" + case url + case height + case width + } + } + /// Metadata specific to the resource type. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/ResourcesAttributesPayload/metadata`. + public var metadata: Components.Schemas.CopilotSpace.ResourcesAttributesPayloadPayload.MetadataPayload? + /// Creates a new `ResourcesAttributesPayloadPayload`. + /// + /// - Parameters: + /// - id: The unique identifier of the resource. + /// - resourceType: The type of resource. + /// - copilotChatAttachmentId: The unique identifier of the chat attachment for uploaded files or media content. + /// - createdAt: The date and time the resource was created. + /// - updatedAt: The date and time the resource was last updated. + /// - metadata: Metadata specific to the resource type. + public init( + id: Swift.Int64? = nil, + resourceType: Components.Schemas.CopilotSpace.ResourcesAttributesPayloadPayload.ResourceTypePayload? = nil, + copilotChatAttachmentId: Swift.Int64? = nil, + createdAt: Foundation.Date? = nil, + updatedAt: Foundation.Date? = nil, + metadata: Components.Schemas.CopilotSpace.ResourcesAttributesPayloadPayload.MetadataPayload? = nil + ) { + self.id = id + self.resourceType = resourceType + self.copilotChatAttachmentId = copilotChatAttachmentId + self.createdAt = createdAt + self.updatedAt = updatedAt + self.metadata = metadata + } + public enum CodingKeys: String, CodingKey { + case id + case resourceType = "resource_type" + case copilotChatAttachmentId = "copilot_chat_attachment_id" + case createdAt = "created_at" + case updatedAt = "updated_at" + case metadata + } + } + /// Resources attached to the space. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/resources_attributes`. + public typealias ResourcesAttributesPayload = [Components.Schemas.CopilotSpace.ResourcesAttributesPayloadPayload] + /// Resources attached to the space. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space/resources_attributes`. + public var resourcesAttributes: Components.Schemas.CopilotSpace.ResourcesAttributesPayload? + /// Creates a new `CopilotSpace`. + /// + /// - Parameters: + /// - id: The unique identifier of the space. + /// - number: The number that identifies the space within its owner. + /// - name: The display name of the space. + /// - description: A description of the space. + /// - generalInstructions: General instructions for the Copilot Space. + /// - baseRole: The base role that determines default permissions. + /// - owner: The user or organization that owns this space. + /// - creator: + /// - createdAt: The date and time the space was created. + /// - updatedAt: The date and time the space was last updated. + /// - htmlUrl: The HTML URL of the space. + /// - apiUrl: The API URL of the space. + /// - resourcesAttributes: Resources attached to the space. + public init( + id: Swift.Int64, + number: Swift.Int, + name: Swift.String, + description: Swift.String? = nil, + generalInstructions: Swift.String? = nil, + baseRole: Components.Schemas.CopilotSpace.BaseRolePayload, + owner: Components.Schemas.CopilotSpace.OwnerPayload, + creator: Components.Schemas.SimpleUser, + createdAt: Foundation.Date, + updatedAt: Foundation.Date, + htmlUrl: Swift.String, + apiUrl: Swift.String, + resourcesAttributes: Components.Schemas.CopilotSpace.ResourcesAttributesPayload? = nil + ) { + self.id = id + self.number = number + self.name = name + self.description = description + self.generalInstructions = generalInstructions + self.baseRole = baseRole + self.owner = owner + self.creator = creator + self.createdAt = createdAt + self.updatedAt = updatedAt + self.htmlUrl = htmlUrl + self.apiUrl = apiUrl + self.resourcesAttributes = resourcesAttributes + } + public enum CodingKeys: String, CodingKey { + case id + case number + case name + case description + case generalInstructions = "general_instructions" + case baseRole = "base_role" + case owner + case creator + case createdAt = "created_at" + case updatedAt = "updated_at" + case htmlUrl = "html_url" + case apiUrl = "api_url" + case resourcesAttributes = "resources_attributes" + } + public init(from decoder: any Swift.Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.id = try container.decode( + Swift.Int64.self, + forKey: .id + ) + self.number = try container.decode( + Swift.Int.self, + forKey: .number + ) + self.name = try container.decode( + Swift.String.self, + forKey: .name + ) + self.description = try container.decodeIfPresent( + Swift.String.self, + forKey: .description + ) + self.generalInstructions = try container.decodeIfPresent( + Swift.String.self, + forKey: .generalInstructions + ) + self.baseRole = try container.decode( + Components.Schemas.CopilotSpace.BaseRolePayload.self, + forKey: .baseRole + ) + self.owner = try container.decode( + Components.Schemas.CopilotSpace.OwnerPayload.self, + forKey: .owner + ) + self.creator = try container.decode( + Components.Schemas.SimpleUser.self, + forKey: .creator + ) + self.createdAt = try container.decode( + Foundation.Date.self, + forKey: .createdAt + ) + self.updatedAt = try container.decode( + Foundation.Date.self, + forKey: .updatedAt + ) + self.htmlUrl = try container.decode( + Swift.String.self, + forKey: .htmlUrl + ) + self.apiUrl = try container.decode( + Swift.String.self, + forKey: .apiUrl + ) + self.resourcesAttributes = try container.decodeIfPresent( + Components.Schemas.CopilotSpace.ResourcesAttributesPayload.self, + forKey: .resourcesAttributes + ) + try decoder.ensureNoAdditionalProperties(knownKeys: [ + "id", + "number", + "name", + "description", + "general_instructions", + "base_role", + "owner", + "creator", + "created_at", + "updated_at", + "html_url", + "api_url", + "resources_attributes" + ]) + } + } + /// A collaborator (user or team) of a Copilot Space + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator`. + public struct CopilotSpaceCollaborator: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value1`. + public struct Value1Payload: Codable, Hashable, Sendable { + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value1/value1`. + public var value1: Components.Schemas.SimpleUser + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value1/value2`. + public struct Value2Payload: Codable, Hashable, Sendable { + /// The collaborator actor type. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value1/value2/actor_type`. + @frozen public enum ActorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case user = "User" + } + /// The collaborator actor type. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value1/value2/actor_type`. + public var actorType: Components.Schemas.CopilotSpaceCollaborator.Value1Payload.Value2Payload.ActorTypePayload + /// The role granted to the collaborator + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value1/value2/role`. + @frozen public enum RolePayload: String, Codable, Hashable, Sendable, CaseIterable { + case reader = "reader" + case writer = "writer" + case admin = "admin" + } + /// The role granted to the collaborator + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value1/value2/role`. + public var role: Components.Schemas.CopilotSpaceCollaborator.Value1Payload.Value2Payload.RolePayload + /// Creates a new `Value2Payload`. + /// + /// - Parameters: + /// - actorType: The collaborator actor type. + /// - role: The role granted to the collaborator + public init( + actorType: Components.Schemas.CopilotSpaceCollaborator.Value1Payload.Value2Payload.ActorTypePayload, + role: Components.Schemas.CopilotSpaceCollaborator.Value1Payload.Value2Payload.RolePayload + ) { + self.actorType = actorType + self.role = role + } + public enum CodingKeys: String, CodingKey { + case actorType = "actor_type" + case role + } + } + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value1/value2`. + public var value2: Components.Schemas.CopilotSpaceCollaborator.Value1Payload.Value2Payload + /// Creates a new `Value1Payload`. + /// + /// - Parameters: + /// - value1: + /// - value2: + public init( + value1: Components.Schemas.SimpleUser, + value2: Components.Schemas.CopilotSpaceCollaborator.Value1Payload.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 `#/components/schemas/copilot-space-collaborator/value1`. + public var value1: Components.Schemas.CopilotSpaceCollaborator.Value1Payload? + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2`. + public struct Value2Payload: Codable, Hashable, Sendable { + /// The collaborator actor type. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/actor_type`. + @frozen public enum ActorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case team = "Team" + } + /// The collaborator actor type. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/actor_type`. + public var actorType: Components.Schemas.CopilotSpaceCollaborator.Value2Payload.ActorTypePayload + /// The role granted to the collaborator + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/role`. + @frozen public enum RolePayload: String, Codable, Hashable, Sendable, CaseIterable { + case reader = "reader" + case writer = "writer" + case admin = "admin" + } + /// The role granted to the collaborator + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/role`. + public var role: Components.Schemas.CopilotSpaceCollaborator.Value2Payload.RolePayload + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/id`. + public var id: Swift.Int + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/node_id`. + public var nodeId: Swift.String + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/name`. + public var name: Swift.String + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/slug`. + public var slug: Swift.String + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/type`. + @frozen public enum _TypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case team = "Team" + } + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/type`. + public var _type: Components.Schemas.CopilotSpaceCollaborator.Value2Payload._TypePayload + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/description`. + public var description: Swift.String? + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/privacy`. + public var privacy: Swift.String? + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/notification_setting`. + public var notificationSetting: Swift.String? + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/url`. + public var url: Swift.String? + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/html_url`. + public var htmlUrl: Swift.String? + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/members_url`. + public var membersUrl: Swift.String? + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/repositories_url`. + public var repositoriesUrl: Swift.String? + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/organization_id`. + public var organizationId: Swift.Int? + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2/parent`. + public var parent: OpenAPIRuntime.OpenAPIValueContainer? + /// Creates a new `Value2Payload`. + /// + /// - Parameters: + /// - actorType: The collaborator actor type. + /// - role: The role granted to the collaborator + /// - id: + /// - nodeId: + /// - name: + /// - slug: + /// - _type: + /// - description: + /// - privacy: + /// - notificationSetting: + /// - url: + /// - htmlUrl: + /// - membersUrl: + /// - repositoriesUrl: + /// - organizationId: + /// - parent: + public init( + actorType: Components.Schemas.CopilotSpaceCollaborator.Value2Payload.ActorTypePayload, + role: Components.Schemas.CopilotSpaceCollaborator.Value2Payload.RolePayload, + id: Swift.Int, + nodeId: Swift.String, + name: Swift.String, + slug: Swift.String, + _type: Components.Schemas.CopilotSpaceCollaborator.Value2Payload._TypePayload, + description: Swift.String? = nil, + privacy: Swift.String? = nil, + notificationSetting: Swift.String? = nil, + url: Swift.String? = nil, + htmlUrl: Swift.String? = nil, + membersUrl: Swift.String? = nil, + repositoriesUrl: Swift.String? = nil, + organizationId: Swift.Int? = nil, + parent: OpenAPIRuntime.OpenAPIValueContainer? = nil + ) { + self.actorType = actorType + self.role = role + self.id = id + self.nodeId = nodeId + self.name = name + self.slug = slug + self._type = _type + self.description = description + self.privacy = privacy + self.notificationSetting = notificationSetting + self.url = url + self.htmlUrl = htmlUrl + self.membersUrl = membersUrl + self.repositoriesUrl = repositoriesUrl + self.organizationId = organizationId + self.parent = parent + } + public enum CodingKeys: String, CodingKey { + case actorType = "actor_type" + case role + case id + case nodeId = "node_id" + case name + case slug + case _type = "type" + case description + case privacy + case notificationSetting = "notification_setting" + case url + case htmlUrl = "html_url" + case membersUrl = "members_url" + case repositoriesUrl = "repositories_url" + case organizationId = "organization_id" + case parent + } + } + /// - Remark: Generated from `#/components/schemas/copilot-space-collaborator/value2`. + public var value2: Components.Schemas.CopilotSpaceCollaborator.Value2Payload? + /// Creates a new `CopilotSpaceCollaborator`. + /// + /// - Parameters: + /// - value1: + /// - value2: + public init( + value1: Components.Schemas.CopilotSpaceCollaborator.Value1Payload? = nil, + value2: Components.Schemas.CopilotSpaceCollaborator.Value2Payload? = nil + ) { + self.value1 = value1 + self.value2 = value2 + } + public init(from decoder: any Swift.Decoder) throws { + var errors: [any Swift.Error] = [] + do { + self.value1 = try .init(from: decoder) + } catch { + errors.append(error) + } + do { + self.value2 = try .init(from: decoder) + } catch { + errors.append(error) + } + try Swift.DecodingError.verifyAtLeastOneSchemaIsNotNil( + [ + self.value1, + self.value2 + ], + type: Self.self, + codingPath: decoder.codingPath, + errors: errors + ) + } + public func encode(to encoder: any Swift.Encoder) throws { + try self.value1?.encode(to: encoder) + try self.value2?.encode(to: encoder) + } + } + /// A resource attached to a Copilot Space. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-resource`. + public struct CopilotSpaceResource: Codable, Hashable, Sendable { + /// The unique identifier of the resource. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-resource/id`. + public var id: Swift.Int + /// The type of the resource. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-resource/resource_type`. + @frozen public enum ResourceTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case repository = "repository" + case githubFile = "github_file" + case freeText = "free_text" + case githubIssue = "github_issue" + case githubPullRequest = "github_pull_request" + case mediaContent = "media_content" + case uploadedTextFile = "uploaded_text_file" + } + /// The type of the resource. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-resource/resource_type`. + public var resourceType: Components.Schemas.CopilotSpaceResource.ResourceTypePayload + /// The ID of the associated chat attachment, if any. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-resource/copilot_chat_attachment_id`. + public var copilotChatAttachmentId: Swift.Int? + /// Resource-specific metadata. The keys and values depend on the resource type. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-resource/metadata`. + public struct MetadataPayload: Codable, Hashable, Sendable { + /// A container of undocumented properties. + public var additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer + /// Creates a new `MetadataPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + public init(additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer = .init()) { + self.additionalProperties = additionalProperties + } + public init(from decoder: any Swift.Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + public func encode(to encoder: any Swift.Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + /// Resource-specific metadata. The keys and values depend on the resource type. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-resource/metadata`. + public var metadata: Components.Schemas.CopilotSpaceResource.MetadataPayload + /// The date and time the resource was created. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-resource/created_at`. + public var createdAt: Foundation.Date + /// The date and time the resource was last updated. + /// + /// - Remark: Generated from `#/components/schemas/copilot-space-resource/updated_at`. + public var updatedAt: Foundation.Date + /// Creates a new `CopilotSpaceResource`. + /// + /// - Parameters: + /// - id: The unique identifier of the resource. + /// - resourceType: The type of the resource. + /// - copilotChatAttachmentId: The ID of the associated chat attachment, if any. + /// - metadata: Resource-specific metadata. The keys and values depend on the resource type. + /// - createdAt: The date and time the resource was created. + /// - updatedAt: The date and time the resource was last updated. + public init( + id: Swift.Int, + resourceType: Components.Schemas.CopilotSpaceResource.ResourceTypePayload, + copilotChatAttachmentId: Swift.Int? = nil, + metadata: Components.Schemas.CopilotSpaceResource.MetadataPayload, + createdAt: Foundation.Date, + updatedAt: Foundation.Date + ) { + self.id = id + self.resourceType = resourceType + self.copilotChatAttachmentId = copilotChatAttachmentId + self.metadata = metadata + self.createdAt = createdAt + self.updatedAt = updatedAt + } + public enum CodingKeys: String, CodingKey { + case id + case resourceType = "resource_type" + case copilotChatAttachmentId = "copilot_chat_attachment_id" + case metadata + case createdAt = "created_at" + case updatedAt = "updated_at" + } + } + } + /// Types generated from the `#/components/parameters` section of the OpenAPI document. + public enum Parameters { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/components/parameters/username`. + public typealias Username = Swift.String + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/components/parameters/org`. + public typealias Org = Swift.String + } + /// Types generated from the `#/components/requestBodies` section of the OpenAPI document. + public enum RequestBodies {} + /// Types generated from the `#/components/responses` section of the OpenAPI document. + public enum Responses { + public struct NotFound: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/not_found/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/not_found/content/application\/json`. + case json(Components.Schemas.BasicError) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.BasicError { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Components.Responses.NotFound.Body + /// Creates a new `NotFound`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Components.Responses.NotFound.Body) { + self.body = body + } + } + public struct ValidationFailed: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/validation_failed/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/validation_failed/content/application\/json`. + case json(Components.Schemas.ValidationError) + /// 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.ValidationError { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Components.Responses.ValidationFailed.Body + /// Creates a new `ValidationFailed`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Components.Responses.ValidationFailed.Body) { + self.body = body + } + } + public struct Forbidden: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/forbidden/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/components/responses/forbidden/content/application\/json`. + case json(Components.Schemas.BasicError) + /// The associated value of the enum case if `self` is `.json`. + /// + /// - Throws: An error if `self` is not `.json`. + /// - SeeAlso: `.json`. + public var json: Components.Schemas.BasicError { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Components.Responses.Forbidden.Body + /// Creates a new `Forbidden`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Components.Responses.Forbidden.Body) { + self.body = body + } + } + } + /// Types generated from the `#/components/headers` section of the OpenAPI document. + public enum Headers { + /// - Remark: Generated from `#/components/headers/link`. + public typealias Link = Swift.String + } +} + +/// API operations, with input and output types, generated from `#/paths` in the OpenAPI document. +public enum Operations { + /// List organization Copilot Spaces + /// + /// Lists Copilot Spaces owned by an organization. The authenticated user must have read access to the organization's Copilot Spaces. + /// + /// Only Spaces that are readable by the authenticated user are returned. This includes public Spaces and internal Spaces if the user is a member of the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/get(copilot-spaces/list-for-org)`. + public enum CopilotSpacesListForOrg { + public static let id: Swift.String = "copilot-spaces/list-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/GET/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/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.CopilotSpacesListForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/GET/query`. + public struct Query: Sendable, Hashable { + /// The number of results per page (max 100). + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/GET/query/per_page`. + public var perPage: Swift.Int? + /// 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. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/GET/query/before`. + public var before: Swift.String? + /// 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. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/GET/query/after`. + public var after: Swift.String? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - perPage: The number of results per page (max 100). + /// - 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. + /// - 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. + public init( + perPage: Swift.Int? = nil, + before: Swift.String? = nil, + after: Swift.String? = nil + ) { + self.perPage = perPage + self.before = before + self.after = after + } + } + public var query: Operations.CopilotSpacesListForOrg.Input.Query + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/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.CopilotSpacesListForOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + public init( + path: Operations.CopilotSpacesListForOrg.Input.Path, + query: Operations.CopilotSpacesListForOrg.Input.Query = .init(), + headers: Operations.CopilotSpacesListForOrg.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}/copilot-spaces/GET/responses/200/headers`. + public struct Headers: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/GET/responses/200/headers/Link`. + public var link: Components.Headers.Link? + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - link: + public init(link: Components.Headers.Link? = nil) { + self.link = link + } + } + /// Received HTTP response headers + public var headers: Operations.CopilotSpacesListForOrg.Output.Ok.Headers + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/GET/responses/200/content/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The list of Copilot Spaces on this page of results. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/GET/responses/200/content/json/spaces`. + public var spaces: [Components.Schemas.CopilotSpace] + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - spaces: The list of Copilot Spaces on this page of results. + public init(spaces: [Components.Schemas.CopilotSpace]) { + self.spaces = spaces + } + public enum CodingKeys: String, CodingKey { + case spaces + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/GET/responses/200/content/application\/json`. + case json(Operations.CopilotSpacesListForOrg.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.CopilotSpacesListForOrg.Output.Ok.Body.JsonPayload { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesListForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - headers: Received HTTP response headers + /// - body: Received HTTP response body + public init( + headers: Operations.CopilotSpacesListForOrg.Output.Ok.Headers = .init(), + body: Operations.CopilotSpacesListForOrg.Output.Ok.Body + ) { + self.headers = headers + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/get(copilot-spaces/list-for-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesListForOrg.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.CopilotSpacesListForOrg.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/get(copilot-spaces/list-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/get(copilot-spaces/list-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 .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 + ] + } + } + } + /// Create an organization Copilot Space + /// + /// Creates a new Copilot Space owned by an organization. The authenticated user must have permissions to create spaces in the organization. + /// + /// Organization members with appropriate permissions can create Copilot Spaces to be shared within their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/post(copilot-spaces/create-for-org)`. + public enum CopilotSpacesCreateForOrg { + public static let id: Swift.String = "copilot-spaces/create-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/path/org`. + public var org: Components.Parameters.Org + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + public init(org: Components.Parameters.Org) { + self.org = org + } + } + public var path: Operations.CopilotSpacesCreateForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/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.CopilotSpacesCreateForOrg.Input.Headers + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The name of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/name`. + public var name: Swift.String + /// A description of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/description`. + public var description: Swift.String? + /// General instructions for the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/general_instructions`. + public var generalInstructions: Swift.String? + /// The base role that determines default permissions for organization members. + /// - `no_access`: No default access (default) + /// - `reader`: Organization members can read the space + /// - `writer`: Organization members can read and edit the space + /// - `admin`: Organization members have full admin access to the space + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/base_role`. + @frozen public enum BaseRolePayload: String, Codable, Hashable, Sendable, CaseIterable { + case reader = "reader" + case writer = "writer" + case admin = "admin" + case noAccess = "no_access" + } + /// The base role that determines default permissions for organization members. + /// - `no_access`: No default access (default) + /// - `reader`: Organization members can read the space + /// - `writer`: Organization members can read and edit the space + /// - `admin`: Organization members have full admin access to the space + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/base_role`. + public var baseRole: Operations.CopilotSpacesCreateForOrg.Input.Body.JsonPayload.BaseRolePayload? + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload`. + public struct ResourcesAttributesPayloadPayload: Codable, Hashable, Sendable { + /// The type of resource. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/resource_type`. + @frozen public enum ResourceTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case repository = "repository" + case githubFile = "github_file" + case freeText = "free_text" + case githubIssue = "github_issue" + case githubPullRequest = "github_pull_request" + case mediaContent = "media_content" + case uploadedTextFile = "uploaded_text_file" + } + /// The type of resource. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/resource_type`. + public var resourceType: Operations.CopilotSpacesCreateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.ResourceTypePayload? + /// Metadata specific to the resource type. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata`. + public struct MetadataPayload: Codable, Hashable, Sendable { + /// Repository ID for repository or file resources. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata/repository_id`. + public var repositoryId: Swift.Int? + /// File path for file resources. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata/file_path`. + public var filePath: Swift.String? + /// Text content for free text resources. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata/text`. + public var text: Swift.String? + /// Name for the resource. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata/name`. + public var name: Swift.String? + /// Issue or PR number. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata/number`. + public var number: Swift.Int? + /// Creates a new `MetadataPayload`. + /// + /// - Parameters: + /// - repositoryId: Repository ID for repository or file resources. + /// - filePath: File path for file resources. + /// - text: Text content for free text resources. + /// - name: Name for the resource. + /// - number: Issue or PR number. + public init( + repositoryId: Swift.Int? = nil, + filePath: Swift.String? = nil, + text: Swift.String? = nil, + name: Swift.String? = nil, + number: Swift.Int? = nil + ) { + self.repositoryId = repositoryId + self.filePath = filePath + self.text = text + self.name = name + self.number = number + } + public enum CodingKeys: String, CodingKey { + case repositoryId = "repository_id" + case filePath = "file_path" + case text + case name + case number + } + } + /// Metadata specific to the resource type. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata`. + public var metadata: Operations.CopilotSpacesCreateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.MetadataPayload? + /// Creates a new `ResourcesAttributesPayloadPayload`. + /// + /// - Parameters: + /// - resourceType: The type of resource. + /// - metadata: Metadata specific to the resource type. + public init( + resourceType: Operations.CopilotSpacesCreateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.ResourceTypePayload? = nil, + metadata: Operations.CopilotSpacesCreateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.MetadataPayload? = nil + ) { + self.resourceType = resourceType + self.metadata = metadata + } + public enum CodingKeys: String, CodingKey { + case resourceType = "resource_type" + case metadata + } + } + /// Resources to attach to the space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/resources_attributes`. + public typealias ResourcesAttributesPayload = [Operations.CopilotSpacesCreateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload] + /// Resources to attach to the space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/json/resources_attributes`. + public var resourcesAttributes: Operations.CopilotSpacesCreateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayload? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - name: The name of the Copilot Space. + /// - description: A description of the Copilot Space. + /// - generalInstructions: General instructions for the Copilot Space. + /// - baseRole: The base role that determines default permissions for organization members. + /// - resourcesAttributes: Resources to attach to the space. + public init( + name: Swift.String, + description: Swift.String? = nil, + generalInstructions: Swift.String? = nil, + baseRole: Operations.CopilotSpacesCreateForOrg.Input.Body.JsonPayload.BaseRolePayload? = nil, + resourcesAttributes: Operations.CopilotSpacesCreateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayload? = nil + ) { + self.name = name + self.description = description + self.generalInstructions = generalInstructions + self.baseRole = baseRole + self.resourcesAttributes = resourcesAttributes + } + public enum CodingKeys: String, CodingKey { + case name + case description + case generalInstructions = "general_instructions" + case baseRole = "base_role" + case resourcesAttributes = "resources_attributes" + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesCreateForOrg.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesCreateForOrg.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesCreateForOrg.Input.Path, + headers: Operations.CopilotSpacesCreateForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesCreateForOrg.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/orgs/{org}/copilot-spaces/POST/responses/201/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/POST/responses/201/content/application\/json`. + case json(Components.Schemas.CopilotSpace) + /// 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.CopilotSpace { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesCreateForOrg.Output.Created.Body + /// Creates a new `Created`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesCreateForOrg.Output.Created.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/post(copilot-spaces/create-for-org)/responses/201`. + /// + /// HTTP response code: `201 created`. + case created(Operations.CopilotSpacesCreateForOrg.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.CopilotSpacesCreateForOrg.Output.Created { + get throws { + switch self { + case let .created(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "created", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/post(copilot-spaces/create-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/post(copilot-spaces/create-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 .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/post(copilot-spaces/create-for-org)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 an organization Copilot Space + /// + /// Gets details about a specific Copilot Space owned by an organization. The authenticated user must have read access to the Space. + /// + /// Internal Spaces require the authenticated user to be a member of the organization or have been granted read permissions. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-org)`. + public enum CopilotSpacesGetForOrg { + public static let id: Swift.String = "copilot-spaces/get-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/GET/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/GET/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/GET/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int + ) { + self.org = org + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesGetForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/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.CopilotSpacesGetForOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesGetForOrg.Input.Path, + headers: Operations.CopilotSpacesGetForOrg.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/GET/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpace) + /// 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.CopilotSpace { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesGetForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesGetForOrg.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesGetForOrg.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.CopilotSpacesGetForOrg.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/get(copilot-spaces/get-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 .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 + ] + } + } + } + /// Set an organization Copilot Space + /// + /// Updates a Copilot Space owned by an organization. The authenticated user must have permissions to update spaces in the organization. + /// + /// Organization members with appropriate permissions can update Copilot Spaces owned by their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-org)`. + public enum CopilotSpacesUpdateForOrg { + public static let id: Swift.String = "copilot-spaces/update-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int + ) { + self.org = org + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesUpdateForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/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.CopilotSpacesUpdateForOrg.Input.Headers + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The name of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/name`. + public var name: Swift.String? + /// A description of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/description`. + public var description: Swift.String? + /// General instructions for the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/general_instructions`. + public var generalInstructions: Swift.String? + /// The base role that determines default permissions for organization members. Changing this field requires admin permissions. + /// - `no_access`: No default access (default) + /// - `reader`: Organization members can read the space + /// - `writer`: Organization members can read and edit the space + /// - `admin`: Organization members have full admin access to the space + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/base_role`. + @frozen public enum BaseRolePayload: String, Codable, Hashable, Sendable, CaseIterable { + case reader = "reader" + case writer = "writer" + case admin = "admin" + case noAccess = "no_access" + } + /// The base role that determines default permissions for organization members. Changing this field requires admin permissions. + /// - `no_access`: No default access (default) + /// - `reader`: Organization members can read the space + /// - `writer`: Organization members can read and edit the space + /// - `admin`: Organization members have full admin access to the space + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/base_role`. + public var baseRole: Operations.CopilotSpacesUpdateForOrg.Input.Body.JsonPayload.BaseRolePayload? + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload`. + public struct ResourcesAttributesPayloadPayload: Codable, Hashable, Sendable { + /// The type of resource. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/resource_type`. + @frozen public enum ResourceTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case repository = "repository" + case githubFile = "github_file" + case freeText = "free_text" + case githubIssue = "github_issue" + case githubPullRequest = "github_pull_request" + case mediaContent = "media_content" + case uploadedTextFile = "uploaded_text_file" + } + /// The type of resource. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/resource_type`. + public var resourceType: Operations.CopilotSpacesUpdateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.ResourceTypePayload? + /// Metadata specific to the resource type. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata`. + public struct MetadataPayload: Codable, Hashable, Sendable { + /// Repository ID for repository or file resources. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata/repository_id`. + public var repositoryId: Swift.Int? + /// File path for file resources. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata/file_path`. + public var filePath: Swift.String? + /// Text content for free text resources. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata/text`. + public var text: Swift.String? + /// Name for the resource. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata/name`. + public var name: Swift.String? + /// Issue or PR number. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata/number`. + public var number: Swift.Int? + /// Creates a new `MetadataPayload`. + /// + /// - Parameters: + /// - repositoryId: Repository ID for repository or file resources. + /// - filePath: File path for file resources. + /// - text: Text content for free text resources. + /// - name: Name for the resource. + /// - number: Issue or PR number. + public init( + repositoryId: Swift.Int? = nil, + filePath: Swift.String? = nil, + text: Swift.String? = nil, + name: Swift.String? = nil, + number: Swift.Int? = nil + ) { + self.repositoryId = repositoryId + self.filePath = filePath + self.text = text + self.name = name + self.number = number + } + public enum CodingKeys: String, CodingKey { + case repositoryId = "repository_id" + case filePath = "file_path" + case text + case name + case number + } + } + /// Metadata specific to the resource type. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata`. + public var metadata: Operations.CopilotSpacesUpdateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.MetadataPayload? + /// Creates a new `ResourcesAttributesPayloadPayload`. + /// + /// - Parameters: + /// - resourceType: The type of resource. + /// - metadata: Metadata specific to the resource type. + public init( + resourceType: Operations.CopilotSpacesUpdateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.ResourceTypePayload? = nil, + metadata: Operations.CopilotSpacesUpdateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.MetadataPayload? = nil + ) { + self.resourceType = resourceType + self.metadata = metadata + } + public enum CodingKeys: String, CodingKey { + case resourceType = "resource_type" + case metadata + } + } + /// Resources to attach to the space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/resources_attributes`. + public typealias ResourcesAttributesPayload = [Operations.CopilotSpacesUpdateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload] + /// Resources to attach to the space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/json/resources_attributes`. + public var resourcesAttributes: Operations.CopilotSpacesUpdateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayload? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - name: The name of the Copilot Space. + /// - description: A description of the Copilot Space. + /// - generalInstructions: General instructions for the Copilot Space. + /// - baseRole: The base role that determines default permissions for organization members. Changing this field requires admin permissions. + /// - resourcesAttributes: Resources to attach to the space. + public init( + name: Swift.String? = nil, + description: Swift.String? = nil, + generalInstructions: Swift.String? = nil, + baseRole: Operations.CopilotSpacesUpdateForOrg.Input.Body.JsonPayload.BaseRolePayload? = nil, + resourcesAttributes: Operations.CopilotSpacesUpdateForOrg.Input.Body.JsonPayload.ResourcesAttributesPayload? = nil + ) { + self.name = name + self.description = description + self.generalInstructions = generalInstructions + self.baseRole = baseRole + self.resourcesAttributes = resourcesAttributes + } + public enum CodingKeys: String, CodingKey { + case name + case description + case generalInstructions = "general_instructions" + case baseRole = "base_role" + case resourcesAttributes = "resources_attributes" + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesUpdateForOrg.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesUpdateForOrg.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesUpdateForOrg.Input.Path, + headers: Operations.CopilotSpacesUpdateForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateForOrg.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/PUT/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpace) + /// 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.CopilotSpace { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesUpdateForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesUpdateForOrg.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesUpdateForOrg.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.CopilotSpacesUpdateForOrg.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/put(copilot-spaces/update-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 .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-org)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 + ] + } + } + } + /// Delete an organization Copilot Space + /// + /// Deletes a Copilot Space owned by an organization. The authenticated user must have permissions to delete spaces in the organization. + /// + /// **Warning:** This action is permanent and cannot be undone. Deleting a Copilot Space will remove all associated resources and configurations. + /// + /// Organization members with appropriate permissions can delete Copilot Spaces owned by their organization. + /// + /// OAuth app tokens and personal access tokens (classic) need both the `read:org` and `repo` scopes to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-org)`. + public enum CopilotSpacesDeleteForOrg { + public static let id: Swift.String = "copilot-spaces/delete-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/DELETE/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/DELETE/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/DELETE/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int + ) { + self.org = org + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesDeleteForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/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.CopilotSpacesDeleteForOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesDeleteForOrg.Input.Path, + headers: Operations.CopilotSpacesDeleteForOrg.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct NoContent: Sendable, Hashable { + /// Creates a new `NoContent`. + public init() {} + } + /// The Copilot Space has been successfully deleted. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-org)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Operations.CopilotSpacesDeleteForOrg.Output.NoContent) + /// The Copilot Space has been successfully deleted. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-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.CopilotSpacesDeleteForOrg.Output.NoContent { + get throws { + switch self { + case let .noContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "noContent", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-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 .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-org)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 collaborators for an organization Copilot Space + /// + /// Lists all collaborators for a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to view collaborators. + /// + /// Each collaborator entry specifies which user or team has access to the space and at what level (reader, writer, or admin). The space owner (organization) is excluded from this list. + /// + /// **Note:** Team collaborators listed here are teams that are defined in the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-org)`. + public enum CopilotSpacesListCollaboratorsForOrg { + public static let id: Swift.String = "copilot-spaces/list-collaborators-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/GET/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/GET/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/GET/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int + ) { + self.org = org + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesListCollaboratorsForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/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.CopilotSpacesListCollaboratorsForOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesListCollaboratorsForOrg.Input.Path, + headers: Operations.CopilotSpacesListCollaboratorsForOrg.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/GET/responses/200/content/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The list of collaborators for this Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/GET/responses/200/content/json/collaborators`. + public var collaborators: [Components.Schemas.CopilotSpaceCollaborator] + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - collaborators: The list of collaborators for this Copilot Space. + public init(collaborators: [Components.Schemas.CopilotSpaceCollaborator]) { + self.collaborators = collaborators + } + public enum CodingKeys: String, CodingKey { + case collaborators + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/GET/responses/200/content/application\/json`. + case json(Operations.CopilotSpacesListCollaboratorsForOrg.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.CopilotSpacesListCollaboratorsForOrg.Output.Ok.Body.JsonPayload { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesListCollaboratorsForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesListCollaboratorsForOrg.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesListCollaboratorsForOrg.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.CopilotSpacesListCollaboratorsForOrg.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-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 .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 + ] + } + } + } + /// Add a collaborator to an organization Copilot Space + /// + /// Adds a collaborator (user or team) to a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// **Note:** When adding users as collaborators, they must already be members of the organization. + /// When adding teams as collaborators, they must be defined in the organization. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-org)`. + public enum CopilotSpacesAddCollaboratorForOrg { + public static let id: Swift.String = "copilot-spaces/add-collaborator-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int + ) { + self.org = org + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesAddCollaboratorForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/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.CopilotSpacesAddCollaboratorForOrg.Input.Headers + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The type of actor (user or team). + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json/actor_type`. + @frozen public enum ActorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case user = "User" + case team = "Team" + } + /// The type of actor (user or team). + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json/actor_type`. + public var actorType: Operations.CopilotSpacesAddCollaboratorForOrg.Input.Body.JsonPayload.ActorTypePayload + /// The username (for users) or team slug (for teams). The numeric ID of a user or team is also accepted. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json/actor_identifier`. + public var actorIdentifier: Swift.String + /// The role to grant to the collaborator. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json/role`. + @frozen public enum RolePayload: String, Codable, Hashable, Sendable, CaseIterable { + case reader = "reader" + case writer = "writer" + case admin = "admin" + } + /// The role to grant to the collaborator. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json/role`. + public var role: Operations.CopilotSpacesAddCollaboratorForOrg.Input.Body.JsonPayload.RolePayload + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - actorType: The type of actor (user or team). + /// - actorIdentifier: The username (for users) or team slug (for teams). The numeric ID of a user or team is also accepted. + /// - role: The role to grant to the collaborator. + public init( + actorType: Operations.CopilotSpacesAddCollaboratorForOrg.Input.Body.JsonPayload.ActorTypePayload, + actorIdentifier: Swift.String, + role: Operations.CopilotSpacesAddCollaboratorForOrg.Input.Body.JsonPayload.RolePayload + ) { + self.actorType = actorType + self.actorIdentifier = actorIdentifier + self.role = role + } + public enum CodingKeys: String, CodingKey { + case actorType = "actor_type" + case actorIdentifier = "actor_identifier" + case role + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesAddCollaboratorForOrg.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesAddCollaboratorForOrg.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesAddCollaboratorForOrg.Input.Path, + headers: Operations.CopilotSpacesAddCollaboratorForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesAddCollaboratorForOrg.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/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/responses/201/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/POST/responses/201/content/application\/json`. + case json(Components.Schemas.CopilotSpaceCollaborator) + /// 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.CopilotSpaceCollaborator { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesAddCollaboratorForOrg.Output.Created.Body + /// Creates a new `Created`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesAddCollaboratorForOrg.Output.Created.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-org)/responses/201`. + /// + /// HTTP response code: `201 created`. + case created(Operations.CopilotSpacesAddCollaboratorForOrg.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.CopilotSpacesAddCollaboratorForOrg.Output.Created { + get throws { + switch self { + case let .created(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "created", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-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 .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-org)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 + ] + } + } + } + /// Set a collaborator role for an organization Copilot Space + /// + /// Updates the role of a collaborator for a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-org)`. + public enum CopilotSpacesUpdateCollaboratorForOrg { + public static let id: Swift.String = "copilot-spaces/update-collaborator-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path/space_number`. + public var spaceNumber: Swift.Int + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path/actor_type`. + @frozen public enum ActorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case user = "User" + case team = "Team" + } + /// The type of actor (user or team). + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path/actor_type`. + public var actorType: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Path.ActorTypePayload + /// The username (for users) or team slug (for teams). The numeric ID of a user or team is also accepted. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path/actor_identifier`. + public var actorIdentifier: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + /// - actorType: The type of actor (user or team). + /// - actorIdentifier: The username (for users) or team slug (for teams). The numeric ID of a user or team is also accepted. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int, + actorType: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Path.ActorTypePayload, + actorIdentifier: Swift.String + ) { + self.org = org + self.spaceNumber = spaceNumber + self.actorType = actorType + self.actorIdentifier = actorIdentifier + } + } + public var path: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/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.CopilotSpacesUpdateCollaboratorForOrg.Input.Headers + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The new role to grant to the collaborator. Use `no_access` to remove the collaborator. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/requestBody/json/role`. + @frozen public enum RolePayload: String, Codable, Hashable, Sendable, CaseIterable { + case reader = "reader" + case writer = "writer" + case admin = "admin" + case noAccess = "no_access" + } + /// The new role to grant to the collaborator. Use `no_access` to remove the collaborator. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/requestBody/json/role`. + public var role: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Body.JsonPayload.RolePayload + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - role: The new role to grant to the collaborator. Use `no_access` to remove the collaborator. + public init(role: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Body.JsonPayload.RolePayload) { + self.role = role + } + public enum CodingKeys: String, CodingKey { + case role + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Path, + headers: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateCollaboratorForOrg.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpaceCollaborator) + /// 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.CopilotSpaceCollaborator { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesUpdateCollaboratorForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesUpdateCollaboratorForOrg.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesUpdateCollaboratorForOrg.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.CopilotSpacesUpdateCollaboratorForOrg.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + public struct NoContent: Sendable, Hashable { + /// Creates a new `NoContent`. + public init() {} + } + /// Response when `role` is `no_access` and the collaborator was removed. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-org)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Operations.CopilotSpacesUpdateCollaboratorForOrg.Output.NoContent) + /// Response when `role` is `no_access` and the collaborator was removed. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-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.CopilotSpacesUpdateCollaboratorForOrg.Output.NoContent { + get throws { + switch self { + case let .noContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "noContent", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-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 .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-org)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 + ] + } + } + } + /// Remove a collaborator from an organization Copilot Space + /// + /// Removes a collaborator from a specific Copilot Space owned by an organization. The authenticated user must have appropriate permissions to manage collaborators. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-org)`. + public enum CopilotSpacesRemoveCollaboratorForOrg { + public static let id: Swift.String = "copilot-spaces/remove-collaborator-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path/space_number`. + public var spaceNumber: Swift.Int + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path/actor_type`. + @frozen public enum ActorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case user = "User" + case team = "Team" + } + /// The type of actor (user or team). + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path/actor_type`. + public var actorType: Operations.CopilotSpacesRemoveCollaboratorForOrg.Input.Path.ActorTypePayload + /// The username (for users) or team slug (for teams). The numeric ID of a user or team is also accepted. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path/actor_identifier`. + public var actorIdentifier: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + /// - actorType: The type of actor (user or team). + /// - actorIdentifier: The username (for users) or team slug (for teams). The numeric ID of a user or team is also accepted. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int, + actorType: Operations.CopilotSpacesRemoveCollaboratorForOrg.Input.Path.ActorTypePayload, + actorIdentifier: Swift.String + ) { + self.org = org + self.spaceNumber = spaceNumber + self.actorType = actorType + self.actorIdentifier = actorIdentifier + } + } + public var path: Operations.CopilotSpacesRemoveCollaboratorForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/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.CopilotSpacesRemoveCollaboratorForOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesRemoveCollaboratorForOrg.Input.Path, + headers: Operations.CopilotSpacesRemoveCollaboratorForOrg.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct NoContent: Sendable, Hashable { + /// Creates a new `NoContent`. + public init() {} + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-org)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Operations.CopilotSpacesRemoveCollaboratorForOrg.Output.NoContent) + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-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.CopilotSpacesRemoveCollaboratorForOrg.Output.NoContent { + get throws { + switch self { + case let .noContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "noContent", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-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 .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 resources for an organization Copilot Space + /// + /// Lists all resources attached to a specific Copilot Space owned by an organization. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-org)`. + public enum CopilotSpacesListResourcesForOrg { + public static let id: Swift.String = "copilot-spaces/list-resources-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/GET/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/GET/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/GET/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int + ) { + self.org = org + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesListResourcesForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/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.CopilotSpacesListResourcesForOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesListResourcesForOrg.Input.Path, + headers: Operations.CopilotSpacesListResourcesForOrg.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/GET/responses/200/content/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The list of resources attached to this Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/GET/responses/200/content/json/resources`. + public var resources: [Components.Schemas.CopilotSpaceResource] + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - resources: The list of resources attached to this Copilot Space. + public init(resources: [Components.Schemas.CopilotSpaceResource]) { + self.resources = resources + } + public enum CodingKeys: String, CodingKey { + case resources + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/GET/responses/200/content/application\/json`. + case json(Operations.CopilotSpacesListResourcesForOrg.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.CopilotSpacesListResourcesForOrg.Output.Ok.Body.JsonPayload { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesListResourcesForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesListResourcesForOrg.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesListResourcesForOrg.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.CopilotSpacesListResourcesForOrg.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-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 .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 + ] + } + } + } + /// Create a resource for an organization Copilot Space + /// + /// Creates a new resource in a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// The following resource types are supported: `repository`, `github_file`, `free_text`, `github_issue`, `github_pull_request`. + /// The `uploaded_text_file` and `media_content` types are not supported via this endpoint. + /// + /// For `github_file` resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a `200` status. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /orgs/{org}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-org)`. + public enum CopilotSpacesCreateResourceForOrg { + public static let id: Swift.String = "copilot-spaces/create-resource-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int + ) { + self.org = org + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesCreateResourceForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/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.CopilotSpacesCreateResourceForOrg.Input.Headers + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The type of resource to create. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/requestBody/json/resource_type`. + @frozen public enum ResourceTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case repository = "repository" + case githubFile = "github_file" + case freeText = "free_text" + case githubIssue = "github_issue" + case githubPullRequest = "github_pull_request" + } + /// The type of resource to create. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/requestBody/json/resource_type`. + public var resourceType: Operations.CopilotSpacesCreateResourceForOrg.Input.Body.JsonPayload.ResourceTypePayload + /// Resource-specific metadata. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/requestBody/json/metadata`. + public struct MetadataPayload: Codable, Hashable, Sendable { + /// A container of undocumented properties. + public var additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer + /// Creates a new `MetadataPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + public init(additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer = .init()) { + self.additionalProperties = additionalProperties + } + public init(from decoder: any Swift.Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + public func encode(to encoder: any Swift.Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + /// Resource-specific metadata. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/requestBody/json/metadata`. + public var metadata: Operations.CopilotSpacesCreateResourceForOrg.Input.Body.JsonPayload.MetadataPayload + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - resourceType: The type of resource to create. + /// - metadata: Resource-specific metadata. + public init( + resourceType: Operations.CopilotSpacesCreateResourceForOrg.Input.Body.JsonPayload.ResourceTypePayload, + metadata: Operations.CopilotSpacesCreateResourceForOrg.Input.Body.JsonPayload.MetadataPayload + ) { + self.resourceType = resourceType + self.metadata = metadata + } + public enum CodingKeys: String, CodingKey { + case resourceType = "resource_type" + case metadata + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesCreateResourceForOrg.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesCreateResourceForOrg.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesCreateResourceForOrg.Input.Path, + headers: Operations.CopilotSpacesCreateResourceForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesCreateResourceForOrg.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/orgs/{org}/copilot-spaces/{space_number}/resources/POST/responses/201/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/responses/201/content/application\/json`. + case json(Components.Schemas.CopilotSpaceResource) + /// 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.CopilotSpaceResource { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesCreateResourceForOrg.Output.Created.Body + /// Creates a new `Created`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesCreateResourceForOrg.Output.Created.Body) { + self.body = body + } + } + /// Resource created + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-org)/responses/201`. + /// + /// HTTP response code: `201 created`. + case created(Operations.CopilotSpacesCreateResourceForOrg.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.CopilotSpacesCreateResourceForOrg.Output.Created { + get throws { + switch self { + case let .created(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "created", + response: self + ) + } + } + } + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/POST/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpaceResource) + /// 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.CopilotSpaceResource { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesCreateResourceForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesCreateResourceForOrg.Output.Ok.Body) { + self.body = body + } + } + /// Duplicate github_file resource already exists + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesCreateResourceForOrg.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.CopilotSpacesCreateResourceForOrg.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-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 .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-org)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 resource for an organization Copilot Space + /// + /// Gets a specific resource attached to a Copilot Space owned by an organization. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:org` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-org)`. + public enum CopilotSpacesGetResourceForOrg { + public static let id: Swift.String = "copilot-spaces/get-resource-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/path/space_number`. + public var spaceNumber: Swift.Int + /// The unique identifier of the resource. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/path/space_resource_id`. + public var spaceResourceId: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + /// - spaceResourceId: The unique identifier of the resource. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int, + spaceResourceId: Swift.Int + ) { + self.org = org + self.spaceNumber = spaceNumber + self.spaceResourceId = spaceResourceId + } + } + public var path: Operations.CopilotSpacesGetResourceForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_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.CopilotSpacesGetResourceForOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesGetResourceForOrg.Input.Path, + headers: Operations.CopilotSpacesGetResourceForOrg.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpaceResource) + /// 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.CopilotSpaceResource { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesGetResourceForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesGetResourceForOrg.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesGetResourceForOrg.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.CopilotSpacesGetResourceForOrg.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-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 .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 + ] + } + } + } + /// Set a resource for an organization Copilot Space + /// + /// Updates the metadata of a resource in a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-org)`. + public enum CopilotSpacesUpdateResourceForOrg { + public static let id: Swift.String = "copilot-spaces/update-resource-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/path/space_number`. + public var spaceNumber: Swift.Int + /// The unique identifier of the resource. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/path/space_resource_id`. + public var spaceResourceId: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + /// - spaceResourceId: The unique identifier of the resource. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int, + spaceResourceId: Swift.Int + ) { + self.org = org + self.spaceNumber = spaceNumber + self.spaceResourceId = spaceResourceId + } + } + public var path: Operations.CopilotSpacesUpdateResourceForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/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.CopilotSpacesUpdateResourceForOrg.Input.Headers + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// Updated resource-specific metadata. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/requestBody/json/metadata`. + public struct MetadataPayload: Codable, Hashable, Sendable { + /// A container of undocumented properties. + public var additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer + /// Creates a new `MetadataPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + public init(additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer = .init()) { + self.additionalProperties = additionalProperties + } + public init(from decoder: any Swift.Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + public func encode(to encoder: any Swift.Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + /// Updated resource-specific metadata. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/requestBody/json/metadata`. + public var metadata: Operations.CopilotSpacesUpdateResourceForOrg.Input.Body.JsonPayload.MetadataPayload? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - metadata: Updated resource-specific metadata. + public init(metadata: Operations.CopilotSpacesUpdateResourceForOrg.Input.Body.JsonPayload.MetadataPayload? = nil) { + self.metadata = metadata + } + public enum CodingKeys: String, CodingKey { + case metadata + } + } + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesUpdateResourceForOrg.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesUpdateResourceForOrg.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesUpdateResourceForOrg.Input.Path, + headers: Operations.CopilotSpacesUpdateResourceForOrg.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateResourceForOrg.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpaceResource) + /// 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.CopilotSpaceResource { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesUpdateResourceForOrg.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesUpdateResourceForOrg.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-org)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesUpdateResourceForOrg.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.CopilotSpacesUpdateResourceForOrg.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-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 .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-org)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 + ] + } + } + } + /// Delete a resource from an organization Copilot Space + /// + /// Deletes a resource from a specific Copilot Space owned by an organization. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-org)`. + public enum CopilotSpacesDeleteResourceForOrg { + public static let id: Swift.String = "copilot-spaces/delete-resource-for-org" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/DELETE/path`. + public struct Path: Sendable, Hashable { + /// The organization name. The name is not case sensitive. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/DELETE/path/org`. + public var org: Components.Parameters.Org + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/DELETE/path/space_number`. + public var spaceNumber: Swift.Int + /// The unique identifier of the resource. + /// + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/DELETE/path/space_resource_id`. + public var spaceResourceId: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - org: The organization name. The name is not case sensitive. + /// - spaceNumber: The unique identifier of the Copilot Space. + /// - spaceResourceId: The unique identifier of the resource. + public init( + org: Components.Parameters.Org, + spaceNumber: Swift.Int, + spaceResourceId: Swift.Int + ) { + self.org = org + self.spaceNumber = spaceNumber + self.spaceResourceId = spaceResourceId + } + } + public var path: Operations.CopilotSpacesDeleteResourceForOrg.Input.Path + /// - Remark: Generated from `#/paths/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/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.CopilotSpacesDeleteResourceForOrg.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesDeleteResourceForOrg.Input.Path, + headers: Operations.CopilotSpacesDeleteResourceForOrg.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct NoContent: Sendable, Hashable { + /// Creates a new `NoContent`. + public init() {} + } + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-org)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Operations.CopilotSpacesDeleteResourceForOrg.Output.NoContent) + /// Response + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-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.CopilotSpacesDeleteResourceForOrg.Output.NoContent { + get throws { + switch self { + case let .noContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "noContent", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-org)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-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 .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 Copilot Spaces for a user + /// + /// Lists Copilot Spaces owned by a user. The authenticated user must have read access to the user's Copilot Spaces. + /// + /// Only Spaces that are readable by the authenticated user are returned. This includes the user's own spaces, and public user spaces when accessing another user's spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/get(copilot-spaces/list-for-user)`. + public enum CopilotSpacesListForUser { + public static let id: Swift.String = "copilot-spaces/list-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/GET/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/GET/path/username`. + public var username: Components.Parameters.Username + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + public init(username: Components.Parameters.Username) { + self.username = username + } + } + public var path: Operations.CopilotSpacesListForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/GET/query`. + public struct Query: Sendable, Hashable { + /// The number of results per page (max 100). + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/GET/query/per_page`. + public var perPage: Swift.Int? + /// 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. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/GET/query/before`. + public var before: Swift.String? + /// 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. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/GET/query/after`. + public var after: Swift.String? + /// Creates a new `Query`. + /// + /// - Parameters: + /// - perPage: The number of results per page (max 100). + /// - 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. + /// - 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. + public init( + perPage: Swift.Int? = nil, + before: Swift.String? = nil, + after: Swift.String? = nil + ) { + self.perPage = perPage + self.before = before + self.after = after + } + } + public var query: Operations.CopilotSpacesListForUser.Input.Query + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/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.CopilotSpacesListForUser.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - query: + /// - headers: + public init( + path: Operations.CopilotSpacesListForUser.Input.Path, + query: Operations.CopilotSpacesListForUser.Input.Query = .init(), + headers: Operations.CopilotSpacesListForUser.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/users/{username}/copilot-spaces/GET/responses/200/headers`. + public struct Headers: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/GET/responses/200/headers/Link`. + public var link: Components.Headers.Link? + /// Creates a new `Headers`. + /// + /// - Parameters: + /// - link: + public init(link: Components.Headers.Link? = nil) { + self.link = link + } + } + /// Received HTTP response headers + public var headers: Operations.CopilotSpacesListForUser.Output.Ok.Headers + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/GET/responses/200/content/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The list of Copilot Spaces on this page of results. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/GET/responses/200/content/json/spaces`. + public var spaces: [Components.Schemas.CopilotSpace] + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - spaces: The list of Copilot Spaces on this page of results. + public init(spaces: [Components.Schemas.CopilotSpace]) { + self.spaces = spaces + } + public enum CodingKeys: String, CodingKey { + case spaces + } + } + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/GET/responses/200/content/application\/json`. + case json(Operations.CopilotSpacesListForUser.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.CopilotSpacesListForUser.Output.Ok.Body.JsonPayload { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesListForUser.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - headers: Received HTTP response headers + /// - body: Received HTTP response body + public init( + headers: Operations.CopilotSpacesListForUser.Output.Ok.Headers = .init(), + body: Operations.CopilotSpacesListForUser.Output.Ok.Body + ) { + self.headers = headers + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/get(copilot-spaces/list-for-user)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesListForUser.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.CopilotSpacesListForUser.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/get(copilot-spaces/list-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/get(copilot-spaces/list-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// 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 Copilot Space for a user + /// + /// Creates a new Copilot Space owned by a user. Only the authenticated user can create spaces for their own account. + /// + /// Users can create personal Copilot Spaces for their individual use. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/post(copilot-spaces/create-for-user)`. + public enum CopilotSpacesCreateForUser { + public static let id: Swift.String = "copilot-spaces/create-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/path/username`. + public var username: Components.Parameters.Username + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + public init(username: Components.Parameters.Username) { + self.username = username + } + } + public var path: Operations.CopilotSpacesCreateForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/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.CopilotSpacesCreateForUser.Input.Headers + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The name of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/name`. + public var name: Swift.String + /// A description of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/description`. + public var description: Swift.String? + /// General instructions for the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/general_instructions`. + public var generalInstructions: Swift.String? + /// The base role that determines default permissions for the space. + /// - `no_access`: No default access (default) + /// - `reader`: Makes the space publicly readable + /// Note: User spaces do not support writer or admin base roles. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/base_role`. + @frozen public enum BaseRolePayload: String, Codable, Hashable, Sendable, CaseIterable { + case reader = "reader" + case noAccess = "no_access" + } + /// The base role that determines default permissions for the space. + /// - `no_access`: No default access (default) + /// - `reader`: Makes the space publicly readable + /// Note: User spaces do not support writer or admin base roles. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/base_role`. + public var baseRole: Operations.CopilotSpacesCreateForUser.Input.Body.JsonPayload.BaseRolePayload? + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload`. + public struct ResourcesAttributesPayloadPayload: Codable, Hashable, Sendable { + /// The type of resource. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/resource_type`. + @frozen public enum ResourceTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case repository = "repository" + case githubFile = "github_file" + case freeText = "free_text" + case githubIssue = "github_issue" + case githubPullRequest = "github_pull_request" + case mediaContent = "media_content" + case uploadedTextFile = "uploaded_text_file" + } + /// The type of resource. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/resource_type`. + public var resourceType: Operations.CopilotSpacesCreateForUser.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.ResourceTypePayload? + /// Metadata specific to the resource type. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata`. + public struct MetadataPayload: Codable, Hashable, Sendable { + /// Repository ID for repository or file resources. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata/repository_id`. + public var repositoryId: Swift.Int? + /// File path for file resources. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata/file_path`. + public var filePath: Swift.String? + /// Text content for free text resources. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata/text`. + public var text: Swift.String? + /// Name for the resource. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata/name`. + public var name: Swift.String? + /// Issue or PR number. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata/number`. + public var number: Swift.Int? + /// Creates a new `MetadataPayload`. + /// + /// - Parameters: + /// - repositoryId: Repository ID for repository or file resources. + /// - filePath: File path for file resources. + /// - text: Text content for free text resources. + /// - name: Name for the resource. + /// - number: Issue or PR number. + public init( + repositoryId: Swift.Int? = nil, + filePath: Swift.String? = nil, + text: Swift.String? = nil, + name: Swift.String? = nil, + number: Swift.Int? = nil + ) { + self.repositoryId = repositoryId + self.filePath = filePath + self.text = text + self.name = name + self.number = number + } + public enum CodingKeys: String, CodingKey { + case repositoryId = "repository_id" + case filePath = "file_path" + case text + case name + case number + } + } + /// Metadata specific to the resource type. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/ResourcesAttributesPayload/metadata`. + public var metadata: Operations.CopilotSpacesCreateForUser.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.MetadataPayload? + /// Creates a new `ResourcesAttributesPayloadPayload`. + /// + /// - Parameters: + /// - resourceType: The type of resource. + /// - metadata: Metadata specific to the resource type. + public init( + resourceType: Operations.CopilotSpacesCreateForUser.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.ResourceTypePayload? = nil, + metadata: Operations.CopilotSpacesCreateForUser.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.MetadataPayload? = nil + ) { + self.resourceType = resourceType + self.metadata = metadata + } + public enum CodingKeys: String, CodingKey { + case resourceType = "resource_type" + case metadata + } + } + /// Resources to attach to the space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/resources_attributes`. + public typealias ResourcesAttributesPayload = [Operations.CopilotSpacesCreateForUser.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload] + /// Resources to attach to the space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/json/resources_attributes`. + public var resourcesAttributes: Operations.CopilotSpacesCreateForUser.Input.Body.JsonPayload.ResourcesAttributesPayload? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - name: The name of the Copilot Space. + /// - description: A description of the Copilot Space. + /// - generalInstructions: General instructions for the Copilot Space. + /// - baseRole: The base role that determines default permissions for the space. + /// - resourcesAttributes: Resources to attach to the space. + public init( + name: Swift.String, + description: Swift.String? = nil, + generalInstructions: Swift.String? = nil, + baseRole: Operations.CopilotSpacesCreateForUser.Input.Body.JsonPayload.BaseRolePayload? = nil, + resourcesAttributes: Operations.CopilotSpacesCreateForUser.Input.Body.JsonPayload.ResourcesAttributesPayload? = nil + ) { + self.name = name + self.description = description + self.generalInstructions = generalInstructions + self.baseRole = baseRole + self.resourcesAttributes = resourcesAttributes + } + public enum CodingKeys: String, CodingKey { + case name + case description + case generalInstructions = "general_instructions" + case baseRole = "base_role" + case resourcesAttributes = "resources_attributes" + } + } + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesCreateForUser.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesCreateForUser.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesCreateForUser.Input.Path, + headers: Operations.CopilotSpacesCreateForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesCreateForUser.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/users/{username}/copilot-spaces/POST/responses/201/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/POST/responses/201/content/application\/json`. + case json(Components.Schemas.CopilotSpace) + /// 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.CopilotSpace { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesCreateForUser.Output.Created.Body + /// Creates a new `Created`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesCreateForUser.Output.Created.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/post(copilot-spaces/create-for-user)/responses/201`. + /// + /// HTTP response code: `201 created`. + case created(Operations.CopilotSpacesCreateForUser.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.CopilotSpacesCreateForUser.Output.Created { + get throws { + switch self { + case let .created(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "created", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/post(copilot-spaces/create-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/post(copilot-spaces/create-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/post(copilot-spaces/create-for-user)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 Copilot Space for a user + /// + /// Gets details about a specific Copilot Space owned by a user. The authenticated user must have read access to the Space. + /// + /// Private user spaces require the authenticated user to be the owner of the space. + /// Public user spaces are accessible to any authenticated user. + /// + /// OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-user)`. + public enum CopilotSpacesGetForUser { + public static let id: Swift.String = "copilot-spaces/get-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/GET/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/GET/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/GET/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int + ) { + self.username = username + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesGetForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/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.CopilotSpacesGetForUser.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesGetForUser.Input.Path, + headers: Operations.CopilotSpacesGetForUser.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/GET/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpace) + /// 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.CopilotSpace { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesGetForUser.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesGetForUser.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-user)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesGetForUser.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.CopilotSpacesGetForUser.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/get(copilot-spaces/get-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// 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 + ] + } + } + } + /// Set a Copilot Space for a user + /// + /// Updates a Copilot Space owned by a user. Only the authenticated user can update spaces for their own account. + /// + /// Users can update their personal Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-user)`. + public enum CopilotSpacesUpdateForUser { + public static let id: Swift.String = "copilot-spaces/update-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int + ) { + self.username = username + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesUpdateForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/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.CopilotSpacesUpdateForUser.Input.Headers + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The name of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/name`. + public var name: Swift.String? + /// A description of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/description`. + public var description: Swift.String? + /// General instructions for the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/general_instructions`. + public var generalInstructions: Swift.String? + /// The base role that determines default permissions for the space. Changing this field requires admin permissions. + /// - `no_access`: No default access (default) + /// - `reader`: Makes the space publicly readable + /// Note: User spaces do not support writer or admin base roles. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/base_role`. + @frozen public enum BaseRolePayload: String, Codable, Hashable, Sendable, CaseIterable { + case reader = "reader" + case noAccess = "no_access" + } + /// The base role that determines default permissions for the space. Changing this field requires admin permissions. + /// - `no_access`: No default access (default) + /// - `reader`: Makes the space publicly readable + /// Note: User spaces do not support writer or admin base roles. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/base_role`. + public var baseRole: Operations.CopilotSpacesUpdateForUser.Input.Body.JsonPayload.BaseRolePayload? + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload`. + public struct ResourcesAttributesPayloadPayload: Codable, Hashable, Sendable { + /// The type of resource. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/resource_type`. + @frozen public enum ResourceTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case repository = "repository" + case githubFile = "github_file" + case freeText = "free_text" + case githubIssue = "github_issue" + case githubPullRequest = "github_pull_request" + case mediaContent = "media_content" + case uploadedTextFile = "uploaded_text_file" + } + /// The type of resource. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/resource_type`. + public var resourceType: Operations.CopilotSpacesUpdateForUser.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.ResourceTypePayload? + /// Metadata specific to the resource type. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata`. + public struct MetadataPayload: Codable, Hashable, Sendable { + /// Repository ID for repository or file resources. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata/repository_id`. + public var repositoryId: Swift.Int? + /// File path for file resources. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata/file_path`. + public var filePath: Swift.String? + /// Text content for free text resources. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata/text`. + public var text: Swift.String? + /// Name for the resource. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata/name`. + public var name: Swift.String? + /// Issue or PR number. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata/number`. + public var number: Swift.Int? + /// Creates a new `MetadataPayload`. + /// + /// - Parameters: + /// - repositoryId: Repository ID for repository or file resources. + /// - filePath: File path for file resources. + /// - text: Text content for free text resources. + /// - name: Name for the resource. + /// - number: Issue or PR number. + public init( + repositoryId: Swift.Int? = nil, + filePath: Swift.String? = nil, + text: Swift.String? = nil, + name: Swift.String? = nil, + number: Swift.Int? = nil + ) { + self.repositoryId = repositoryId + self.filePath = filePath + self.text = text + self.name = name + self.number = number + } + public enum CodingKeys: String, CodingKey { + case repositoryId = "repository_id" + case filePath = "file_path" + case text + case name + case number + } + } + /// Metadata specific to the resource type. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/ResourcesAttributesPayload/metadata`. + public var metadata: Operations.CopilotSpacesUpdateForUser.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.MetadataPayload? + /// Creates a new `ResourcesAttributesPayloadPayload`. + /// + /// - Parameters: + /// - resourceType: The type of resource. + /// - metadata: Metadata specific to the resource type. + public init( + resourceType: Operations.CopilotSpacesUpdateForUser.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.ResourceTypePayload? = nil, + metadata: Operations.CopilotSpacesUpdateForUser.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload.MetadataPayload? = nil + ) { + self.resourceType = resourceType + self.metadata = metadata + } + public enum CodingKeys: String, CodingKey { + case resourceType = "resource_type" + case metadata + } + } + /// Resources to attach to the space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/resources_attributes`. + public typealias ResourcesAttributesPayload = [Operations.CopilotSpacesUpdateForUser.Input.Body.JsonPayload.ResourcesAttributesPayloadPayload] + /// Resources to attach to the space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/json/resources_attributes`. + public var resourcesAttributes: Operations.CopilotSpacesUpdateForUser.Input.Body.JsonPayload.ResourcesAttributesPayload? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - name: The name of the Copilot Space. + /// - description: A description of the Copilot Space. + /// - generalInstructions: General instructions for the Copilot Space. + /// - baseRole: The base role that determines default permissions for the space. Changing this field requires admin permissions. + /// - resourcesAttributes: Resources to attach to the space. + public init( + name: Swift.String? = nil, + description: Swift.String? = nil, + generalInstructions: Swift.String? = nil, + baseRole: Operations.CopilotSpacesUpdateForUser.Input.Body.JsonPayload.BaseRolePayload? = nil, + resourcesAttributes: Operations.CopilotSpacesUpdateForUser.Input.Body.JsonPayload.ResourcesAttributesPayload? = nil + ) { + self.name = name + self.description = description + self.generalInstructions = generalInstructions + self.baseRole = baseRole + self.resourcesAttributes = resourcesAttributes + } + public enum CodingKeys: String, CodingKey { + case name + case description + case generalInstructions = "general_instructions" + case baseRole = "base_role" + case resourcesAttributes = "resources_attributes" + } + } + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesUpdateForUser.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesUpdateForUser.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesUpdateForUser.Input.Path, + headers: Operations.CopilotSpacesUpdateForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateForUser.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/PUT/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpace) + /// 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.CopilotSpace { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesUpdateForUser.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesUpdateForUser.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-user)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesUpdateForUser.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.CopilotSpacesUpdateForUser.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/put(copilot-spaces/update-for-user)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 + ] + } + } + } + /// Delete a Copilot Space for a user + /// + /// Deletes a Copilot Space owned by a user. The authenticated user must be the owner of the space. + /// + /// **Warning:** This action is permanent and cannot be undone. Deleting a space will remove all associated resources and configurations. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-user)`. + public enum CopilotSpacesDeleteForUser { + public static let id: Swift.String = "copilot-spaces/delete-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/DELETE/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/DELETE/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/DELETE/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int + ) { + self.username = username + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesDeleteForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/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.CopilotSpacesDeleteForUser.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesDeleteForUser.Input.Path, + headers: Operations.CopilotSpacesDeleteForUser.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct NoContent: Sendable, Hashable { + /// Creates a new `NoContent`. + public init() {} + } + /// The Copilot Space has been successfully deleted. + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-user)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Operations.CopilotSpacesDeleteForUser.Output.NoContent) + /// The Copilot Space has been successfully deleted. + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-user)/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.CopilotSpacesDeleteForUser.Output.NoContent { + get throws { + switch self { + case let .noContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "noContent", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/delete(copilot-spaces/delete-for-user)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 collaborators for a Copilot Space for a user + /// + /// Lists all collaborators for a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// Each collaborator entry specifies which user has access to the space and at what level (reader, writer, or admin). The space owner is excluded from this list. + /// + /// Team collaborators are not supported for user-owned Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-user)`. + public enum CopilotSpacesListCollaboratorsForUser { + public static let id: Swift.String = "copilot-spaces/list-collaborators-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/GET/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/GET/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/GET/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int + ) { + self.username = username + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesListCollaboratorsForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/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.CopilotSpacesListCollaboratorsForUser.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesListCollaboratorsForUser.Input.Path, + headers: Operations.CopilotSpacesListCollaboratorsForUser.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/GET/responses/200/content/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The list of collaborators for this Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/GET/responses/200/content/json/collaborators`. + public var collaborators: [Components.Schemas.CopilotSpaceCollaborator] + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - collaborators: The list of collaborators for this Copilot Space. + public init(collaborators: [Components.Schemas.CopilotSpaceCollaborator]) { + self.collaborators = collaborators + } + public enum CodingKeys: String, CodingKey { + case collaborators + } + } + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/GET/responses/200/content/application\/json`. + case json(Operations.CopilotSpacesListCollaboratorsForUser.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.CopilotSpacesListCollaboratorsForUser.Output.Ok.Body.JsonPayload { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesListCollaboratorsForUser.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesListCollaboratorsForUser.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-user)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesListCollaboratorsForUser.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.CopilotSpacesListCollaboratorsForUser.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/get(copilot-spaces/list-collaborators-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// 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 + ] + } + } + } + /// Add a collaborator to a Copilot Space for a user + /// + /// Adds a collaborator to a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// Team collaborators are not supported for user-owned Copilot Spaces. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces/{space_number}/collaborators`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-user)`. + public enum CopilotSpacesAddCollaboratorForUser { + public static let id: Swift.String = "copilot-spaces/add-collaborator-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int + ) { + self.username = username + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesAddCollaboratorForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/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.CopilotSpacesAddCollaboratorForUser.Input.Headers + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The type of actor (must be `User` for user-owned spaces; `Team` will be rejected). + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json/actor_type`. + @frozen public enum ActorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case user = "User" + case team = "Team" + } + /// The type of actor (must be `User` for user-owned spaces; `Team` will be rejected). + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json/actor_type`. + public var actorType: Operations.CopilotSpacesAddCollaboratorForUser.Input.Body.JsonPayload.ActorTypePayload + /// The username of the collaborator. The numeric user ID is also accepted. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json/actor_identifier`. + public var actorIdentifier: Swift.String + /// The role to grant to the collaborator. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json/role`. + @frozen public enum RolePayload: String, Codable, Hashable, Sendable, CaseIterable { + case reader = "reader" + case writer = "writer" + case admin = "admin" + } + /// The role to grant to the collaborator. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/requestBody/json/role`. + public var role: Operations.CopilotSpacesAddCollaboratorForUser.Input.Body.JsonPayload.RolePayload + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - actorType: The type of actor (must be `User` for user-owned spaces; `Team` will be rejected). + /// - actorIdentifier: The username of the collaborator. The numeric user ID is also accepted. + /// - role: The role to grant to the collaborator. + public init( + actorType: Operations.CopilotSpacesAddCollaboratorForUser.Input.Body.JsonPayload.ActorTypePayload, + actorIdentifier: Swift.String, + role: Operations.CopilotSpacesAddCollaboratorForUser.Input.Body.JsonPayload.RolePayload + ) { + self.actorType = actorType + self.actorIdentifier = actorIdentifier + self.role = role + } + public enum CodingKeys: String, CodingKey { + case actorType = "actor_type" + case actorIdentifier = "actor_identifier" + case role + } + } + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesAddCollaboratorForUser.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesAddCollaboratorForUser.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesAddCollaboratorForUser.Input.Path, + headers: Operations.CopilotSpacesAddCollaboratorForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesAddCollaboratorForUser.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/users/{username}/copilot-spaces/{space_number}/collaborators/POST/responses/201/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/POST/responses/201/content/application\/json`. + case json(Components.Schemas.CopilotSpaceCollaborator) + /// 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.CopilotSpaceCollaborator { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesAddCollaboratorForUser.Output.Created.Body + /// Creates a new `Created`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesAddCollaboratorForUser.Output.Created.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-user)/responses/201`. + /// + /// HTTP response code: `201 created`. + case created(Operations.CopilotSpacesAddCollaboratorForUser.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.CopilotSpacesAddCollaboratorForUser.Output.Created { + get throws { + switch self { + case let .created(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "created", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/post(copilot-spaces/add-collaborator-for-user)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 + ] + } + } + } + /// Set a collaborator role for a Copilot Space for a user + /// + /// Updates the role of a collaborator for a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-user)`. + public enum CopilotSpacesUpdateCollaboratorForUser { + public static let id: Swift.String = "copilot-spaces/update-collaborator-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path/space_number`. + public var spaceNumber: Swift.Int + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path/actor_type`. + @frozen public enum ActorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case user = "User" + case team = "Team" + } + /// The type of actor (must be `User` for user-owned spaces; `Team` will be rejected). + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path/actor_type`. + public var actorType: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Path.ActorTypePayload + /// The username of the collaborator. The numeric user ID is also accepted. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/path/actor_identifier`. + public var actorIdentifier: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + /// - actorType: The type of actor (must be `User` for user-owned spaces; `Team` will be rejected). + /// - actorIdentifier: The username of the collaborator. The numeric user ID is also accepted. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int, + actorType: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Path.ActorTypePayload, + actorIdentifier: Swift.String + ) { + self.username = username + self.spaceNumber = spaceNumber + self.actorType = actorType + self.actorIdentifier = actorIdentifier + } + } + public var path: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/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.CopilotSpacesUpdateCollaboratorForUser.Input.Headers + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The new role to grant to the collaborator. Use `no_access` to remove the collaborator. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/requestBody/json/role`. + @frozen public enum RolePayload: String, Codable, Hashable, Sendable, CaseIterable { + case reader = "reader" + case writer = "writer" + case admin = "admin" + case noAccess = "no_access" + } + /// The new role to grant to the collaborator. Use `no_access` to remove the collaborator. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/requestBody/json/role`. + public var role: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Body.JsonPayload.RolePayload + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - role: The new role to grant to the collaborator. Use `no_access` to remove the collaborator. + public init(role: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Body.JsonPayload.RolePayload) { + self.role = role + } + public enum CodingKeys: String, CodingKey { + case role + } + } + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Path, + headers: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateCollaboratorForUser.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/PUT/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpaceCollaborator) + /// 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.CopilotSpaceCollaborator { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesUpdateCollaboratorForUser.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesUpdateCollaboratorForUser.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-user)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesUpdateCollaboratorForUser.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.CopilotSpacesUpdateCollaboratorForUser.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + public struct NoContent: Sendable, Hashable { + /// Creates a new `NoContent`. + public init() {} + } + /// Response when `role` is `no_access` and the collaborator was removed. + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-user)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Operations.CopilotSpacesUpdateCollaboratorForUser.Output.NoContent) + /// Response when `role` is `no_access` and the collaborator was removed. + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-user)/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.CopilotSpacesUpdateCollaboratorForUser.Output.NoContent { + get throws { + switch self { + case let .noContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "noContent", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/put(copilot-spaces/update-collaborator-for-user)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 + ] + } + } + } + /// Remove a collaborator from a Copilot Space for a user + /// + /// Removes a collaborator from a specific Copilot Space owned by a user. The authenticated user must be the owner of the space or have admin access to the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-user)`. + public enum CopilotSpacesRemoveCollaboratorForUser { + public static let id: Swift.String = "copilot-spaces/remove-collaborator-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path/space_number`. + public var spaceNumber: Swift.Int + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path/actor_type`. + @frozen public enum ActorTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case user = "User" + case team = "Team" + } + /// The type of actor (must be `User` for user-owned spaces; `Team` will be rejected). + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path/actor_type`. + public var actorType: Operations.CopilotSpacesRemoveCollaboratorForUser.Input.Path.ActorTypePayload + /// The username of the collaborator. The numeric user ID is also accepted. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/DELETE/path/actor_identifier`. + public var actorIdentifier: Swift.String + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + /// - actorType: The type of actor (must be `User` for user-owned spaces; `Team` will be rejected). + /// - actorIdentifier: The username of the collaborator. The numeric user ID is also accepted. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int, + actorType: Operations.CopilotSpacesRemoveCollaboratorForUser.Input.Path.ActorTypePayload, + actorIdentifier: Swift.String + ) { + self.username = username + self.spaceNumber = spaceNumber + self.actorType = actorType + self.actorIdentifier = actorIdentifier + } + } + public var path: Operations.CopilotSpacesRemoveCollaboratorForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/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.CopilotSpacesRemoveCollaboratorForUser.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesRemoveCollaboratorForUser.Input.Path, + headers: Operations.CopilotSpacesRemoveCollaboratorForUser.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct NoContent: Sendable, Hashable { + /// Creates a new `NoContent`. + public init() {} + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-user)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Operations.CopilotSpacesRemoveCollaboratorForUser.Output.NoContent) + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-user)/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.CopilotSpacesRemoveCollaboratorForUser.Output.NoContent { + get throws { + switch self { + case let .noContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "noContent", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/collaborators/{actor_type}/{actor_identifier}/delete(copilot-spaces/remove-collaborator-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// 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 resources for a Copilot Space for a user + /// + /// Lists all resources attached to a specific Copilot Space owned by a user. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-user)`. + public enum CopilotSpacesListResourcesForUser { + public static let id: Swift.String = "copilot-spaces/list-resources-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/GET/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/GET/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/GET/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int + ) { + self.username = username + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesListResourcesForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/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.CopilotSpacesListResourcesForUser.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesListResourcesForUser.Input.Path, + headers: Operations.CopilotSpacesListResourcesForUser.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/GET/responses/200/content/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The list of resources attached to this Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/GET/responses/200/content/json/resources`. + public var resources: [Components.Schemas.CopilotSpaceResource] + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - resources: The list of resources attached to this Copilot Space. + public init(resources: [Components.Schemas.CopilotSpaceResource]) { + self.resources = resources + } + public enum CodingKeys: String, CodingKey { + case resources + } + } + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/GET/responses/200/content/application\/json`. + case json(Operations.CopilotSpacesListResourcesForUser.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.CopilotSpacesListResourcesForUser.Output.Ok.Body.JsonPayload { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesListResourcesForUser.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesListResourcesForUser.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-user)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesListResourcesForUser.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.CopilotSpacesListResourcesForUser.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/get(copilot-spaces/list-resources-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// 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 resource for a Copilot Space for a user + /// + /// Creates a new resource in a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// The following resource types are supported: `repository`, `github_file`, `free_text`, `github_issue`, `github_pull_request`. + /// The `uploaded_text_file` and `media_content` types are not supported via this endpoint. + /// + /// For `github_file` resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a `200` status. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `POST /users/{username}/copilot-spaces/{space_number}/resources`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-user)`. + public enum CopilotSpacesCreateResourceForUser { + public static let id: Swift.String = "copilot-spaces/create-resource-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/path/space_number`. + public var spaceNumber: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int + ) { + self.username = username + self.spaceNumber = spaceNumber + } + } + public var path: Operations.CopilotSpacesCreateResourceForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/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.CopilotSpacesCreateResourceForUser.Input.Headers + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// The type of resource to create. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/requestBody/json/resource_type`. + @frozen public enum ResourceTypePayload: String, Codable, Hashable, Sendable, CaseIterable { + case repository = "repository" + case githubFile = "github_file" + case freeText = "free_text" + case githubIssue = "github_issue" + case githubPullRequest = "github_pull_request" + } + /// The type of resource to create. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/requestBody/json/resource_type`. + public var resourceType: Operations.CopilotSpacesCreateResourceForUser.Input.Body.JsonPayload.ResourceTypePayload + /// Resource-specific metadata. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/requestBody/json/metadata`. + public struct MetadataPayload: Codable, Hashable, Sendable { + /// A container of undocumented properties. + public var additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer + /// Creates a new `MetadataPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + public init(additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer = .init()) { + self.additionalProperties = additionalProperties + } + public init(from decoder: any Swift.Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + public func encode(to encoder: any Swift.Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + /// Resource-specific metadata. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/requestBody/json/metadata`. + public var metadata: Operations.CopilotSpacesCreateResourceForUser.Input.Body.JsonPayload.MetadataPayload + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - resourceType: The type of resource to create. + /// - metadata: Resource-specific metadata. + public init( + resourceType: Operations.CopilotSpacesCreateResourceForUser.Input.Body.JsonPayload.ResourceTypePayload, + metadata: Operations.CopilotSpacesCreateResourceForUser.Input.Body.JsonPayload.MetadataPayload + ) { + self.resourceType = resourceType + self.metadata = metadata + } + public enum CodingKeys: String, CodingKey { + case resourceType = "resource_type" + case metadata + } + } + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesCreateResourceForUser.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesCreateResourceForUser.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesCreateResourceForUser.Input.Path, + headers: Operations.CopilotSpacesCreateResourceForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesCreateResourceForUser.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/users/{username}/copilot-spaces/{space_number}/resources/POST/responses/201/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/responses/201/content/application\/json`. + case json(Components.Schemas.CopilotSpaceResource) + /// 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.CopilotSpaceResource { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesCreateResourceForUser.Output.Created.Body + /// Creates a new `Created`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesCreateResourceForUser.Output.Created.Body) { + self.body = body + } + } + /// Resource created + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-user)/responses/201`. + /// + /// HTTP response code: `201 created`. + case created(Operations.CopilotSpacesCreateResourceForUser.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.CopilotSpacesCreateResourceForUser.Output.Created { + get throws { + switch self { + case let .created(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "created", + response: self + ) + } + } + } + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/POST/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpaceResource) + /// 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.CopilotSpaceResource { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesCreateResourceForUser.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesCreateResourceForUser.Output.Ok.Body) { + self.body = body + } + } + /// Duplicate github_file resource already exists + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-user)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesCreateResourceForUser.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.CopilotSpacesCreateResourceForUser.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/post(copilot-spaces/create-resource-for-user)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 resource for a Copilot Space for a user + /// + /// Gets a specific resource attached to a Copilot Space owned by a user. + /// The authenticated user must have appropriate permissions to view the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `read:user` scope to use this endpoint. + /// + /// - Remark: HTTP `GET /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-user)`. + public enum CopilotSpacesGetResourceForUser { + public static let id: Swift.String = "copilot-spaces/get-resource-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/path/space_number`. + public var spaceNumber: Swift.Int + /// The unique identifier of the resource. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/path/space_resource_id`. + public var spaceResourceId: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + /// - spaceResourceId: The unique identifier of the resource. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int, + spaceResourceId: Swift.Int + ) { + self.username = username + self.spaceNumber = spaceNumber + self.spaceResourceId = spaceResourceId + } + } + public var path: Operations.CopilotSpacesGetResourceForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_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.CopilotSpacesGetResourceForUser.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesGetResourceForUser.Input.Path, + headers: Operations.CopilotSpacesGetResourceForUser.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/GET/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpaceResource) + /// 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.CopilotSpaceResource { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesGetResourceForUser.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesGetResourceForUser.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-user)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesGetResourceForUser.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.CopilotSpacesGetResourceForUser.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/get(copilot-spaces/get-resource-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// 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 + ] + } + } + } + /// Set a resource for a Copilot Space for a user + /// + /// Updates the metadata of a resource in a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `PUT /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-user)`. + public enum CopilotSpacesUpdateResourceForUser { + public static let id: Swift.String = "copilot-spaces/update-resource-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/path/space_number`. + public var spaceNumber: Swift.Int + /// The unique identifier of the resource. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/path/space_resource_id`. + public var spaceResourceId: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + /// - spaceResourceId: The unique identifier of the resource. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int, + spaceResourceId: Swift.Int + ) { + self.username = username + self.spaceNumber = spaceNumber + self.spaceResourceId = spaceResourceId + } + } + public var path: Operations.CopilotSpacesUpdateResourceForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/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.CopilotSpacesUpdateResourceForUser.Input.Headers + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/requestBody`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/requestBody/json`. + public struct JsonPayload: Codable, Hashable, Sendable { + /// Updated resource-specific metadata. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/requestBody/json/metadata`. + public struct MetadataPayload: Codable, Hashable, Sendable { + /// A container of undocumented properties. + public var additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer + /// Creates a new `MetadataPayload`. + /// + /// - Parameters: + /// - additionalProperties: A container of undocumented properties. + public init(additionalProperties: OpenAPIRuntime.OpenAPIObjectContainer = .init()) { + self.additionalProperties = additionalProperties + } + public init(from decoder: any Swift.Decoder) throws { + additionalProperties = try decoder.decodeAdditionalProperties(knownKeys: []) + } + public func encode(to encoder: any Swift.Encoder) throws { + try encoder.encodeAdditionalProperties(additionalProperties) + } + } + /// Updated resource-specific metadata. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/requestBody/json/metadata`. + public var metadata: Operations.CopilotSpacesUpdateResourceForUser.Input.Body.JsonPayload.MetadataPayload? + /// Creates a new `JsonPayload`. + /// + /// - Parameters: + /// - metadata: Updated resource-specific metadata. + public init(metadata: Operations.CopilotSpacesUpdateResourceForUser.Input.Body.JsonPayload.MetadataPayload? = nil) { + self.metadata = metadata + } + public enum CodingKeys: String, CodingKey { + case metadata + } + } + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/requestBody/content/application\/json`. + case json(Operations.CopilotSpacesUpdateResourceForUser.Input.Body.JsonPayload) + } + public var body: Operations.CopilotSpacesUpdateResourceForUser.Input.Body + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + /// - body: + public init( + path: Operations.CopilotSpacesUpdateResourceForUser.Input.Path, + headers: Operations.CopilotSpacesUpdateResourceForUser.Input.Headers = .init(), + body: Operations.CopilotSpacesUpdateResourceForUser.Input.Body + ) { + self.path = path + self.headers = headers + self.body = body + } + } + @frozen public enum Output: Sendable, Hashable { + public struct Ok: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/responses/200/content`. + @frozen public enum Body: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/PUT/responses/200/content/application\/json`. + case json(Components.Schemas.CopilotSpaceResource) + /// 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.CopilotSpaceResource { + get throws { + switch self { + case let .json(body): + return body + } + } + } + } + /// Received HTTP response body + public var body: Operations.CopilotSpacesUpdateResourceForUser.Output.Ok.Body + /// Creates a new `Ok`. + /// + /// - Parameters: + /// - body: Received HTTP response body + public init(body: Operations.CopilotSpacesUpdateResourceForUser.Output.Ok.Body) { + self.body = body + } + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-user)/responses/200`. + /// + /// HTTP response code: `200 ok`. + case ok(Operations.CopilotSpacesUpdateResourceForUser.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.CopilotSpacesUpdateResourceForUser.Output.Ok { + get throws { + switch self { + case let .ok(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "ok", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// Validation failed, or the endpoint has been spammed. + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/put(copilot-spaces/update-resource-for-user)/responses/422`. + /// + /// HTTP response code: `422 unprocessableContent`. + case unprocessableContent(Components.Responses.ValidationFailed) + /// The associated value of the enum case if `self` is `.unprocessableContent`. + /// + /// - Throws: An error if `self` is not `.unprocessableContent`. + /// - SeeAlso: `.unprocessableContent`. + public var unprocessableContent: Components.Responses.ValidationFailed { + get throws { + switch self { + case let .unprocessableContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "unprocessableContent", + response: self + ) + } + } + } + /// 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 + ] + } + } + } + /// Delete a resource from a Copilot Space for a user + /// + /// Deletes a resource from a specific Copilot Space owned by a user. + /// The authenticated user must have write permissions on the space. + /// + /// OAuth app tokens and personal access tokens (classic) need the `write:user` scope to use this endpoint. + /// + /// - Remark: HTTP `DELETE /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}`. + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-user)`. + public enum CopilotSpacesDeleteResourceForUser { + public static let id: Swift.String = "copilot-spaces/delete-resource-for-user" + public struct Input: Sendable, Hashable { + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/DELETE/path`. + public struct Path: Sendable, Hashable { + /// The handle for the GitHub user account. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/DELETE/path/username`. + public var username: Components.Parameters.Username + /// The unique identifier of the Copilot Space. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/DELETE/path/space_number`. + public var spaceNumber: Swift.Int + /// The unique identifier of the resource. + /// + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/DELETE/path/space_resource_id`. + public var spaceResourceId: Swift.Int + /// Creates a new `Path`. + /// + /// - Parameters: + /// - username: The handle for the GitHub user account. + /// - spaceNumber: The unique identifier of the Copilot Space. + /// - spaceResourceId: The unique identifier of the resource. + public init( + username: Components.Parameters.Username, + spaceNumber: Swift.Int, + spaceResourceId: Swift.Int + ) { + self.username = username + self.spaceNumber = spaceNumber + self.spaceResourceId = spaceResourceId + } + } + public var path: Operations.CopilotSpacesDeleteResourceForUser.Input.Path + /// - Remark: Generated from `#/paths/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/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.CopilotSpacesDeleteResourceForUser.Input.Headers + /// Creates a new `Input`. + /// + /// - Parameters: + /// - path: + /// - headers: + public init( + path: Operations.CopilotSpacesDeleteResourceForUser.Input.Path, + headers: Operations.CopilotSpacesDeleteResourceForUser.Input.Headers = .init() + ) { + self.path = path + self.headers = headers + } + } + @frozen public enum Output: Sendable, Hashable { + public struct NoContent: Sendable, Hashable { + /// Creates a new `NoContent`. + public init() {} + } + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-user)/responses/204`. + /// + /// HTTP response code: `204 noContent`. + case noContent(Operations.CopilotSpacesDeleteResourceForUser.Output.NoContent) + /// Response + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-user)/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.CopilotSpacesDeleteResourceForUser.Output.NoContent { + get throws { + switch self { + case let .noContent(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "noContent", + response: self + ) + } + } + } + /// Forbidden + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-user)/responses/403`. + /// + /// HTTP response code: `403 forbidden`. + case forbidden(Components.Responses.Forbidden) + /// The associated value of the enum case if `self` is `.forbidden`. + /// + /// - Throws: An error if `self` is not `.forbidden`. + /// - SeeAlso: `.forbidden`. + public var forbidden: Components.Responses.Forbidden { + get throws { + switch self { + case let .forbidden(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "forbidden", + response: self + ) + } + } + } + /// Resource not found + /// + /// - Remark: Generated from `#/paths//users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}/delete(copilot-spaces/delete-resource-for-user)/responses/404`. + /// + /// HTTP response code: `404 notFound`. + case notFound(Components.Responses.NotFound) + /// The associated value of the enum case if `self` is `.notFound`. + /// + /// - Throws: An error if `self` is not `.notFound`. + /// - SeeAlso: `.notFound`. + public var notFound: Components.Responses.NotFound { + get throws { + switch self { + case let .notFound(response): + return response + default: + try throwUnexpectedResponseStatus( + expectedStatus: "notFound", + response: self + ) + } + } + } + /// 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 + ] + } + } + } +} From 7d88da2d0e70f08f4ddf9f40eeca8ceba0333b08 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 01:17:12 +0000 Subject: [PATCH 6/7] Commit via running: make Package.swift --- Package.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Package.swift b/Package.swift index be30c92ff4..3827a2b416 100644 --- a/Package.swift +++ b/Package.swift @@ -25,6 +25,7 @@ let package = Package( .library(name: "GitHubRestAPICodes_Of_Conduct", targets: ["GitHubRestAPICodes_Of_Conduct"]), .library(name: "GitHubRestAPICodespaces", targets: ["GitHubRestAPICodespaces"]), .library(name: "GitHubRestAPICopilot", targets: ["GitHubRestAPICopilot"]), + .library(name: "GitHubRestAPICopilot_Spaces", targets: ["GitHubRestAPICopilot_Spaces"]), .library(name: "GitHubRestAPICredentials", targets: ["GitHubRestAPICredentials"]), .library(name: "GitHubRestAPIDependabot", targets: ["GitHubRestAPIDependabot"]), .library(name: "GitHubRestAPIDependency_Graph", targets: ["GitHubRestAPIDependency_Graph"]), @@ -177,6 +178,14 @@ let package = Package( ], path: "Sources/copilot" ), + .target( + name: "GitHubRestAPICopilot_Spaces", + dependencies: [ + .product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"), + .product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"), + ], + path: "Sources/copilot-spaces" + ), .target( name: "GitHubRestAPICredentials", dependencies: [ From 076f05bd0e81e1138115a058b17106ceab6cf4f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 01:17:13 +0000 Subject: [PATCH 7/7] Commit via running: make .spi.yml --- .spi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.spi.yml b/.spi.yml index da14fbf11a..44586d6e2b 100644 --- a/.spi.yml +++ b/.spi.yml @@ -16,6 +16,7 @@ builder: - GitHubRestAPICodes_Of_Conduct - GitHubRestAPICodespaces - GitHubRestAPICopilot + - GitHubRestAPICopilot_Spaces - GitHubRestAPICredentials - GitHubRestAPIDependabot - GitHubRestAPIDependency_Graph