// This file is auto-generated by @hey-api/openapi-ts

import type { CancelablePromise } from "./core/CancelablePromise"
import { OpenAPI } from "./core/OpenAPI"
import { request as __request } from "./core/request"
import type {
  ActionsBatchUpdatePositionsData,
  ActionsBatchUpdatePositionsResponse,
  ActionsCreateActionData,
  ActionsCreateActionResponse,
  ActionsDeleteActionData,
  ActionsDeleteActionResponse,
  ActionsGetActionData,
  ActionsGetActionResponse,
  ActionsListActionsData,
  ActionsListActionsResponse,
  ActionsUpdateActionData,
  ActionsUpdateActionResponse,
  AdminAgentListPlatformCatalogData,
  AdminAgentListPlatformCatalogResponse,
  AdminCreateOrganizationData,
  AdminCreateOrganizationDomainData,
  AdminCreateOrganizationDomainResponse,
  AdminCreateOrganizationInvitationData,
  AdminCreateOrganizationInvitationResponse,
  AdminCreateOrganizationResponse,
  AdminCreateTierData,
  AdminCreateTierResponse,
  AdminCreateUserData,
  AdminCreateUserResponse,
  AdminDeleteOrganizationData,
  AdminDeleteOrganizationDomainData,
  AdminDeleteOrganizationDomainResponse,
  AdminDeleteOrganizationResponse,
  AdminDeleteTierData,
  AdminDeleteTierResponse,
  AdminDemoteFromSuperuserData,
  AdminDemoteFromSuperuserResponse,
  AdminGetOrganizationData,
  AdminGetOrganizationInvitationTokenData,
  AdminGetOrganizationInvitationTokenResponse,
  AdminGetOrganizationResponse,
  AdminGetOrgTierData,
  AdminGetOrgTierResponse,
  AdminGetRegistrySettingsResponse,
  AdminGetTierData,
  AdminGetTierResponse,
  AdminGetUserData,
  AdminGetUserResponse,
  AdminListOrganizationDomainsData,
  AdminListOrganizationDomainsResponse,
  AdminListOrganizationInvitationsData,
  AdminListOrganizationInvitationsResponse,
  AdminListOrganizationsResponse,
  AdminListOrgRepositoriesData,
  AdminListOrgRepositoriesResponse,
  AdminListOrgRepositoryVersionsData,
  AdminListOrgRepositoryVersionsResponse,
  AdminListOrgTiersData,
  AdminListOrgTiersResponse,
  AdminListTiersData,
  AdminListTiersResponse,
  AdminListUsersResponse,
  AdminPromoteOrgRepositoryVersionData,
  AdminPromoteOrgRepositoryVersionResponse,
  AdminPromoteToSuperuserData,
  AdminPromoteToSuperuserResponse,
  AdminRegistryGetPlatformRepositoryData,
  AdminRegistryGetPlatformRepositoryResponse,
  AdminRegistryGetRegistryStatusResponse,
  AdminRegistryListPlatformRepositoriesResponse,
  AdminRegistryListRegistryVersionsData,
  AdminRegistryListRegistryVersionsResponse,
  AdminRegistryPromoteRegistryVersionData,
  AdminRegistryPromoteRegistryVersionResponse,
  AdminRegistryStartRegistryArtifactsBackfillData,
  AdminRegistryStartRegistryArtifactsBackfillResponse,
  AdminRegistrySyncAllRepositoriesData,
  AdminRegistrySyncAllRepositoriesResponse,
  AdminRegistrySyncRepositoryData,
  AdminRegistrySyncRepositoryResponse,
  AdminRevokeOrganizationInvitationData,
  AdminRevokeOrganizationInvitationResponse,
  AdminSyncOrgRepositoryData,
  AdminSyncOrgRepositoryResponse,
  AdminUpdateOrganizationData,
  AdminUpdateOrganizationDomainData,
  AdminUpdateOrganizationDomainResponse,
  AdminUpdateOrganizationResponse,
  AdminUpdateOrgTierData,
  AdminUpdateOrgTierResponse,
  AdminUpdateRegistrySettingsData,
  AdminUpdateRegistrySettingsResponse,
  AdminUpdateTierData,
  AdminUpdateTierResponse,
  AgentChannelsCreateChannelTokenData,
  AgentChannelsCreateChannelTokenResponse,
  AgentChannelsDeleteChannelTokenData,
  AgentChannelsDeleteChannelTokenResponse,
  AgentChannelsListChannelTokensData,
  AgentChannelsListChannelTokensResponse,
  AgentChannelsRotateChannelTokenData,
  AgentChannelsRotateChannelTokenResponse,
  AgentChannelsStartSlackOauthData,
  AgentChannelsStartSlackOauthResponse,
  AgentChannelsUpdateChannelTokenData,
  AgentChannelsUpdateChannelTokenResponse,
  AgentCreateProviderCredentialsData,
  AgentCreateProviderCredentialsResponse,
  AgentDeleteProviderCredentialsData,
  AgentDeleteProviderCredentialsResponse,
  AgentFoldersCreateFolderData,
  AgentFoldersCreateFolderResponse,
  AgentFoldersDeleteFolderData,
  AgentFoldersDeleteFolderResponse,
  AgentFoldersGetDirectoryData,
  AgentFoldersGetDirectoryResponse,
  AgentFoldersGetFolderData,
  AgentFoldersGetFolderResponse,
  AgentFoldersListFoldersData,
  AgentFoldersListFoldersResponse,
  AgentFoldersMoveFolderData,
  AgentFoldersMoveFolderResponse,
  AgentFoldersUpdateFolderData,
  AgentFoldersUpdateFolderResponse,
  AgentGetDefaultModelResponse,
  AgentGetDefaultModelSelectionResponse,
  AgentGetProviderCredentialConfigData,
  AgentGetProviderCredentialConfigResponse,
  AgentGetProvidersStatusResponse,
  AgentGetWorkspaceProvidersStatusData,
  AgentGetWorkspaceProvidersStatusResponse,
  AgentListModelsResponse,
  AgentListProviderCredentialConfigsResponse,
  AgentListProvidersResponse,
  AgentPresetsAddPresetTagData,
  AgentPresetsAddPresetTagResponse,
  AgentPresetsCompareAgentPresetVersionsData,
  AgentPresetsCompareAgentPresetVersionsResponse,
  AgentPresetsCreateAgentPresetData,
  AgentPresetsCreateAgentPresetResponse,
  AgentPresetsDeleteAgentPresetData,
  AgentPresetsDeleteAgentPresetResponse,
  AgentPresetsGetAgentPresetBySlugData,
  AgentPresetsGetAgentPresetBySlugResponse,
  AgentPresetsGetAgentPresetData,
  AgentPresetsGetAgentPresetResponse,
  AgentPresetsGetAgentPresetVersionData,
  AgentPresetsGetAgentPresetVersionResponse,
  AgentPresetsListAgentPresetsData,
  AgentPresetsListAgentPresetsResponse,
  AgentPresetsListAgentPresetVersionsData,
  AgentPresetsListAgentPresetVersionsResponse,
  AgentPresetsListPresetTagsData,
  AgentPresetsListPresetTagsResponse,
  AgentPresetsMoveAgentPresetToFolderData,
  AgentPresetsMoveAgentPresetToFolderResponse,
  AgentPresetsRemovePresetTagData,
  AgentPresetsRemovePresetTagResponse,
  AgentPresetsRestoreAgentPresetVersionData,
  AgentPresetsRestoreAgentPresetVersionResponse,
  AgentPresetsUpdateAgentPresetData,
  AgentPresetsUpdateAgentPresetResponse,
  AgentSessionsCreateSessionData,
  AgentSessionsCreateSessionResponse,
  AgentSessionsDeleteSessionData,
  AgentSessionsDeleteSessionResponse,
  AgentSessionsForkSessionData,
  AgentSessionsForkSessionResponse,
  AgentSessionsGetSessionData,
  AgentSessionsGetSessionResponse,
  AgentSessionsGetSessionVercelData,
  AgentSessionsGetSessionVercelResponse,
  AgentSessionsListSessionsData,
  AgentSessionsListSessionsResponse,
  AgentSessionsSendMessageData,
  AgentSessionsSendMessageResponse,
  AgentSessionsStreamSessionEventsData,
  AgentSessionsStreamSessionEventsResponse,
  AgentSessionsUpdateSessionData,
  AgentSessionsUpdateSessionResponse,
  AgentSetDefaultModelData,
  AgentSetDefaultModelResponse,
  AgentSetDefaultModelSelectionData,
  AgentSetDefaultModelSelectionResponse,
  AgentSkillsArchiveSkillData,
  AgentSkillsArchiveSkillResponse,
  AgentSkillsCreateSkillData,
  AgentSkillsCreateSkillDraftUploadData,
  AgentSkillsCreateSkillDraftUploadResponse,
  AgentSkillsCreateSkillResponse,
  AgentSkillsGetSkillData,
  AgentSkillsGetSkillDraftData,
  AgentSkillsGetSkillDraftFileData,
  AgentSkillsGetSkillDraftFileResponse,
  AgentSkillsGetSkillDraftResponse,
  AgentSkillsGetSkillResponse,
  AgentSkillsGetSkillVersionData,
  AgentSkillsGetSkillVersionFileData,
  AgentSkillsGetSkillVersionFileResponse,
  AgentSkillsGetSkillVersionResponse,
  AgentSkillsListSkillsData,
  AgentSkillsListSkillsResponse,
  AgentSkillsListSkillVersionsData,
  AgentSkillsListSkillVersionsResponse,
  AgentSkillsPatchSkillDraftData,
  AgentSkillsPatchSkillDraftResponse,
  AgentSkillsPublishSkillData,
  AgentSkillsPublishSkillResponse,
  AgentSkillsRestoreSkillVersionData,
  AgentSkillsRestoreSkillVersionResponse,
  AgentSkillsUploadSkillData,
  AgentSkillsUploadSkillResponse,
  AgentTagsCreateAgentTagData,
  AgentTagsCreateAgentTagResponse,
  AgentTagsDeleteAgentTagData,
  AgentTagsDeleteAgentTagResponse,
  AgentTagsGetAgentTagData,
  AgentTagsGetAgentTagResponse,
  AgentTagsListAgentTagsData,
  AgentTagsListAgentTagsResponse,
  AgentTagsUpdateAgentTagData,
  AgentTagsUpdateAgentTagResponse,
  AgentUpdateProviderCredentialsData,
  AgentUpdateProviderCredentialsResponse,
  ApprovalsDeleteApprovalData,
  ApprovalsDeleteApprovalResponse,
  ApprovalsSubmitApprovalsData,
  ApprovalsSubmitApprovalsResponse,
  AuthAuthDatabaseLoginData,
  AuthAuthDatabaseLoginResponse,
  AuthAuthDatabaseLogoutResponse,
  AuthDiscoverAuthMethodData,
  AuthDiscoverAuthMethodResponse,
  AuthOauthOidcDatabaseAuthorizeData,
  AuthOauthOidcDatabaseAuthorizeResponse,
  AuthOauthOidcDatabaseCallbackData,
  AuthOauthOidcDatabaseCallbackResponse,
  AuthRegisterRegisterData,
  AuthRegisterRegisterResponse,
  AuthResetForgotPasswordData,
  AuthResetForgotPasswordResponse,
  AuthResetResetPasswordData,
  AuthResetResetPasswordResponse,
  AuthSamlDatabaseLoginResponse,
  AuthSsoAcsData,
  AuthSsoAcsResponse,
  AuthVerifyRequestTokenData,
  AuthVerifyRequestTokenResponse,
  AuthVerifyVerifyData,
  AuthVerifyVerifyResponse,
  CaseAttachmentsCreateAttachmentData,
  CaseAttachmentsCreateAttachmentResponse,
  CaseAttachmentsDeleteAttachmentData,
  CaseAttachmentsDeleteAttachmentResponse,
  CaseAttachmentsDownloadAttachmentData,
  CaseAttachmentsDownloadAttachmentResponse,
  CaseAttachmentsListAttachmentsData,
  CaseAttachmentsListAttachmentsResponse,
  CaseDropdownsAddDropdownOptionData,
  CaseDropdownsAddDropdownOptionResponse,
  CaseDropdownsCreateDropdownDefinitionData,
  CaseDropdownsCreateDropdownDefinitionResponse,
  CaseDropdownsDeleteDropdownDefinitionData,
  CaseDropdownsDeleteDropdownDefinitionResponse,
  CaseDropdownsDeleteDropdownOptionData,
  CaseDropdownsDeleteDropdownOptionResponse,
  CaseDropdownsGetDropdownDefinitionData,
  CaseDropdownsGetDropdownDefinitionResponse,
  CaseDropdownsListDropdownDefinitionsData,
  CaseDropdownsListDropdownDefinitionsResponse,
  CaseDropdownsReorderDropdownOptionsData,
  CaseDropdownsReorderDropdownOptionsResponse,
  CaseDropdownsUpdateDropdownDefinitionData,
  CaseDropdownsUpdateDropdownDefinitionResponse,
  CaseDropdownsUpdateDropdownOptionData,
  CaseDropdownsUpdateDropdownOptionResponse,
  CaseDurationsCreateCaseDurationData,
  CaseDurationsCreateCaseDurationDefinitionData,
  CaseDurationsCreateCaseDurationDefinitionResponse,
  CaseDurationsCreateCaseDurationResponse,
  CaseDurationsDeleteCaseDurationData,
  CaseDurationsDeleteCaseDurationDefinitionData,
  CaseDurationsDeleteCaseDurationDefinitionResponse,
  CaseDurationsDeleteCaseDurationResponse,
  CaseDurationsGetCaseDurationData,
  CaseDurationsGetCaseDurationDefinitionData,
  CaseDurationsGetCaseDurationDefinitionResponse,
  CaseDurationsGetCaseDurationResponse,
  CaseDurationsListCaseDurationDefinitionsData,
  CaseDurationsListCaseDurationDefinitionsResponse,
  CaseDurationsListCaseDurationsData,
  CaseDurationsListCaseDurationsResponse,
  CaseDurationsUpdateCaseDurationData,
  CaseDurationsUpdateCaseDurationDefinitionData,
  CaseDurationsUpdateCaseDurationDefinitionResponse,
  CaseDurationsUpdateCaseDurationResponse,
  CasesAddTagData,
  CasesAddTagResponse,
  CasesCreateCaseData,
  CasesCreateCaseResponse,
  CasesCreateCommentData,
  CasesCreateCommentResponse,
  CasesCreateFieldData,
  CasesCreateFieldResponse,
  CasesCreateTaskData,
  CasesCreateTaskResponse,
  CasesDeleteCaseData,
  CasesDeleteCaseResponse,
  CasesDeleteCommentData,
  CasesDeleteCommentResponse,
  CasesDeleteFieldData,
  CasesDeleteFieldResponse,
  CasesDeleteTaskData,
  CasesDeleteTaskResponse,
  CasesGetCaseData,
  CasesGetCaseResponse,
  CasesInsertCaseRowData,
  CasesInsertCaseRowResponse,
  CasesLinkCaseRowData,
  CasesLinkCaseRowResponse,
  CasesListCaseDropdownValuesData,
  CasesListCaseDropdownValuesResponse,
  CasesListCaseRowsData,
  CasesListCaseRowsResponse,
  CasesListCasesData,
  CasesListCasesResponse,
  CasesListCommentsData,
  CasesListCommentsResponse,
  CasesListCommentThreadsData,
  CasesListCommentThreadsResponse,
  CasesListEventsWithUsersData,
  CasesListEventsWithUsersResponse,
  CasesListFieldsData,
  CasesListFieldsResponse,
  CasesListTagsData,
  CasesListTagsResponse,
  CasesListTasksData,
  CasesListTasksResponse,
  CasesRemoveTagData,
  CasesRemoveTagResponse,
  CasesSearchCaseAggregatesData,
  CasesSearchCaseAggregatesResponse,
  CasesSearchCasesData,
  CasesSearchCasesResponse,
  CasesSetCaseDropdownValueData,
  CasesSetCaseDropdownValueResponse,
  CasesUnlinkCaseRowData,
  CasesUnlinkCaseRowResponse,
  CasesUpdateCaseData,
  CasesUpdateCaseResponse,
  CasesUpdateCommentData,
  CasesUpdateCommentResponse,
  CasesUpdateFieldData,
  CasesUpdateFieldResponse,
  CasesUpdateTaskData,
  CasesUpdateTaskResponse,
  CaseTagsCreateCaseTagData,
  CaseTagsCreateCaseTagResponse,
  CaseTagsDeleteCaseTagData,
  CaseTagsDeleteCaseTagResponse,
  CaseTagsGetCaseTagData,
  CaseTagsGetCaseTagResponse,
  CaseTagsListCaseTagsData,
  CaseTagsListCaseTagsResponse,
  CaseTagsUpdateCaseTagData,
  CaseTagsUpdateCaseTagResponse,
  CreateCatalogEntryData,
  CreateCatalogEntryResponse,
  CreateCustomProviderData,
  CreateCustomProviderResponse,
  DeleteCatalogEntryData,
  DeleteCatalogEntryResponse,
  DeleteCustomProviderData,
  DeleteCustomProviderResponse,
  DisableModelData,
  DisableModelResponse,
  EditorFieldSchemaData,
  EditorFieldSchemaResponse,
  EditorListActionsData,
  EditorListActionsResponse,
  EditorListFunctionsData,
  EditorListFunctionsResponse,
  EditorValidateExpressionData,
  EditorValidateExpressionResponse,
  EnableModelData,
  EnableModelResponse,
  FeatureFlagsGetFeatureFlagsResponse,
  FoldersCreateFolderData,
  FoldersCreateFolderResponse,
  FoldersDeleteFolderData,
  FoldersDeleteFolderResponse,
  FoldersGetDirectoryData,
  FoldersGetDirectoryResponse,
  FoldersGetFolderData,
  FoldersGetFolderResponse,
  FoldersListFoldersData,
  FoldersListFoldersResponse,
  FoldersMoveFolderData,
  FoldersMoveFolderResponse,
  FoldersUpdateFolderData,
  FoldersUpdateFolderResponse,
  GetCatalogEntryData,
  GetCatalogEntryResponse,
  GetCustomProviderData,
  GetCustomProviderResponse,
  GetWorkspaceModelsData,
  GetWorkspaceModelsResponse,
  GraphApplyGraphOperationsData,
  GraphApplyGraphOperationsResponse,
  GraphGetGraphData,
  GraphGetGraphResponse,
  InboxGetPendingCountData,
  InboxGetPendingCountResponse,
  InboxListItemsData,
  InboxListItemsResponse,
  IntegrationsConnectProviderData,
  IntegrationsConnectProviderResponse,
  IntegrationsDeleteIntegrationData,
  IntegrationsDeleteIntegrationResponse,
  IntegrationsDisconnectIntegrationData,
  IntegrationsDisconnectIntegrationResponse,
  IntegrationsGetIntegrationData,
  IntegrationsGetIntegrationResponse,
  IntegrationsListIntegrationsData,
  IntegrationsListIntegrationsResponse,
  IntegrationsOauthCallbackData,
  IntegrationsOauthCallbackResponse,
  IntegrationsTestConnectionData,
  IntegrationsTestConnectionResponse,
  IntegrationsUpdateIntegrationData,
  IntegrationsUpdateIntegrationResponse,
  ListCatalogData,
  ListCatalogResponse,
  ListCustomProvidersData,
  ListCustomProvidersResponse,
  ListEnabledModelsData,
  ListEnabledModelsResponse,
  McpIntegrationsCreateMcpIntegrationData,
  McpIntegrationsCreateMcpIntegrationResponse,
  McpIntegrationsDeleteMcpIntegrationData,
  McpIntegrationsDeleteMcpIntegrationResponse,
  McpIntegrationsGetMcpIntegrationData,
  McpIntegrationsGetMcpIntegrationResponse,
  McpIntegrationsListMcpIntegrationsData,
  McpIntegrationsListMcpIntegrationsResponse,
  McpIntegrationsUpdateMcpIntegrationData,
  McpIntegrationsUpdateMcpIntegrationResponse,
  McpPersonalAccessTokensCreateMcpPersonalAccessTokenData,
  McpPersonalAccessTokensCreateMcpPersonalAccessTokenResponse,
  McpPersonalAccessTokensListMcpPersonalAccessTokensData,
  McpPersonalAccessTokensListMcpPersonalAccessTokensResponse,
  McpPersonalAccessTokensRevokeMcpPersonalAccessTokenData,
  McpPersonalAccessTokensRevokeMcpPersonalAccessTokenResponse,
  OrganizationAcceptInvitationData,
  OrganizationAcceptInvitationResponse,
  OrganizationCreateInvitationData,
  OrganizationCreateInvitationResponse,
  OrganizationDeleteOrganizationData,
  OrganizationDeleteOrganizationResponse,
  OrganizationDeleteOrgMemberData,
  OrganizationDeleteOrgMemberResponse,
  OrganizationDeleteSessionData,
  OrganizationDeleteSessionResponse,
  OrganizationGetCurrentOrgMemberResponse,
  OrganizationGetInvitationByTokenData,
  OrganizationGetInvitationByTokenResponse,
  OrganizationGetInvitationTokenData,
  OrganizationGetInvitationTokenResponse,
  OrganizationGetOrganizationEntitlementsResponse,
  OrganizationGetOrganizationResponse,
  OrganizationListInvitationsData,
  OrganizationListInvitationsResponse,
  OrganizationListMyPendingInvitationsResponse,
  OrganizationListOrganizationDomainsResponse,
  OrganizationListOrgMembersResponse,
  OrganizationListSessionsResponse,
  OrganizationRevokeInvitationData,
  OrganizationRevokeInvitationResponse,
  OrganizationSecretsCreateOrgSecretData,
  OrganizationSecretsCreateOrgSecretResponse,
  OrganizationSecretsDeleteOrgSecretByIdData,
  OrganizationSecretsDeleteOrgSecretByIdResponse,
  OrganizationSecretsGetOrgSecretByNameData,
  OrganizationSecretsGetOrgSecretByNameResponse,
  OrganizationSecretsListOrgSecretsData,
  OrganizationSecretsListOrgSecretsResponse,
  OrganizationSecretsUpdateOrgSecretByIdData,
  OrganizationSecretsUpdateOrgSecretByIdResponse,
  OrganizationUpdateOrgMemberData,
  OrganizationUpdateOrgMemberResponse,
  ProvidersCreateCustomProviderData,
  ProvidersCreateCustomProviderResponse,
  ProvidersGetProviderData,
  ProvidersGetProviderResponse,
  ProvidersListProvidersData,
  ProvidersListProvidersResponse,
  PublicCheckHealthResponse,
  PublicCheckReadyResponse,
  PublicHandleChannelEventData,
  PublicHandleChannelEventResponse,
  PublicHandleSlackOauthCallbackData,
  PublicHandleSlackOauthCallbackResponse,
  PublicIncomingWebhookDraftData,
  PublicIncomingWebhookDraftResponse,
  PublicIncomingWebhookGetData,
  PublicIncomingWebhookGetResponse,
  PublicIncomingWebhookPostData,
  PublicIncomingWebhookPostResponse,
  PublicIncomingWebhookWaitData,
  PublicIncomingWebhookWaitResponse,
  PublicReceiveInteractionData,
  PublicReceiveInteractionResponse,
  RbacAddGroupMemberData,
  RbacAddGroupMemberResponse,
  RbacCreateAssignmentData,
  RbacCreateAssignmentResponse,
  RbacCreateGroupData,
  RbacCreateGroupResponse,
  RbacCreateRoleData,
  RbacCreateRoleResponse,
  RbacCreateScopeData,
  RbacCreateScopeResponse,
  RbacCreateUserAssignmentData,
  RbacCreateUserAssignmentResponse,
  RbacDeleteAssignmentData,
  RbacDeleteAssignmentResponse,
  RbacDeleteGroupData,
  RbacDeleteGroupResponse,
  RbacDeleteRoleData,
  RbacDeleteRoleResponse,
  RbacDeleteScopeData,
  RbacDeleteScopeResponse,
  RbacDeleteUserAssignmentData,
  RbacDeleteUserAssignmentResponse,
  RbacGetAssignmentData,
  RbacGetAssignmentResponse,
  RbacGetGroupData,
  RbacGetGroupResponse,
  RbacGetRoleData,
  RbacGetRoleResponse,
  RbacGetScopeData,
  RbacGetScopeResponse,
  RbacGetUserAssignmentData,
  RbacGetUserAssignmentResponse,
  RbacListAssignmentsData,
  RbacListAssignmentsResponse,
  RbacListGroupsResponse,
  RbacListRolesResponse,
  RbacListScopesData,
  RbacListScopesResponse,
  RbacListUserAssignmentsData,
  RbacListUserAssignmentsResponse,
  RbacRemoveGroupMemberData,
  RbacRemoveGroupMemberResponse,
  RbacUpdateAssignmentData,
  RbacUpdateAssignmentResponse,
  RbacUpdateGroupData,
  RbacUpdateGroupResponse,
  RbacUpdateRoleData,
  RbacUpdateRoleResponse,
  RbacUpdateUserAssignmentData,
  RbacUpdateUserAssignmentResponse,
  RefreshCustomProviderCatalogData,
  RefreshCustomProviderCatalogResponse,
  RegistryActionsGetRegistryActionData,
  RegistryActionsGetRegistryActionResponse,
  RegistryActionsListRegistryActionsData,
  RegistryActionsListRegistryActionsResponse,
  RegistryRepositoriesCompareRegistryVersionsData,
  RegistryRepositoriesCompareRegistryVersionsResponse,
  RegistryRepositoriesCreateRegistryRepositoryData,
  RegistryRepositoriesCreateRegistryRepositoryResponse,
  RegistryRepositoriesDeleteRegistryRepositoryData,
  RegistryRepositoriesDeleteRegistryRepositoryResponse,
  RegistryRepositoriesDeleteRegistryVersionData,
  RegistryRepositoriesDeleteRegistryVersionResponse,
  RegistryRepositoriesGetPreviousRegistryVersionData,
  RegistryRepositoriesGetPreviousRegistryVersionResponse,
  RegistryRepositoriesGetRegistryRepositoryData,
  RegistryRepositoriesGetRegistryRepositoryResponse,
  RegistryRepositoriesListRegistryRepositoriesResponse,
  RegistryRepositoriesListRepositoryCommitsData,
  RegistryRepositoriesListRepositoryCommitsResponse,
  RegistryRepositoriesListRepositoryVersionsData,
  RegistryRepositoriesListRepositoryVersionsResponse,
  RegistryRepositoriesPromoteRegistryVersionData,
  RegistryRepositoriesPromoteRegistryVersionResponse,
  RegistryRepositoriesSyncRegistryRepositoryData,
  RegistryRepositoriesSyncRegistryRepositoryResponse,
  RegistryRepositoriesUpdateRegistryRepositoryData,
  RegistryRepositoriesUpdateRegistryRepositoryResponse,
  SchedulesCreateScheduleData,
  SchedulesCreateScheduleResponse,
  SchedulesDeleteScheduleData,
  SchedulesDeleteScheduleResponse,
  SchedulesGetScheduleData,
  SchedulesGetScheduleResponse,
  SchedulesListSchedulesData,
  SchedulesListSchedulesResponse,
  SchedulesSearchSchedulesData,
  SchedulesSearchSchedulesResponse,
  SchedulesUpdateScheduleData,
  SchedulesUpdateScheduleResponse,
  SecretsCreateSecretData,
  SecretsCreateSecretResponse,
  SecretsDeleteSecretByIdData,
  SecretsDeleteSecretByIdResponse,
  SecretsGetAwsAssumeRoleAccessData,
  SecretsGetAwsAssumeRoleAccessResponse,
  SecretsGetSecretByNameData,
  SecretsGetSecretByNameResponse,
  SecretsListSecretDefinitionsData,
  SecretsListSecretDefinitionsResponse,
  SecretsListSecretsData,
  SecretsListSecretsResponse,
  SecretsSearchSecretsData,
  SecretsSearchSecretsResponse,
  SecretsUpdateSecretByIdData,
  SecretsUpdateSecretByIdResponse,
  ServiceAccountsCreateOrganizationServiceAccountApiKeyData,
  ServiceAccountsCreateOrganizationServiceAccountApiKeyResponse,
  ServiceAccountsCreateOrganizationServiceAccountData,
  ServiceAccountsCreateOrganizationServiceAccountResponse,
  ServiceAccountsCreateWorkspaceServiceAccountApiKeyData,
  ServiceAccountsCreateWorkspaceServiceAccountApiKeyResponse,
  ServiceAccountsCreateWorkspaceServiceAccountData,
  ServiceAccountsCreateWorkspaceServiceAccountResponse,
  ServiceAccountsDisableOrganizationServiceAccountData,
  ServiceAccountsDisableOrganizationServiceAccountResponse,
  ServiceAccountsDisableWorkspaceServiceAccountData,
  ServiceAccountsDisableWorkspaceServiceAccountResponse,
  ServiceAccountsEnableOrganizationServiceAccountData,
  ServiceAccountsEnableOrganizationServiceAccountResponse,
  ServiceAccountsEnableWorkspaceServiceAccountData,
  ServiceAccountsEnableWorkspaceServiceAccountResponse,
  ServiceAccountsGetOrganizationServiceAccountData,
  ServiceAccountsGetOrganizationServiceAccountResponse,
  ServiceAccountsGetWorkspaceServiceAccountData,
  ServiceAccountsGetWorkspaceServiceAccountResponse,
  ServiceAccountsListOrganizationServiceAccountApiKeysData,
  ServiceAccountsListOrganizationServiceAccountApiKeysResponse,
  ServiceAccountsListOrganizationServiceAccountScopesResponse,
  ServiceAccountsListOrganizationServiceAccountsData,
  ServiceAccountsListOrganizationServiceAccountsResponse,
  ServiceAccountsListWorkspaceServiceAccountApiKeysData,
  ServiceAccountsListWorkspaceServiceAccountApiKeysResponse,
  ServiceAccountsListWorkspaceServiceAccountScopesData,
  ServiceAccountsListWorkspaceServiceAccountScopesResponse,
  ServiceAccountsListWorkspaceServiceAccountsData,
  ServiceAccountsListWorkspaceServiceAccountsResponse,
  ServiceAccountsRevokeOrganizationServiceAccountApiKeyData,
  ServiceAccountsRevokeOrganizationServiceAccountApiKeyResponse,
  ServiceAccountsRevokeWorkspaceServiceAccountApiKeyData,
  ServiceAccountsRevokeWorkspaceServiceAccountApiKeyResponse,
  ServiceAccountsUpdateOrganizationServiceAccountData,
  ServiceAccountsUpdateOrganizationServiceAccountResponse,
  ServiceAccountsUpdateWorkspaceServiceAccountData,
  ServiceAccountsUpdateWorkspaceServiceAccountResponse,
  SettingsGetAgentSettingsResponse,
  SettingsGetAppSettingsResponse,
  SettingsGetAuditSettingsResponse,
  SettingsGetGitSettingsResponse,
  SettingsGetSamlSettingsResponse,
  SettingsUpdateAgentSettingsData,
  SettingsUpdateAgentSettingsResponse,
  SettingsUpdateAppSettingsData,
  SettingsUpdateAppSettingsResponse,
  SettingsUpdateAuditSettingsData,
  SettingsUpdateAuditSettingsResponse,
  SettingsUpdateGitSettingsData,
  SettingsUpdateGitSettingsResponse,
  SettingsUpdateSamlSettingsData,
  SettingsUpdateSamlSettingsResponse,
  TablesBatchDeleteRowsData,
  TablesBatchDeleteRowsResponse,
  TablesBatchInsertRowsData,
  TablesBatchInsertRowsResponse,
  TablesBatchUpdateRowsData,
  TablesBatchUpdateRowsResponse,
  TablesCreateColumnData,
  TablesCreateColumnResponse,
  TablesCreateTableData,
  TablesCreateTableResponse,
  TablesDeleteColumnData,
  TablesDeleteColumnResponse,
  TablesDeleteRowData,
  TablesDeleteRowResponse,
  TablesDeleteTableData,
  TablesDeleteTableResponse,
  TablesGetRowData,
  TablesGetRowResponse,
  TablesGetTableData,
  TablesGetTableResponse,
  TablesImportCsvData,
  TablesImportCsvResponse,
  TablesImportTableFromCsvData,
  TablesImportTableFromCsvResponse,
  TablesInsertRowData,
  TablesInsertRowResponse,
  TablesListRowsData,
  TablesListRowsResponse,
  TablesListTablesData,
  TablesListTablesResponse,
  TablesUpdateColumnData,
  TablesUpdateColumnResponse,
  TablesUpdateRowData,
  TablesUpdateRowResponse,
  TablesUpdateTableData,
  TablesUpdateTableResponse,
  TagsCreateTagData,
  TagsCreateTagResponse,
  TagsDeleteTagData,
  TagsDeleteTagResponse,
  TagsGetTagData,
  TagsGetTagResponse,
  TagsListTagsData,
  TagsListTagsResponse,
  TagsUpdateTagData,
  TagsUpdateTagResponse,
  TriggersCreateCaseTriggerData,
  TriggersCreateCaseTriggerResponse,
  TriggersCreateWebhookData,
  TriggersCreateWebhookResponse,
  TriggersDeleteWebhookApiKeyData,
  TriggersDeleteWebhookApiKeyResponse,
  TriggersGenerateWebhookApiKeyData,
  TriggersGenerateWebhookApiKeyResponse,
  TriggersGetCaseTriggerData,
  TriggersGetCaseTriggerResponse,
  TriggersGetWebhookData,
  TriggersGetWebhookResponse,
  TriggersRevokeWebhookApiKeyData,
  TriggersRevokeWebhookApiKeyResponse,
  TriggersUpdateCaseTriggerData,
  TriggersUpdateCaseTriggerResponse,
  TriggersUpdateWebhookData,
  TriggersUpdateWebhookResponse,
  UpdateCatalogEntryData,
  UpdateCatalogEntryResponse,
  UpdateCustomProviderData,
  UpdateCustomProviderResponse,
  UsersGetMyScopesData,
  UsersGetMyScopesResponse,
  UsersSearchUserData,
  UsersSearchUserResponse,
  UsersUsersCurrentUserResponse,
  UsersUsersDeleteUserData,
  UsersUsersDeleteUserResponse,
  UsersUsersPatchCurrentUserData,
  UsersUsersPatchCurrentUserResponse,
  UsersUsersPatchUserData,
  UsersUsersPatchUserResponse,
  UsersUsersUserData,
  UsersUsersUserResponse,
  ValidateCustomProviderConnectionData,
  ValidateCustomProviderConnectionResponse,
  VariablesCreateVariableData,
  VariablesCreateVariableResponse,
  VariablesDeleteVariableByIdData,
  VariablesDeleteVariableByIdResponse,
  VariablesGetVariableByNameData,
  VariablesGetVariableByNameResponse,
  VariablesListVariablesData,
  VariablesListVariablesResponse,
  VariablesSearchVariablesData,
  VariablesSearchVariablesResponse,
  VariablesUpdateVariableByIdData,
  VariablesUpdateVariableByIdResponse,
  VcsDeleteGithubAppCredentialsResponse,
  VcsGetGithubAppCredentialsStatusResponse,
  VcsGetGithubAppManifestResponse,
  VcsGithubAppInstallCallbackData,
  VcsGithubAppInstallCallbackResponse,
  VcsGithubWebhookData,
  VcsGithubWebhookResponse,
  VcsSaveGithubAppCredentialsData,
  VcsSaveGithubAppCredentialsResponse,
  WatchtowerDisableWatchtowerAgentData,
  WatchtowerDisableWatchtowerAgentResponse,
  WatchtowerEnableWatchtowerAgentData,
  WatchtowerEnableWatchtowerAgentResponse,
  WatchtowerListWatchtowerAgentSessionsData,
  WatchtowerListWatchtowerAgentSessionsResponse,
  WatchtowerListWatchtowerAgentsData,
  WatchtowerListWatchtowerAgentsResponse,
  WatchtowerListWatchtowerSessionToolCallsData,
  WatchtowerListWatchtowerSessionToolCallsResponse,
  WatchtowerRevokeWatchtowerSessionData,
  WatchtowerRevokeWatchtowerSessionResponse,
  WorkflowExecutionsBulkResetWorkflowExecutionsData,
  WorkflowExecutionsBulkResetWorkflowExecutionsResponse,
  WorkflowExecutionsCancelWorkflowExecutionData,
  WorkflowExecutionsCancelWorkflowExecutionResponse,
  WorkflowExecutionsCreateDraftWorkflowExecutionData,
  WorkflowExecutionsCreateDraftWorkflowExecutionResponse,
  WorkflowExecutionsCreateWorkflowExecutionData,
  WorkflowExecutionsCreateWorkflowExecutionResponse,
  WorkflowExecutionsGetWorkflowExecutionByWorkflowIdData,
  WorkflowExecutionsGetWorkflowExecutionByWorkflowIdResponse,
  WorkflowExecutionsGetWorkflowExecutionCollectionPageData,
  WorkflowExecutionsGetWorkflowExecutionCollectionPageResponse,
  WorkflowExecutionsGetWorkflowExecutionCompactData,
  WorkflowExecutionsGetWorkflowExecutionCompactResponse,
  WorkflowExecutionsGetWorkflowExecutionData,
  WorkflowExecutionsGetWorkflowExecutionObjectDownloadData,
  WorkflowExecutionsGetWorkflowExecutionObjectDownloadResponse,
  WorkflowExecutionsGetWorkflowExecutionObjectPreviewData,
  WorkflowExecutionsGetWorkflowExecutionObjectPreviewResponse,
  WorkflowExecutionsGetWorkflowExecutionResponse,
  WorkflowExecutionsListWorkflowExecutionResetPointsData,
  WorkflowExecutionsListWorkflowExecutionResetPointsResponse,
  WorkflowExecutionsListWorkflowExecutionsData,
  WorkflowExecutionsListWorkflowExecutionsResponse,
  WorkflowExecutionsResetWorkflowExecutionData,
  WorkflowExecutionsResetWorkflowExecutionResponse,
  WorkflowExecutionsSearchWorkflowExecutionsData,
  WorkflowExecutionsSearchWorkflowExecutionsResponse,
  WorkflowExecutionsTerminateWorkflowExecutionData,
  WorkflowExecutionsTerminateWorkflowExecutionResponse,
  WorkflowsAddTagData,
  WorkflowsAddTagResponse,
  WorkflowsCommitWorkflowData,
  WorkflowsCommitWorkflowResponse,
  WorkflowsCreateWorkflowData,
  WorkflowsCreateWorkflowDefinitionData,
  WorkflowsCreateWorkflowDefinitionResponse,
  WorkflowsCreateWorkflowResponse,
  WorkflowsDeleteWorkflowData,
  WorkflowsDeleteWorkflowResponse,
  WorkflowsExportWorkflowData,
  WorkflowsExportWorkflowResponse,
  WorkflowsGetWorkflowData,
  WorkflowsGetWorkflowDefinitionData,
  WorkflowsGetWorkflowDefinitionResponse,
  WorkflowsGetWorkflowResponse,
  WorkflowsListTagsData,
  WorkflowsListTagsResponse,
  WorkflowsListWorkflowBranchesData,
  WorkflowsListWorkflowBranchesResponse,
  WorkflowsListWorkflowCommitsData,
  WorkflowsListWorkflowCommitsResponse,
  WorkflowsListWorkflowDefinitionsData,
  WorkflowsListWorkflowDefinitionsResponse,
  WorkflowsListWorkflowsData,
  WorkflowsListWorkflowsResponse,
  WorkflowsMoveWorkflowToFolderData,
  WorkflowsMoveWorkflowToFolderResponse,
  WorkflowsPublishWorkflowData,
  WorkflowsPublishWorkflowResponse,
  WorkflowsPullWorkflowsData,
  WorkflowsPullWorkflowsResponse,
  WorkflowsRemoveTagData,
  WorkflowsRemoveTagResponse,
  WorkflowsRestoreWorkflowDefinitionData,
  WorkflowsRestoreWorkflowDefinitionResponse,
  WorkflowsUpdateWorkflowData,
  WorkflowsUpdateWorkflowResponse,
  WorkflowsValidateWorkflowEntrypointData,
  WorkflowsValidateWorkflowEntrypointResponse,
  WorkspacesCreateWorkspaceData,
  WorkspacesCreateWorkspaceInvitationData,
  WorkspacesCreateWorkspaceInvitationResponse,
  WorkspacesCreateWorkspaceMembershipData,
  WorkspacesCreateWorkspaceMembershipResponse,
  WorkspacesCreateWorkspaceResponse,
  WorkspacesDeleteWorkspaceData,
  WorkspacesDeleteWorkspaceMembershipData,
  WorkspacesDeleteWorkspaceMembershipResponse,
  WorkspacesDeleteWorkspaceResponse,
  WorkspacesGetWorkspaceData,
  WorkspacesGetWorkspaceMembershipData,
  WorkspacesGetWorkspaceMembershipResponse,
  WorkspacesGetWorkspaceResponse,
  WorkspacesListWorkspaceInvitationsData,
  WorkspacesListWorkspaceInvitationsResponse,
  WorkspacesListWorkspaceMembersData,
  WorkspacesListWorkspaceMembershipsData,
  WorkspacesListWorkspaceMembershipsResponse,
  WorkspacesListWorkspaceMembersResponse,
  WorkspacesListWorkspacesResponse,
  WorkspacesRevokeWorkspaceInvitationData,
  WorkspacesRevokeWorkspaceInvitationResponse,
  WorkspacesSearchWorkspacesData,
  WorkspacesSearchWorkspacesResponse,
  WorkspacesUpdateWorkspaceData,
  WorkspacesUpdateWorkspaceResponse,
} from "./types.gen"

/**
 * Incoming Webhook Post
 * Webhook endpoint to trigger a workflow.
 *
 * This is an external facing endpoint is used to trigger a workflow by sending a webhook request.
 * The workflow is identified by the `path` parameter, which is equivalent to the workflow id.
 * @param data The data for the request.
 * @param data.secret
 * @param data.workflowId
 * @param data.echo Echo back to the caller
 * @param data.emptyEcho Return an empty response. Assumes `echo` to be `True`.
 * @param data.vendor Vendor specific webhook verification. Supported vendors: `okta`.
 * @param data.contentType
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const publicIncomingWebhookPost = (
  data: PublicIncomingWebhookPostData
): CancelablePromise<PublicIncomingWebhookPostResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/webhooks/{workflow_id}/{secret}",
    path: {
      secret: data.secret,
      workflow_id: data.workflowId,
    },
    headers: {
      "content-type": data.contentType,
    },
    query: {
      echo: data.echo,
      empty_echo: data.emptyEcho,
      vendor: data.vendor,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Incoming Webhook Get
 * Webhook endpoint to trigger a workflow.
 *
 * This is an external facing endpoint is used to trigger a workflow by sending a webhook request.
 * The workflow is identified by the `path` parameter, which is equivalent to the workflow id.
 * @param data The data for the request.
 * @param data.secret
 * @param data.workflowId
 * @param data.echo Echo back to the caller
 * @param data.emptyEcho Return an empty response. Assumes `echo` to be `True`.
 * @param data.vendor Vendor specific webhook verification. Supported vendors: `okta`.
 * @param data.contentType
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const publicIncomingWebhookGet = (
  data: PublicIncomingWebhookGetData
): CancelablePromise<PublicIncomingWebhookGetResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/webhooks/{workflow_id}/{secret}",
    path: {
      secret: data.secret,
      workflow_id: data.workflowId,
    },
    headers: {
      "content-type": data.contentType,
    },
    query: {
      echo: data.echo,
      empty_echo: data.emptyEcho,
      vendor: data.vendor,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Incoming Webhook Wait
 * Webhook endpoint to trigger a workflow.
 *
 * This is an external facing endpoint is used to trigger a workflow by sending a webhook request.
 * The workflow is identified by the `path` parameter, which is equivalent to the workflow id.
 * @param data The data for the request.
 * @param data.secret
 * @param data.workflowId
 * @param data.unwrap Return the workflow result directly as the response body, without the `{kind, value}` envelope. Requires the result to fit inline. If the result was externalized, returns 413 with the download envelope in `detail`.
 * @param data.contentType
 * @returns WaitResultOutput Successful Response
 * @throws ApiError
 */
export const publicIncomingWebhookWait = (
  data: PublicIncomingWebhookWaitData
): CancelablePromise<PublicIncomingWebhookWaitResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/webhooks/{workflow_id}/{secret}/wait",
    path: {
      secret: data.secret,
      workflow_id: data.workflowId,
    },
    headers: {
      "content-type": data.contentType,
    },
    query: {
      unwrap: data.unwrap,
    },
    errors: {
      413: "Unwrapped workflow result exceeded inline response limits. Use `detail.download_url` to fetch the externalized result.",
      422: "Validation Error",
    },
  })
}

/**
 * Incoming Webhook Draft
 * Draft webhook endpoint to trigger a workflow execution using the draft workflow graph.
 *
 * This endpoint runs the current (uncommitted) workflow graph rather than the committed definition.
 * Child workflows using aliases will resolve to the latest draft aliases, not committed aliases.
 * @param data The data for the request.
 * @param data.secret
 * @param data.workflowId
 * @param data.contentType
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const publicIncomingWebhookDraft = (
  data: PublicIncomingWebhookDraftData
): CancelablePromise<PublicIncomingWebhookDraftResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/webhooks/{workflow_id}/{secret}/draft",
    path: {
      secret: data.secret,
      workflow_id: data.workflowId,
    },
    headers: {
      "content-type": data.contentType,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Receive Interaction
 * Process incoming workflow interactions from external services.
 *
 * Args:
 * workflow_id: ID of the workflow to interact with
 * payload: Raw interaction payload from the external service
 * category: Category of interaction (e.g., slack)
 *
 * Returns:
 * Response confirming the interaction was processed
 *
 * Raises:
 * HTTPException: If payload is invalid or workflow interaction fails
 * @param data The data for the request.
 * @param data.category
 * @param data.secret
 * @param data.workflowId
 * @param data.contentType
 * @returns ReceiveInteractionResponse Successful Response
 * @throws ApiError
 */
export const publicReceiveInteraction = (
  data: PublicReceiveInteractionData
): CancelablePromise<PublicReceiveInteractionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/webhooks/{workflow_id}/{secret}/interactions/{category}",
    path: {
      category: data.category,
      secret: data.secret,
      workflow_id: data.workflowId,
    },
    headers: {
      "content-type": data.contentType,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Handle Channel Event
 * Receive public external channel events.
 * @param data The data for the request.
 * @param data.channelType
 * @param data.token
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const publicHandleChannelEvent = (
  data: PublicHandleChannelEventData
): CancelablePromise<PublicHandleChannelEventResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/agent/channels/{channel_type}/{token}",
    path: {
      channel_type: data.channelType,
      token: data.token,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Handle Slack Oauth Callback
 * @param data The data for the request.
 * @param data.state
 * @param data.code
 * @param data.error
 * @param data.errorDescription
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const publicHandleSlackOauthCallback = (
  data: PublicHandleSlackOauthCallbackData
): CancelablePromise<PublicHandleSlackOauthCallbackResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/agent/channels/slack/oauth/callback",
    query: {
      code: data.code,
      state: data.state,
      error: data.error,
      error_description: data.errorDescription,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workspaces
 * List workspaces the user has access to.
 *
 * Access
 * ------
 * - Org owners/admins (have `org:workspace:read` scope): See all workspaces in the org.
 * - Org members (have `org:read` scope): See only workspaces where they are a member.
 * - Workspace-bound service accounts: See only their bound workspace.
 *
 * Membership limits workspace-scoped access to the actor's workspaces.
 * @returns WorkspaceReadMinimal Successful Response
 * @throws ApiError
 */
export const workspacesListWorkspaces =
  (): CancelablePromise<WorkspacesListWorkspacesResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/workspaces",
    })
  }

/**
 * Create Workspace
 * Create a new workspace.
 *
 * Authorization
 * -------------
 * - Admin: Can create a workspace for any user.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns WorkspaceReadMinimal Successful Response
 * @throws ApiError
 */
export const workspacesCreateWorkspace = (
  data: WorkspacesCreateWorkspaceData
): CancelablePromise<WorkspacesCreateWorkspaceResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Search Workspaces
 * Return Workflow as title, description, list of Action JSONs, adjacency list of Action IDs.
 * @param data The data for the request.
 * @param data.name
 * @returns WorkspaceReadMinimal Successful Response
 * @throws ApiError
 */
export const workspacesSearchWorkspaces = (
  data: WorkspacesSearchWorkspacesData = {}
): CancelablePromise<WorkspacesSearchWorkspacesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/search",
    query: {
      name: data.name,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workspace
 * Return Workflow as title, description, list of Action JSONs, adjacency list of Action IDs.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns WorkspaceRead Successful Response
 * @throws ApiError
 */
export const workspacesGetWorkspace = (
  data: WorkspacesGetWorkspaceData
): CancelablePromise<WorkspacesGetWorkspaceResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Workspace
 * Update a workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const workspacesUpdateWorkspace = (
  data: WorkspacesUpdateWorkspaceData
): CancelablePromise<WorkspacesUpdateWorkspaceResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Workspace
 * Delete a workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const workspacesDeleteWorkspace = (
  data: WorkspacesDeleteWorkspaceData
): CancelablePromise<WorkspacesDeleteWorkspaceResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workspace Members
 * List members of a workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns WorkspaceMember Successful Response
 * @throws ApiError
 */
export const workspacesListWorkspaceMembers = (
  data: WorkspacesListWorkspaceMembersData
): CancelablePromise<WorkspacesListWorkspaceMembersResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/members",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workspace Memberships
 * List memberships of a workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns WorkspaceMembershipRead Successful Response
 * @throws ApiError
 */
export const workspacesListWorkspaceMemberships = (
  data: WorkspacesListWorkspaceMembershipsData
): CancelablePromise<WorkspacesListWorkspaceMembershipsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/memberships",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Workspace Membership
 * Create a workspace membership for a user.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const workspacesCreateWorkspaceMembership = (
  data: WorkspacesCreateWorkspaceMembershipData
): CancelablePromise<WorkspacesCreateWorkspaceMembershipResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/memberships",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workspace Membership
 * Get a workspace membership for a user.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.userId
 * @returns WorkspaceMembershipRead Successful Response
 * @throws ApiError
 */
export const workspacesGetWorkspaceMembership = (
  data: WorkspacesGetWorkspaceMembershipData
): CancelablePromise<WorkspacesGetWorkspaceMembershipResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/memberships/{user_id}",
    path: {
      workspace_id: data.workspaceId,
      user_id: data.userId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Workspace Membership
 * Delete a workspace membership.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.userId
 * @returns void Successful Response
 * @throws ApiError
 */
export const workspacesDeleteWorkspaceMembership = (
  data: WorkspacesDeleteWorkspaceMembershipData
): CancelablePromise<WorkspacesDeleteWorkspaceMembershipResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/memberships/{user_id}",
    path: {
      workspace_id: data.workspaceId,
      user_id: data.userId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Workspace Invitation
 * Create a workspace invitation.
 *
 * Authorization
 * -------------
 * - Workspace Admin: Can create invitations for their workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns WorkspaceInvitationRead Successful Response
 * @throws ApiError
 */
export const workspacesCreateWorkspaceInvitation = (
  data: WorkspacesCreateWorkspaceInvitationData
): CancelablePromise<WorkspacesCreateWorkspaceInvitationResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/invitations",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workspace Invitations
 * List workspace invitations.
 *
 * Authorization
 * -------------
 * - Workspace Admin: Can list invitations for their workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.status
 * @returns WorkspaceInvitationRead Successful Response
 * @throws ApiError
 */
export const workspacesListWorkspaceInvitations = (
  data: WorkspacesListWorkspaceInvitationsData
): CancelablePromise<WorkspacesListWorkspaceInvitationsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/invitations",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      status: data.status,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Revoke Workspace Invitation
 * Revoke a workspace invitation.
 *
 * Authorization
 * -------------
 * - Workspace Admin: Can revoke invitations for their workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.invitationId
 * @returns void Successful Response
 * @throws ApiError
 */
export const workspacesRevokeWorkspaceInvitation = (
  data: WorkspacesRevokeWorkspaceInvitationData
): CancelablePromise<WorkspacesRevokeWorkspaceInvitationResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/invitations/{invitation_id}",
    path: {
      workspace_id: data.workspaceId,
      invitation_id: data.invitationId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workspace Service Accounts
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_ServiceAccountRead_ Successful Response
 * @throws ApiError
 */
export const serviceAccountsListWorkspaceServiceAccounts = (
  data: ServiceAccountsListWorkspaceServiceAccountsData
): CancelablePromise<ServiceAccountsListWorkspaceServiceAccountsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/service-accounts",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Workspace Service Account
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns ServiceAccountApiKeyIssueResponse Successful Response
 * @throws ApiError
 */
export const serviceAccountsCreateWorkspaceServiceAccount = (
  data: ServiceAccountsCreateWorkspaceServiceAccountData
): CancelablePromise<ServiceAccountsCreateWorkspaceServiceAccountResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/service-accounts",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workspace Service Account Scopes
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns ServiceAccountScopeList Successful Response
 * @throws ApiError
 */
export const serviceAccountsListWorkspaceServiceAccountScopes = (
  data: ServiceAccountsListWorkspaceServiceAccountScopesData
): CancelablePromise<ServiceAccountsListWorkspaceServiceAccountScopesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/service-accounts/scopes",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workspace Service Account
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @param data.workspaceId
 * @returns ServiceAccountRead Successful Response
 * @throws ApiError
 */
export const serviceAccountsGetWorkspaceServiceAccount = (
  data: ServiceAccountsGetWorkspaceServiceAccountData
): CancelablePromise<ServiceAccountsGetWorkspaceServiceAccountResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/service-accounts/{service_account_id}",
    path: {
      service_account_id: data.serviceAccountId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Workspace Service Account
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns ServiceAccountRead Successful Response
 * @throws ApiError
 */
export const serviceAccountsUpdateWorkspaceServiceAccount = (
  data: ServiceAccountsUpdateWorkspaceServiceAccountData
): CancelablePromise<ServiceAccountsUpdateWorkspaceServiceAccountResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/service-accounts/{service_account_id}",
    path: {
      service_account_id: data.serviceAccountId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workspace Service Account Api Keys
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @param data.workspaceId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_ServiceAccountApiKeyRead_ Successful Response
 * @throws ApiError
 */
export const serviceAccountsListWorkspaceServiceAccountApiKeys = (
  data: ServiceAccountsListWorkspaceServiceAccountApiKeysData
): CancelablePromise<ServiceAccountsListWorkspaceServiceAccountApiKeysResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/service-accounts/{service_account_id}/api-keys",
    path: {
      service_account_id: data.serviceAccountId,
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Workspace Service Account Api Key
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns ServiceAccountApiKeyIssueResponse Successful Response
 * @throws ApiError
 */
export const serviceAccountsCreateWorkspaceServiceAccountApiKey = (
  data: ServiceAccountsCreateWorkspaceServiceAccountApiKeyData
): CancelablePromise<ServiceAccountsCreateWorkspaceServiceAccountApiKeyResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/service-accounts/{service_account_id}/api-keys",
    path: {
      service_account_id: data.serviceAccountId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Disable Workspace Service Account
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const serviceAccountsDisableWorkspaceServiceAccount = (
  data: ServiceAccountsDisableWorkspaceServiceAccountData
): CancelablePromise<ServiceAccountsDisableWorkspaceServiceAccountResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/service-accounts/{service_account_id}/disable",
    path: {
      service_account_id: data.serviceAccountId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Enable Workspace Service Account
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const serviceAccountsEnableWorkspaceServiceAccount = (
  data: ServiceAccountsEnableWorkspaceServiceAccountData
): CancelablePromise<ServiceAccountsEnableWorkspaceServiceAccountResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/service-accounts/{service_account_id}/enable",
    path: {
      service_account_id: data.serviceAccountId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Revoke Workspace Service Account Api Key
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @param data.apiKeyId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const serviceAccountsRevokeWorkspaceServiceAccountApiKey = (
  data: ServiceAccountsRevokeWorkspaceServiceAccountApiKeyData
): CancelablePromise<ServiceAccountsRevokeWorkspaceServiceAccountApiKeyResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/service-accounts/{service_account_id}/api-keys/{api_key_id}/revoke",
    path: {
      service_account_id: data.serviceAccountId,
      api_key_id: data.apiKeyId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Mcp Personal Access Tokens
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_MCPPersonalAccessTokenRead_ Successful Response
 * @throws ApiError
 */
export const mcpPersonalAccessTokensListMcpPersonalAccessTokens = (
  data: McpPersonalAccessTokensListMcpPersonalAccessTokensData
): CancelablePromise<McpPersonalAccessTokensListMcpPersonalAccessTokensResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/mcp-personal-access-tokens",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Mcp Personal Access Token
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns MCPPersonalAccessTokenIssueResponse Successful Response
 * @throws ApiError
 */
export const mcpPersonalAccessTokensCreateMcpPersonalAccessToken = (
  data: McpPersonalAccessTokensCreateMcpPersonalAccessTokenData
): CancelablePromise<McpPersonalAccessTokensCreateMcpPersonalAccessTokenResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/mcp-personal-access-tokens",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Revoke Mcp Personal Access Token
 * @param data The data for the request.
 * @param data.tokenId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const mcpPersonalAccessTokensRevokeMcpPersonalAccessToken = (
  data: McpPersonalAccessTokensRevokeMcpPersonalAccessTokenData
): CancelablePromise<McpPersonalAccessTokensRevokeMcpPersonalAccessTokenResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/mcp-personal-access-tokens/{token_id}/revoke",
    path: {
      token_id: data.tokenId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workflows
 * List workflows.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.tag Filter workflows by tags
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_WorkflowReadMinimal_ Successful Response
 * @throws ApiError
 */
export const workflowsListWorkflows = (
  data: WorkflowsListWorkflowsData
): CancelablePromise<WorkflowsListWorkflowsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      tag: data.tag,
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Workflow
 * Create a new Workflow.
 *
 * Optionally, you can provide a YAML file to create a workflow.
 * You can also provide a title and description to create a blank workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.formData
 * @returns WorkflowReadMinimal Successful Response
 * @throws ApiError
 */
export const workflowsCreateWorkflow = (
  data: WorkflowsCreateWorkflowData
): CancelablePromise<WorkflowsCreateWorkflowResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows",
    path: {
      workspace_id: data.workspaceId,
    },
    formData: data.formData,
    mediaType: "multipart/form-data",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Validate Workflow Entrypoint
 * Validate a workflow entrypoint expects definition.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns WorkflowEntrypointValidationResponse Successful Response
 * @throws ApiError
 */
export const workflowsValidateWorkflowEntrypoint = (
  data: WorkflowsValidateWorkflowEntrypointData
): CancelablePromise<WorkflowsValidateWorkflowEntrypointResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/validate-entrypoint",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workflow
 * Return Workflow as title, description, list of Action JSONs, adjacency list of Action IDs.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns WorkflowRead Successful Response
 * @throws ApiError
 */
export const workflowsGetWorkflow = (
  data: WorkflowsGetWorkflowData
): CancelablePromise<WorkflowsGetWorkflowResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Workflow
 * Update a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const workflowsUpdateWorkflow = (
  data: WorkflowsUpdateWorkflowData
): CancelablePromise<WorkflowsUpdateWorkflowResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Workflow
 * Delete a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns void Successful Response
 * @throws ApiError
 */
export const workflowsDeleteWorkflow = (
  data: WorkflowsDeleteWorkflowData
): CancelablePromise<WorkflowsDeleteWorkflowResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Commit Workflow
 * Commit a workflow.
 *
 * This deploys the workflow and updates its version. If a YAML file is provided, it will override the workflow in the database.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns WorkflowCommitResponse Successful Response
 * @throws ApiError
 */
export const workflowsCommitWorkflow = (
  data: WorkflowsCommitWorkflowData
): CancelablePromise<WorkflowsCommitWorkflowResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/commit",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Export Workflow
 * Export a workflow's current state and optionally its definitions and logs.
 *
 * Supported formats are JSON and YAML.
 *
 * When `draft=True`, exports the current draft state from the workflow canvas
 * without requiring a saved definition. When `draft=False` (default), exports
 * from a saved workflow definition version.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.format Export format: 'json' or 'yaml'
 * @param data.version Workflow definition version. If not provided, the latest version is exported.
 * @param data.draft Export current draft state instead of saved definition.
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const workflowsExportWorkflow = (
  data: WorkflowsExportWorkflowData
): CancelablePromise<WorkflowsExportWorkflowResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/export",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    query: {
      format: data.format,
      version: data.version,
      draft: data.draft,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workflow Definitions
 * List all workflow definitions for a Workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns WorkflowDefinitionRead Successful Response
 * @throws ApiError
 */
export const workflowsListWorkflowDefinitions = (
  data: WorkflowsListWorkflowDefinitionsData
): CancelablePromise<WorkflowsListWorkflowDefinitionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/definitions",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Restore Workflow Definition
 * Restore a saved workflow definition as the current published version.
 * @param data The data for the request.
 * @param data.version
 * @param data.workspaceId
 * @param data.workflowId
 * @returns WorkflowRead Successful Response
 * @throws ApiError
 */
export const workflowsRestoreWorkflowDefinition = (
  data: WorkflowsRestoreWorkflowDefinitionData
): CancelablePromise<WorkflowsRestoreWorkflowDefinitionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/definitions/{version}/restore",
    path: {
      version: data.version,
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workflow Definition
 * Get the latest version of a workflow definition.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.version
 * @returns WorkflowDefinitionRead Successful Response
 * @throws ApiError
 */
export const workflowsGetWorkflowDefinition = (
  data: WorkflowsGetWorkflowDefinitionData
): CancelablePromise<WorkflowsGetWorkflowDefinitionResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/definition",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    query: {
      version: data.version,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Workflow Definition
 * Get the latest version of a workflow definition.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns WorkflowDefinitionRead Successful Response
 * @throws ApiError
 */
export const workflowsCreateWorkflowDefinition = (
  data: WorkflowsCreateWorkflowDefinitionData
): CancelablePromise<WorkflowsCreateWorkflowDefinitionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/definition",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Webhook
 * Create a webhook for a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const triggersCreateWebhook = (
  data: TriggersCreateWebhookData
): CancelablePromise<TriggersCreateWebhookResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/webhook",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Webhook
 * Get the webhook from a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns WebhookRead Successful Response
 * @throws ApiError
 */
export const triggersGetWebhook = (
  data: TriggersGetWebhookData
): CancelablePromise<TriggersGetWebhookResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/webhook",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Webhook
 * Update the webhook for a workflow. We currently supprt only one webhook per workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const triggersUpdateWebhook = (
  data: TriggersUpdateWebhookData
): CancelablePromise<TriggersUpdateWebhookResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/webhook",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Case Trigger
 * Create or replace the case trigger configuration for a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.requestBody
 * @returns CaseTriggerRead Successful Response
 * @throws ApiError
 */
export const triggersCreateCaseTrigger = (
  data: TriggersCreateCaseTriggerData
): CancelablePromise<TriggersCreateCaseTriggerResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/case-trigger",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Case Trigger
 * Get the case trigger configuration for a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns CaseTriggerRead Successful Response
 * @throws ApiError
 */
export const triggersGetCaseTrigger = (
  data: TriggersGetCaseTriggerData
): CancelablePromise<TriggersGetCaseTriggerResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/case-trigger",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Case Trigger
 * Update the case trigger configuration for a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const triggersUpdateCaseTrigger = (
  data: TriggersUpdateCaseTriggerData
): CancelablePromise<TriggersUpdateCaseTriggerResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/case-trigger",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Generate Webhook Api Key
 * Create or rotate the API key for a webhook.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns WebhookApiKeyGenerateResponse Successful Response
 * @throws ApiError
 */
export const triggersGenerateWebhookApiKey = (
  data: TriggersGenerateWebhookApiKeyData
): CancelablePromise<TriggersGenerateWebhookApiKeyResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/webhook/api-key",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Webhook Api Key
 * Delete the current API key for a webhook.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns void Successful Response
 * @throws ApiError
 */
export const triggersDeleteWebhookApiKey = (
  data: TriggersDeleteWebhookApiKeyData
): CancelablePromise<TriggersDeleteWebhookApiKeyResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/webhook/api-key",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Revoke Webhook Api Key
 * Revoke the current API key for a webhook.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns void Successful Response
 * @throws ApiError
 */
export const triggersRevokeWebhookApiKey = (
  data: TriggersRevokeWebhookApiKeyData
): CancelablePromise<TriggersRevokeWebhookApiKeyResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/webhook/api-key/revoke",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Move Workflow To Folder
 * Move a workflow to a different folder.
 *
 * If folder_id is null, the workflow will be moved to the root (no folder).
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const workflowsMoveWorkflowToFolder = (
  data: WorkflowsMoveWorkflowToFolderData
): CancelablePromise<WorkflowsMoveWorkflowToFolderResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/move",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workflow Execution By Workflow Id
 * Get a workflow execution by workflow ID and execution suffix.
 * @param data The data for the request.
 * @param data.executionId
 * @param data.workspaceId
 * @param data.workflowId
 * @returns WorkflowExecutionRead Successful Response
 * @throws ApiError
 */
export const workflowExecutionsGetWorkflowExecutionByWorkflowId = (
  data: WorkflowExecutionsGetWorkflowExecutionByWorkflowIdData
): CancelablePromise<WorkflowExecutionsGetWorkflowExecutionByWorkflowIdResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/executions/{execution_id}",
    path: {
      execution_id: data.executionId,
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Graph
 * Get the canonical graph projection for a workflow.
 *
 * Returns the graph built from Actions (single source of truth),
 * not from Workflow.object.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns GraphResponse Successful Response
 * @throws ApiError
 */
export const graphGetGraph = (
  data: GraphGetGraphData
): CancelablePromise<GraphGetGraphResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/graph",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Apply Graph Operations
 * Apply graph operations with optimistic concurrency.
 *
 * Validates base_version matches current graph_version.
 * Returns 409 Conflict with latest graph if versions mismatch.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.requestBody
 * @returns GraphResponse Successful Response
 * @throws ApiError
 */
export const graphApplyGraphOperations = (
  data: GraphApplyGraphOperationsData
): CancelablePromise<GraphApplyGraphOperationsResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/graph",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workflow Executions
 * List all workflow executions.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.trigger
 * @param data.limit
 * @param data.workflowId
 * @param data.userId
 * @returns WorkflowExecutionReadMinimal Successful Response
 * @throws ApiError
 */
export const workflowExecutionsListWorkflowExecutions = (
  data: WorkflowExecutionsListWorkflowExecutionsData
): CancelablePromise<WorkflowExecutionsListWorkflowExecutionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflow-executions",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      trigger: data.trigger,
      limit: data.limit,
      workflow_id: data.workflowId,
      user_id: data.userId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Workflow Execution
 * Create and schedule a workflow execution.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns WorkflowExecutionCreateResponse Successful Response
 * @throws ApiError
 */
export const workflowExecutionsCreateWorkflowExecution = (
  data: WorkflowExecutionsCreateWorkflowExecutionData
): CancelablePromise<WorkflowExecutionsCreateWorkflowExecutionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflow-executions",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Search Workflow Executions
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.trigger
 * @param data.status
 * @param data.statusMode
 * @param data.startTimeFrom
 * @param data.startTimeTo
 * @param data.closeTimeFrom
 * @param data.closeTimeTo
 * @param data.durationGteSeconds
 * @param data.durationLteSeconds
 * @param data.searchTerm Filter by workflow title or alias.
 * @param data.relation
 * @param data.workflowId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @param data.userId
 * @returns CursorPaginatedResponse_WorkflowRunReadMinimal_ Successful Response
 * @throws ApiError
 */
export const workflowExecutionsSearchWorkflowExecutions = (
  data: WorkflowExecutionsSearchWorkflowExecutionsData
): CancelablePromise<WorkflowExecutionsSearchWorkflowExecutionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflow-executions/search",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      trigger: data.trigger,
      status: data.status,
      status_mode: data.statusMode,
      start_time_from: data.startTimeFrom,
      start_time_to: data.startTimeTo,
      close_time_from: data.closeTimeFrom,
      close_time_to: data.closeTimeTo,
      duration_gte_seconds: data.durationGteSeconds,
      duration_lte_seconds: data.durationLteSeconds,
      search_term: data.searchTerm,
      relation: data.relation,
      workflow_id: data.workflowId,
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
      user_id: data.userId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workflow Execution Reset Points
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.executionId
 * @param data.limit
 * @returns WorkflowExecutionResetPointRead Successful Response
 * @throws ApiError
 */
export const workflowExecutionsListWorkflowExecutionResetPoints = (
  data: WorkflowExecutionsListWorkflowExecutionResetPointsData
): CancelablePromise<WorkflowExecutionsListWorkflowExecutionResetPointsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflow-executions/{execution_id}/reset-points",
    path: {
      workspace_id: data.workspaceId,
      execution_id: data.executionId,
    },
    query: {
      limit: data.limit,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Reset Workflow Execution
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.executionId
 * @param data.requestBody
 * @returns WorkflowExecutionResetResponse Successful Response
 * @throws ApiError
 */
export const workflowExecutionsResetWorkflowExecution = (
  data: WorkflowExecutionsResetWorkflowExecutionData
): CancelablePromise<WorkflowExecutionsResetWorkflowExecutionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflow-executions/{execution_id}/reset",
    path: {
      workspace_id: data.workspaceId,
      execution_id: data.executionId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Bulk Reset Workflow Executions
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns WorkflowExecutionBulkResetResponse Successful Response
 * @throws ApiError
 */
export const workflowExecutionsBulkResetWorkflowExecutions = (
  data: WorkflowExecutionsBulkResetWorkflowExecutionsData
): CancelablePromise<WorkflowExecutionsBulkResetWorkflowExecutionsResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflow-executions/reset/bulk",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workflow Execution
 * Get a workflow execution.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.executionId
 * @returns WorkflowExecutionRead Successful Response
 * @throws ApiError
 */
export const workflowExecutionsGetWorkflowExecution = (
  data: WorkflowExecutionsGetWorkflowExecutionData
): CancelablePromise<WorkflowExecutionsGetWorkflowExecutionResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflow-executions/{execution_id}",
    path: {
      workspace_id: data.workspaceId,
      execution_id: data.executionId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workflow Execution Compact
 * Get a workflow execution.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.executionId
 * @returns WorkflowExecutionReadCompact_Any__Union_AgentOutput__Any___Any_ Successful Response
 * @throws ApiError
 */
export const workflowExecutionsGetWorkflowExecutionCompact = (
  data: WorkflowExecutionsGetWorkflowExecutionCompactData
): CancelablePromise<WorkflowExecutionsGetWorkflowExecutionCompactResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflow-executions/{execution_id}/compact",
    path: {
      workspace_id: data.workspaceId,
      execution_id: data.executionId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workflow Execution Object Download
 * Generate a presigned download URL for a workflow execution result object.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.executionId
 * @param data.requestBody
 * @returns WorkflowExecutionObjectDownloadResponse Successful Response
 * @throws ApiError
 */
export const workflowExecutionsGetWorkflowExecutionObjectDownload = (
  data: WorkflowExecutionsGetWorkflowExecutionObjectDownloadData
): CancelablePromise<WorkflowExecutionsGetWorkflowExecutionObjectDownloadResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflow-executions/{execution_id}/objects/download",
    path: {
      workspace_id: data.workspaceId,
      execution_id: data.executionId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workflow Execution Object Preview
 * Fetch a bounded text preview for a workflow execution result object.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.executionId
 * @param data.requestBody
 * @returns WorkflowExecutionObjectPreviewResponse Successful Response
 * @throws ApiError
 */
export const workflowExecutionsGetWorkflowExecutionObjectPreview = (
  data: WorkflowExecutionsGetWorkflowExecutionObjectPreviewData
): CancelablePromise<WorkflowExecutionsGetWorkflowExecutionObjectPreviewResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflow-executions/{execution_id}/objects/preview",
    path: {
      workspace_id: data.workspaceId,
      execution_id: data.executionId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workflow Execution Collection Page
 * Fetch a bounded page of collection item descriptors.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.executionId
 * @param data.requestBody
 * @returns WorkflowExecutionCollectionPageResponse Successful Response
 * @throws ApiError
 */
export const workflowExecutionsGetWorkflowExecutionCollectionPage = (
  data: WorkflowExecutionsGetWorkflowExecutionCollectionPageData
): CancelablePromise<WorkflowExecutionsGetWorkflowExecutionCollectionPageResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflow-executions/{execution_id}/objects/collection/page",
    path: {
      workspace_id: data.workspaceId,
      execution_id: data.executionId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Draft Workflow Execution
 * Create and schedule a draft workflow execution.
 *
 * Draft executions run the current draft workflow graph (not the committed definition).
 * Child workflows using aliases will resolve to the latest draft aliases, not committed aliases.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns WorkflowExecutionCreateResponse Successful Response
 * @throws ApiError
 */
export const workflowExecutionsCreateDraftWorkflowExecution = (
  data: WorkflowExecutionsCreateDraftWorkflowExecutionData
): CancelablePromise<WorkflowExecutionsCreateDraftWorkflowExecutionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflow-executions/draft",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Cancel Workflow Execution
 * Get a workflow execution.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.executionId
 * @returns void Successful Response
 * @throws ApiError
 */
export const workflowExecutionsCancelWorkflowExecution = (
  data: WorkflowExecutionsCancelWorkflowExecutionData
): CancelablePromise<WorkflowExecutionsCancelWorkflowExecutionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflow-executions/{execution_id}/cancel",
    path: {
      workspace_id: data.workspaceId,
      execution_id: data.executionId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Terminate Workflow Execution
 * Get a workflow execution.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.executionId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const workflowExecutionsTerminateWorkflowExecution = (
  data: WorkflowExecutionsTerminateWorkflowExecutionData
): CancelablePromise<WorkflowExecutionsTerminateWorkflowExecutionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflow-executions/{execution_id}/terminate",
    path: {
      workspace_id: data.workspaceId,
      execution_id: data.executionId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Batch Update Positions
 * Batch update action and trigger positions.
 *
 * This endpoint updates all positions in a single transaction for atomicity,
 * preventing race conditions from concurrent position updates.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const actionsBatchUpdatePositions = (
  data: ActionsBatchUpdatePositionsData
): CancelablePromise<ActionsBatchUpdatePositionsResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/actions/batch-positions",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      workflow_id: data.workflowId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Actions
 * List all actions for a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns ActionReadMinimal Successful Response
 * @throws ApiError
 */
export const actionsListActions = (
  data: ActionsListActionsData
): CancelablePromise<ActionsListActionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/actions",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Action
 * Create a new action for a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns ActionReadMinimal Successful Response
 * @throws ApiError
 */
export const actionsCreateAction = (
  data: ActionsCreateActionData
): CancelablePromise<ActionsCreateActionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/actions",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Action
 * Get an action.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.actionId
 * @param data.workflowId
 * @returns ActionRead Successful Response
 * @throws ApiError
 */
export const actionsGetAction = (
  data: ActionsGetActionData
): CancelablePromise<ActionsGetActionResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/actions/{action_id}",
    path: {
      workspace_id: data.workspaceId,
      action_id: data.actionId,
    },
    query: {
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Action
 * Update an action.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.actionId
 * @param data.workflowId
 * @param data.requestBody
 * @returns ActionRead Successful Response
 * @throws ApiError
 */
export const actionsUpdateAction = (
  data: ActionsUpdateActionData
): CancelablePromise<ActionsUpdateActionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/actions/{action_id}",
    path: {
      workspace_id: data.workspaceId,
      action_id: data.actionId,
    },
    query: {
      workflow_id: data.workflowId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Action
 * Delete an action.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.actionId
 * @param data.workflowId
 * @returns void Successful Response
 * @throws ApiError
 */
export const actionsDeleteAction = (
  data: ActionsDeleteActionData
): CancelablePromise<ActionsDeleteActionResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/actions/{action_id}",
    path: {
      workspace_id: data.workspaceId,
      action_id: data.actionId,
    },
    query: {
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Tags
 * List all tags for a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns TagRead Successful Response
 * @throws ApiError
 */
export const workflowsListTags = (
  data: WorkflowsListTagsData
): CancelablePromise<WorkflowsListTagsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/tags",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Add Tag
 * Add a tag to a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const workflowsAddTag = (
  data: WorkflowsAddTagData
): CancelablePromise<WorkflowsAddTagResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/tags",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Remove Tag
 * @param data The data for the request.
 * @param data.tagId
 * @param data.workspaceId
 * @param data.workflowId
 * @returns void Successful Response
 * @throws ApiError
 */
export const workflowsRemoveTag = (
  data: WorkflowsRemoveTagData
): CancelablePromise<WorkflowsRemoveTagResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/tags/{tag_id}",
    path: {
      tag_id: data.tagId,
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Publish Workflow
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @param data.requestBody
 * @returns WorkflowDslPublishResult Successful Response
 * @throws ApiError
 */
export const workflowsPublishWorkflow = (
  data: WorkflowsPublishWorkflowData
): CancelablePromise<WorkflowsPublishWorkflowResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/{workflow_id}/publish",
    path: {
      workspace_id: data.workspaceId,
      workflow_id: data.workflowId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workflow Commits
 * Get commit list for workflow repository via GitHub App.
 *
 * Returns a list of commits from the repository configured in workspace settings,
 * suitable for use in workflow pull operations.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.branch Branch name to fetch commits from
 * @param data.limit Maximum number of commits to return
 * @returns GitCommitInfo Successful Response
 * @throws ApiError
 */
export const workflowsListWorkflowCommits = (
  data: WorkflowsListWorkflowCommitsData
): CancelablePromise<WorkflowsListWorkflowCommitsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows/sync/commits",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      branch: data.branch,
      limit: data.limit,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Workflow Branches
 * Get branch list for workflow repository via GitHub App.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.limit Maximum number of branches to return
 * @returns GitBranchInfo Successful Response
 * @throws ApiError
 */
export const workflowsListWorkflowBranches = (
  data: WorkflowsListWorkflowBranchesData
): CancelablePromise<WorkflowsListWorkflowBranchesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/workflows/sync/branches",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Pull Workflows
 * Pull workflows from Git repository at specific commit.
 *
 * Imports workflow definitions from the specified repository and commit,
 * with configurable conflict resolution strategy. Repository URL is retrieved
 * from workspace settings.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns PullResult Successful Response
 * @throws ApiError
 */
export const workflowsPullWorkflows = (
  data: WorkflowsPullWorkflowsData
): CancelablePromise<WorkflowsPullWorkflowsResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/workflows/sync/pull",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Search Secrets
 * Search secrets.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.environment
 * @param data.name Filter by secret name
 * @param data.id Filter by secret ID
 * @param data.type Filter by secret type
 * @returns SecretRead Successful Response
 * @throws ApiError
 */
export const secretsSearchSecrets = (
  data: SecretsSearchSecretsData
): CancelablePromise<SecretsSearchSecretsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/secrets/search",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      environment: data.environment,
      name: data.name,
      id: data.id,
      type: data.type,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Secrets
 * List user secrets.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.type Filter by secret type
 * @returns SecretReadMinimal Successful Response
 * @throws ApiError
 */
export const secretsListSecrets = (
  data: SecretsListSecretsData
): CancelablePromise<SecretsListSecretsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/secrets",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      type: data.type,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Secret
 * Create a secret.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const secretsCreateSecret = (
  data: SecretsCreateSecretData
): CancelablePromise<SecretsCreateSecretResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/secrets",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Secret Definitions
 * List aggregated secret definitions from the registry.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns SecretDefinition Successful Response
 * @throws ApiError
 */
export const secretsListSecretDefinitions = (
  data: SecretsListSecretDefinitionsData
): CancelablePromise<SecretsListSecretDefinitionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/secrets/definitions",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Aws Assume Role Access
 * Get workspace-scoped AWS AssumeRole details for credential setup.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns AwsAssumeRoleAccessRead Successful Response
 * @throws ApiError
 */
export const secretsGetAwsAssumeRoleAccess = (
  data: SecretsGetAwsAssumeRoleAccessData
): CancelablePromise<SecretsGetAwsAssumeRoleAccessResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/secrets/aws-assume-role",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Secret By Name
 * Get a secret.
 * @param data The data for the request.
 * @param data.secretName
 * @param data.workspaceId
 * @returns SecretRead Successful Response
 * @throws ApiError
 */
export const secretsGetSecretByName = (
  data: SecretsGetSecretByNameData
): CancelablePromise<SecretsGetSecretByNameResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/secrets/{secret_name}",
    path: {
      secret_name: data.secretName,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Secret By Id
 * Update a secret by ID.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.secretId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const secretsUpdateSecretById = (
  data: SecretsUpdateSecretByIdData
): CancelablePromise<SecretsUpdateSecretByIdResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/secrets/{secret_id}",
    path: {
      workspace_id: data.workspaceId,
      secret_id: data.secretId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Secret By Id
 * Delete a secret by ID.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.secretId
 * @returns void Successful Response
 * @throws ApiError
 */
export const secretsDeleteSecretById = (
  data: SecretsDeleteSecretByIdData
): CancelablePromise<SecretsDeleteSecretByIdResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/secrets/{secret_id}",
    path: {
      workspace_id: data.workspaceId,
      secret_id: data.secretId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Search Variables
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.environment
 * @param data.name Filter by variable name
 * @param data.id Filter by variable ID
 * @returns VariableRead Successful Response
 * @throws ApiError
 */
export const variablesSearchVariables = (
  data: VariablesSearchVariablesData
): CancelablePromise<VariablesSearchVariablesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/variables/search",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      environment: data.environment,
      name: data.name,
      id: data.id,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Variables
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.environment
 * @returns VariableReadMinimal Successful Response
 * @throws ApiError
 */
export const variablesListVariables = (
  data: VariablesListVariablesData
): CancelablePromise<VariablesListVariablesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/variables",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      environment: data.environment,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Variable
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns VariableRead Successful Response
 * @throws ApiError
 */
export const variablesCreateVariable = (
  data: VariablesCreateVariableData
): CancelablePromise<VariablesCreateVariableResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/variables",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Variable By Name
 * @param data The data for the request.
 * @param data.variableName
 * @param data.workspaceId
 * @param data.environment
 * @returns VariableRead Successful Response
 * @throws ApiError
 */
export const variablesGetVariableByName = (
  data: VariablesGetVariableByNameData
): CancelablePromise<VariablesGetVariableByNameResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/variables/{variable_name}",
    path: {
      variable_name: data.variableName,
      workspace_id: data.workspaceId,
    },
    query: {
      environment: data.environment,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Variable By Id
 * @param data The data for the request.
 * @param data.variableId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns VariableRead Successful Response
 * @throws ApiError
 */
export const variablesUpdateVariableById = (
  data: VariablesUpdateVariableByIdData
): CancelablePromise<VariablesUpdateVariableByIdResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/variables/{variable_id}",
    path: {
      variable_id: data.variableId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Variable By Id
 * @param data The data for the request.
 * @param data.variableId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const variablesDeleteVariableById = (
  data: VariablesDeleteVariableByIdData
): CancelablePromise<VariablesDeleteVariableByIdResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/variables/{variable_id}",
    path: {
      variable_id: data.variableId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Schedules
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns ScheduleRead Successful Response
 * @throws ApiError
 */
export const schedulesListSchedules = (
  data: SchedulesListSchedulesData
): CancelablePromise<SchedulesListSchedulesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/schedules",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Schedule
 * Create a schedule for a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns ScheduleRead Successful Response
 * @throws ApiError
 */
export const schedulesCreateSchedule = (
  data: SchedulesCreateScheduleData
): CancelablePromise<SchedulesCreateScheduleResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/schedules",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Schedule
 * Get a schedule from a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.scheduleId
 * @returns ScheduleRead Successful Response
 * @throws ApiError
 */
export const schedulesGetSchedule = (
  data: SchedulesGetScheduleData
): CancelablePromise<SchedulesGetScheduleResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/schedules/{schedule_id}",
    path: {
      workspace_id: data.workspaceId,
      schedule_id: data.scheduleId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Schedule
 * Update a schedule from a workflow. You cannot update the Workflow Definition, but you can update other fields.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.scheduleId
 * @param data.requestBody
 * @returns ScheduleRead Successful Response
 * @throws ApiError
 */
export const schedulesUpdateSchedule = (
  data: SchedulesUpdateScheduleData
): CancelablePromise<SchedulesUpdateScheduleResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/schedules/{schedule_id}",
    path: {
      workspace_id: data.workspaceId,
      schedule_id: data.scheduleId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Schedule
 * Delete a schedule from a workflow.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.scheduleId
 * @returns void Successful Response
 * @throws ApiError
 */
export const schedulesDeleteSchedule = (
  data: SchedulesDeleteScheduleData
): CancelablePromise<SchedulesDeleteScheduleResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/schedules/{schedule_id}",
    path: {
      workspace_id: data.workspaceId,
      schedule_id: data.scheduleId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Search Schedules
 * **[WORK IN PROGRESS]** Search for schedules.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns ScheduleRead Successful Response
 * @throws ApiError
 */
export const schedulesSearchSchedules = (
  data: SchedulesSearchSchedulesData
): CancelablePromise<SchedulesSearchSchedulesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/schedules/search",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Tags
 * List all tags for the current workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns TagRead Successful Response
 * @throws ApiError
 */
export const tagsListTags = (
  data: TagsListTagsData
): CancelablePromise<TagsListTagsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/tags",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Tag
 * Create a new tag.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns TagRead Successful Response
 * @throws ApiError
 */
export const tagsCreateTag = (
  data: TagsCreateTagData
): CancelablePromise<TagsCreateTagResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/tags",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Tag
 * Get a specific tag by ID.
 * @param data The data for the request.
 * @param data.tagId
 * @param data.workspaceId
 * @returns TagRead Successful Response
 * @throws ApiError
 */
export const tagsGetTag = (
  data: TagsGetTagData
): CancelablePromise<TagsGetTagResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/tags/{tag_id}",
    path: {
      tag_id: data.tagId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Tag
 * Update an existing tag.
 * @param data The data for the request.
 * @param data.tagId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns TagRead Successful Response
 * @throws ApiError
 */
export const tagsUpdateTag = (
  data: TagsUpdateTagData
): CancelablePromise<TagsUpdateTagResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/tags/{tag_id}",
    path: {
      tag_id: data.tagId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Tag
 * Delete a tag.
 * @param data The data for the request.
 * @param data.tagId
 * @param data.workspaceId
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const tagsDeleteTag = (
  data: TagsDeleteTagData
): CancelablePromise<TagsDeleteTagResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/tags/{tag_id}",
    path: {
      tag_id: data.tagId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Search User
 * Search for a user by email.
 * @param data The data for the request.
 * @param data.email
 * @param data.workspaceId
 * @returns UserRead Successful Response
 * @throws ApiError
 */
export const usersSearchUser = (
  data: UsersSearchUserData = {}
): CancelablePromise<UsersSearchUserResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/users/search",
    query: {
      email: data.email,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Organization
 * Get the current organization.
 *
 * Returns basic information about the organization the authenticated user belongs to.
 * @returns tracecat__organization__schemas__OrgRead Successful Response
 * @throws ApiError
 */
export const organizationGetOrganization =
  (): CancelablePromise<OrganizationGetOrganizationResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/organization",
    })
  }

/**
 * Delete Organization
 * Delete the current organization.
 *
 * Restricted to organization owners/admins through tenant RBAC.
 * @param data The data for the request.
 * @param data.confirm Must exactly match the organization name.
 * @returns void Successful Response
 * @throws ApiError
 */
export const organizationDeleteOrganization = (
  data: OrganizationDeleteOrganizationData = {}
): CancelablePromise<OrganizationDeleteOrganizationResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/organization",
    query: {
      confirm: data.confirm,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Organization Domains
 * List domains assigned to the current organization.
 * @returns tracecat__organization__schemas__OrgDomainRead Successful Response
 * @throws ApiError
 */
export const organizationListOrganizationDomains =
  (): CancelablePromise<OrganizationListOrganizationDomainsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/organization/domains",
    })
  }

/**
 * Get Organization Entitlements
 * Get the effective entitlements for the current organization.
 * @returns EffectiveEntitlements Successful Response
 * @throws ApiError
 */
export const organizationGetOrganizationEntitlements =
  (): CancelablePromise<OrganizationGetOrganizationEntitlementsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/organization/entitlements",
    })
  }

/**
 * Get Current Org Member
 * Get the current user's organization membership.
 *
 * Returns the organization membership details for the authenticated user,
 * including their org role (member, admin, or owner).
 *
 * This endpoint doesn't require admin access - any authenticated org member
 * can view their own membership details.
 * @returns OrgMemberDetail Successful Response
 * @throws ApiError
 */
export const organizationGetCurrentOrgMember =
  (): CancelablePromise<OrganizationGetCurrentOrgMemberResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/organization/members/me",
    })
  }

/**
 * List Org Members
 * @returns OrgMemberRead Successful Response
 * @throws ApiError
 */
export const organizationListOrgMembers =
  (): CancelablePromise<OrganizationListOrgMembersResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/organization/members",
    })
  }

/**
 * Delete Org Member
 * @param data The data for the request.
 * @param data.userId
 * @returns void Successful Response
 * @throws ApiError
 */
export const organizationDeleteOrgMember = (
  data: OrganizationDeleteOrgMemberData
): CancelablePromise<OrganizationDeleteOrgMemberResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/organization/members/{user_id}",
    path: {
      user_id: data.userId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Org Member
 * @param data The data for the request.
 * @param data.userId
 * @param data.requestBody
 * @returns OrgMemberDetail Successful Response
 * @throws ApiError
 */
export const organizationUpdateOrgMember = (
  data: OrganizationUpdateOrgMemberData
): CancelablePromise<OrganizationUpdateOrgMemberResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/organization/members/{user_id}",
    path: {
      user_id: data.userId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Sessions
 * @returns SessionRead Successful Response
 * @throws ApiError
 */
export const organizationListSessions =
  (): CancelablePromise<OrganizationListSessionsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/organization/sessions",
    })
  }

/**
 * Delete Session
 * @param data The data for the request.
 * @param data.sessionId
 * @returns void Successful Response
 * @throws ApiError
 */
export const organizationDeleteSession = (
  data: OrganizationDeleteSessionData
): CancelablePromise<OrganizationDeleteSessionResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/organization/sessions/{session_id}",
    path: {
      session_id: data.sessionId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Invitation
 * Create an invitation to join the organization.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns OrgInvitationRead Successful Response
 * @throws ApiError
 */
export const organizationCreateInvitation = (
  data: OrganizationCreateInvitationData
): CancelablePromise<OrganizationCreateInvitationResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/invitations",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Invitations
 * List invitations for the organization.
 * @param data The data for the request.
 * @param data.status
 * @returns OrgInvitationRead Successful Response
 * @throws ApiError
 */
export const organizationListInvitations = (
  data: OrganizationListInvitationsData = {}
): CancelablePromise<OrganizationListInvitationsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/invitations",
    query: {
      status: data.status,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Revoke Invitation
 * Revoke a pending invitation.
 * @param data The data for the request.
 * @param data.invitationId
 * @returns void Successful Response
 * @throws ApiError
 */
export const organizationRevokeInvitation = (
  data: OrganizationRevokeInvitationData
): CancelablePromise<OrganizationRevokeInvitationResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/organization/invitations/{invitation_id}",
    path: {
      invitation_id: data.invitationId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Invitation Token
 * Get the token for a specific invitation (admin only).
 *
 * This endpoint is used to generate shareable invitation links.
 * @param data The data for the request.
 * @param data.invitationId
 * @returns string Successful Response
 * @throws ApiError
 */
export const organizationGetInvitationToken = (
  data: OrganizationGetInvitationTokenData
): CancelablePromise<OrganizationGetInvitationTokenResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/invitations/{invitation_id}/token",
    path: {
      invitation_id: data.invitationId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Accept Invitation
 * Accept an invitation and join the organization.
 *
 * This endpoint doesn't require organization context since the user
 * may not belong to any organization yet. Uses AuthenticatedUserOnly
 * which only requires an authenticated user (role.organization_id is None).
 * @param data The data for the request.
 * @param data.requestBody
 * @returns string Successful Response
 * @throws ApiError
 */
export const organizationAcceptInvitation = (
  data: OrganizationAcceptInvitationData
): CancelablePromise<OrganizationAcceptInvitationResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/invitations/accept",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List My Pending Invitations
 * List pending, unexpired invitations for the authenticated user.
 * @returns OrgPendingInvitationRead Successful Response
 * @throws ApiError
 */
export const organizationListMyPendingInvitations =
  (): CancelablePromise<OrganizationListMyPendingInvitationsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/organization/invitations/pending/me",
    })
  }

/**
 * Get Invitation By Token
 * Get minimal invitation details by token (public endpoint for UI).
 *
 * Returns organization name and inviter info for the acceptance page.
 * If user is authenticated, also returns whether their email matches the invitation.
 * @param data The data for the request.
 * @param data.token
 * @returns OrgInvitationReadMinimal Successful Response
 * @throws ApiError
 */
export const organizationGetInvitationByToken = (
  data: OrganizationGetInvitationByTokenData
): CancelablePromise<OrganizationGetInvitationByTokenResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/invitations/token/{token}",
    path: {
      token: data.token,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Organization Service Accounts
 * @param data The data for the request.
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_ServiceAccountRead_ Successful Response
 * @throws ApiError
 */
export const serviceAccountsListOrganizationServiceAccounts = (
  data: ServiceAccountsListOrganizationServiceAccountsData = {}
): CancelablePromise<ServiceAccountsListOrganizationServiceAccountsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/service-accounts",
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Organization Service Account
 * @param data The data for the request.
 * @param data.requestBody
 * @returns ServiceAccountApiKeyIssueResponse Successful Response
 * @throws ApiError
 */
export const serviceAccountsCreateOrganizationServiceAccount = (
  data: ServiceAccountsCreateOrganizationServiceAccountData
): CancelablePromise<ServiceAccountsCreateOrganizationServiceAccountResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/service-accounts",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Organization Service Account Scopes
 * @returns ServiceAccountScopeList Successful Response
 * @throws ApiError
 */
export const serviceAccountsListOrganizationServiceAccountScopes =
  (): CancelablePromise<ServiceAccountsListOrganizationServiceAccountScopesResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/organization/service-accounts/scopes",
    })
  }

/**
 * Get Organization Service Account
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @returns ServiceAccountRead Successful Response
 * @throws ApiError
 */
export const serviceAccountsGetOrganizationServiceAccount = (
  data: ServiceAccountsGetOrganizationServiceAccountData
): CancelablePromise<ServiceAccountsGetOrganizationServiceAccountResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/service-accounts/{service_account_id}",
    path: {
      service_account_id: data.serviceAccountId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Organization Service Account
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @param data.requestBody
 * @returns ServiceAccountRead Successful Response
 * @throws ApiError
 */
export const serviceAccountsUpdateOrganizationServiceAccount = (
  data: ServiceAccountsUpdateOrganizationServiceAccountData
): CancelablePromise<ServiceAccountsUpdateOrganizationServiceAccountResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/organization/service-accounts/{service_account_id}",
    path: {
      service_account_id: data.serviceAccountId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Organization Service Account Api Keys
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_ServiceAccountApiKeyRead_ Successful Response
 * @throws ApiError
 */
export const serviceAccountsListOrganizationServiceAccountApiKeys = (
  data: ServiceAccountsListOrganizationServiceAccountApiKeysData
): CancelablePromise<ServiceAccountsListOrganizationServiceAccountApiKeysResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/service-accounts/{service_account_id}/api-keys",
    path: {
      service_account_id: data.serviceAccountId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Organization Service Account Api Key
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @param data.requestBody
 * @returns ServiceAccountApiKeyIssueResponse Successful Response
 * @throws ApiError
 */
export const serviceAccountsCreateOrganizationServiceAccountApiKey = (
  data: ServiceAccountsCreateOrganizationServiceAccountApiKeyData
): CancelablePromise<ServiceAccountsCreateOrganizationServiceAccountApiKeyResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/service-accounts/{service_account_id}/api-keys",
    path: {
      service_account_id: data.serviceAccountId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Disable Organization Service Account
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @returns void Successful Response
 * @throws ApiError
 */
export const serviceAccountsDisableOrganizationServiceAccount = (
  data: ServiceAccountsDisableOrganizationServiceAccountData
): CancelablePromise<ServiceAccountsDisableOrganizationServiceAccountResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/service-accounts/{service_account_id}/disable",
    path: {
      service_account_id: data.serviceAccountId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Enable Organization Service Account
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @returns void Successful Response
 * @throws ApiError
 */
export const serviceAccountsEnableOrganizationServiceAccount = (
  data: ServiceAccountsEnableOrganizationServiceAccountData
): CancelablePromise<ServiceAccountsEnableOrganizationServiceAccountResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/service-accounts/{service_account_id}/enable",
    path: {
      service_account_id: data.serviceAccountId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Revoke Organization Service Account Api Key
 * @param data The data for the request.
 * @param data.serviceAccountId
 * @param data.apiKeyId
 * @returns void Successful Response
 * @throws ApiError
 */
export const serviceAccountsRevokeOrganizationServiceAccountApiKey = (
  data: ServiceAccountsRevokeOrganizationServiceAccountApiKeyData
): CancelablePromise<ServiceAccountsRevokeOrganizationServiceAccountApiKeyResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/service-accounts/{service_account_id}/api-keys/{api_key_id}/revoke",
    path: {
      service_account_id: data.serviceAccountId,
      api_key_id: data.apiKeyId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Models
 * List all available AI models.
 * @returns ModelConfig Successful Response
 * @throws ApiError
 */
export const agentListModels =
  (): CancelablePromise<AgentListModelsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/agent/models",
    })
  }

/**
 * List Providers
 * List all available AI model providers.
 * @returns string Successful Response
 * @throws ApiError
 */
export const agentListProviders =
  (): CancelablePromise<AgentListProvidersResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/agent/providers",
    })
  }

/**
 * Get Providers Status
 * Get credential status for all providers.
 * @returns boolean Successful Response
 * @throws ApiError
 */
export const agentGetProvidersStatus =
  (): CancelablePromise<AgentGetProvidersStatusResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/agent/providers/status",
    })
  }

/**
 * List Provider Credential Configs
 * List credential field configurations for all providers.
 * @returns ProviderCredentialConfig Successful Response
 * @throws ApiError
 */
export const agentListProviderCredentialConfigs =
  (): CancelablePromise<AgentListProviderCredentialConfigsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/agent/providers/configs",
    })
  }

/**
 * Get Provider Credential Config
 * Get credential field configuration for a specific provider.
 * @param data The data for the request.
 * @param data.provider
 * @returns ProviderCredentialConfig Successful Response
 * @throws ApiError
 */
export const agentGetProviderCredentialConfig = (
  data: AgentGetProviderCredentialConfigData
): CancelablePromise<AgentGetProviderCredentialConfigResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/agent/providers/{provider}/config",
    path: {
      provider: data.provider,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Provider Credentials
 * Create or update credentials for an AI provider.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns string Successful Response
 * @throws ApiError
 */
export const agentCreateProviderCredentials = (
  data: AgentCreateProviderCredentialsData
): CancelablePromise<AgentCreateProviderCredentialsResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/agent/credentials",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Provider Credentials
 * Update existing credentials for an AI provider.
 * @param data The data for the request.
 * @param data.provider
 * @param data.requestBody
 * @returns string Successful Response
 * @throws ApiError
 */
export const agentUpdateProviderCredentials = (
  data: AgentUpdateProviderCredentialsData
): CancelablePromise<AgentUpdateProviderCredentialsResponse> => {
  return __request(OpenAPI, {
    method: "PUT",
    url: "/agent/credentials/{provider}",
    path: {
      provider: data.provider,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Provider Credentials
 * Delete credentials for an AI provider.
 * @param data The data for the request.
 * @param data.provider
 * @returns string Successful Response
 * @throws ApiError
 */
export const agentDeleteProviderCredentials = (
  data: AgentDeleteProviderCredentialsData
): CancelablePromise<AgentDeleteProviderCredentialsResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/agent/credentials/{provider}",
    path: {
      provider: data.provider,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Default Model
 * Get the organization's default AI model.
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const agentGetDefaultModel =
  (): CancelablePromise<AgentGetDefaultModelResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/agent/default-model",
    })
  }

/**
 * Set Default Model
 * Set the organization's default AI model by catalog id.
 *
 * Names aren't unique once an org enables the same ``model_name`` under
 * multiple providers (e.g. ``openai/gpt-4o`` + ``azure_openai/gpt-4o``),
 * so the selection is keyed by catalog row. Rejects catalog ids that
 * aren't enabled for this org with a 404.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns DefaultModelSelection Successful Response
 * @throws ApiError
 */
export const agentSetDefaultModel = (
  data: AgentSetDefaultModelData
): CancelablePromise<AgentSetDefaultModelResponse> => {
  return __request(OpenAPI, {
    method: "PUT",
    url: "/agent/default-model",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Default Model Selection
 * Get the organization's canonical default model selection.
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const agentGetDefaultModelSelection =
  (): CancelablePromise<AgentGetDefaultModelSelectionResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/agent/default-model-selection",
    })
  }

/**
 * Set Default Model Selection
 * Set the organization's canonical default model selection.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns DefaultModelSelection Successful Response
 * @throws ApiError
 */
export const agentSetDefaultModelSelection = (
  data: AgentSetDefaultModelSelectionData
): CancelablePromise<AgentSetDefaultModelSelectionResponse> => {
  return __request(OpenAPI, {
    method: "PUT",
    url: "/agent/default-model-selection",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Catalog
 * List catalog entries with optional filtering and pagination.
 * @param data The data for the request.
 * @param data.provider
 * @param data.modelName
 * @param data.cursor
 * @param data.limit
 * @returns AgentCatalogListResponse Successful Response
 * @throws ApiError
 */
export const listCatalog = (
  data: ListCatalogData = {}
): CancelablePromise<ListCatalogResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/agent-catalog",
    query: {
      provider: data.provider,
      model_name: data.modelName,
      cursor: data.cursor,
      limit: data.limit,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Catalog Entry
 * Create an org-scoped catalog entry and auto-enable it at the org level.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns AgentCatalogRead Successful Response
 * @throws ApiError
 */
export const createCatalogEntry = (
  data: CreateCatalogEntryData
): CancelablePromise<CreateCatalogEntryResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/agent-catalog",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Catalog Entry
 * Get a specific catalog entry.
 * @param data The data for the request.
 * @param data.catalogId
 * @returns AgentCatalogRead Successful Response
 * @throws ApiError
 */
export const getCatalogEntry = (
  data: GetCatalogEntryData
): CancelablePromise<GetCatalogEntryResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/agent-catalog/{catalog_id}",
    path: {
      catalog_id: data.catalogId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Catalog Entry
 * Update metadata on an org-scoped catalog entry.
 * @param data The data for the request.
 * @param data.catalogId
 * @param data.requestBody
 * @returns AgentCatalogRead Successful Response
 * @throws ApiError
 */
export const updateCatalogEntry = (
  data: UpdateCatalogEntryData
): CancelablePromise<UpdateCatalogEntryResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/organization/agent-catalog/{catalog_id}",
    path: {
      catalog_id: data.catalogId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Catalog Entry
 * Delete an org-scoped catalog entry.
 * @param data The data for the request.
 * @param data.catalogId
 * @returns void Successful Response
 * @throws ApiError
 */
export const deleteCatalogEntry = (
  data: DeleteCatalogEntryData
): CancelablePromise<DeleteCatalogEntryResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/organization/agent-catalog/{catalog_id}",
    path: {
      catalog_id: data.catalogId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workspace Models
 * Get models accessible to a workspace.
 *
 * Returns the full effective set; the list is bounded by org enablement
 * and is expected to be small, so pagination is not used here.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns AgentCatalogListResponse Successful Response
 * @throws ApiError
 */
export const getWorkspaceModels = (
  data: GetWorkspaceModelsData
): CancelablePromise<GetWorkspaceModelsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent-models",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Enable Model
 * Enable a model for org or workspace.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns AgentModelAccessRead Successful Response
 * @throws ApiError
 */
export const enableModel = (
  data: EnableModelData
): CancelablePromise<EnableModelResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/agent-model-access",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Enabled Models
 * List enabled models with pagination.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.cursor
 * @param data.limit
 * @returns AgentModelAccessListResponse Successful Response
 * @throws ApiError
 */
export const listEnabledModels = (
  data: ListEnabledModelsData = {}
): CancelablePromise<ListEnabledModelsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/agent-model-access",
    query: {
      workspace_id: data.workspaceId,
      cursor: data.cursor,
      limit: data.limit,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Disable Model
 * Disable a model.
 * @param data The data for the request.
 * @param data.accessId
 * @returns void Successful Response
 * @throws ApiError
 */
export const disableModel = (
  data: DisableModelData
): CancelablePromise<DisableModelResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/organization/agent-model-access/{access_id}",
    path: {
      access_id: data.accessId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Custom Provider
 * Create a new custom LLM provider.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns AgentCustomProviderRead Successful Response
 * @throws ApiError
 */
export const createCustomProvider = (
  data: CreateCustomProviderData
): CancelablePromise<CreateCustomProviderResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/agent-custom-providers",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Custom Providers
 * List organization custom providers with pagination.
 * @param data The data for the request.
 * @param data.cursor
 * @param data.limit
 * @returns AgentCustomProviderListResponse Successful Response
 * @throws ApiError
 */
export const listCustomProviders = (
  data: ListCustomProvidersData = {}
): CancelablePromise<ListCustomProvidersResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/agent-custom-providers",
    query: {
      cursor: data.cursor,
      limit: data.limit,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Custom Provider
 * Get a specific custom provider.
 * @param data The data for the request.
 * @param data.providerId
 * @returns AgentCustomProviderRead Successful Response
 * @throws ApiError
 */
export const getCustomProvider = (
  data: GetCustomProviderData
): CancelablePromise<GetCustomProviderResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/agent-custom-providers/{provider_id}",
    path: {
      provider_id: data.providerId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Custom Provider
 * Update custom provider configuration.
 * @param data The data for the request.
 * @param data.providerId
 * @param data.requestBody
 * @returns AgentCustomProviderRead Successful Response
 * @throws ApiError
 */
export const updateCustomProvider = (
  data: UpdateCustomProviderData
): CancelablePromise<UpdateCustomProviderResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/organization/agent-custom-providers/{provider_id}",
    path: {
      provider_id: data.providerId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Custom Provider
 * Delete a custom provider.
 * @param data The data for the request.
 * @param data.providerId
 * @returns void Successful Response
 * @throws ApiError
 */
export const deleteCustomProvider = (
  data: DeleteCustomProviderData
): CancelablePromise<DeleteCustomProviderResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/organization/agent-custom-providers/{provider_id}",
    path: {
      provider_id: data.providerId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Refresh Custom Provider Catalog
 * Trigger model discovery for a custom provider.
 * @param data The data for the request.
 * @param data.providerId
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const refreshCustomProviderCatalog = (
  data: RefreshCustomProviderCatalogData
): CancelablePromise<RefreshCustomProviderCatalogResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/agent-custom-providers/{provider_id}/refresh",
    path: {
      provider_id: data.providerId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Validate Custom Provider Connection
 * Test provider connectivity without saving.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns boolean Successful Response
 * @throws ApiError
 */
export const validateCustomProviderConnection = (
  data: ValidateCustomProviderConnectionData
): CancelablePromise<ValidateCustomProviderConnectionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/agent-custom-providers/validate",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Workspace Providers Status
 * Get workspace credential status for all providers.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns boolean Successful Response
 * @throws ApiError
 */
export const agentGetWorkspaceProvidersStatus = (
  data: AgentGetWorkspaceProvidersStatusData
): CancelablePromise<AgentGetWorkspaceProvidersStatusResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/workspace/providers/status",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Channel Token
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentChannelTokenRead Successful Response
 * @throws ApiError
 */
export const agentChannelsCreateChannelToken = (
  data: AgentChannelsCreateChannelTokenData
): CancelablePromise<AgentChannelsCreateChannelTokenResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/channels/tokens",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Channel Tokens
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.agentPresetId Filter by agent preset
 * @param data.channelType Filter by channel type
 * @returns AgentChannelTokenRead Successful Response
 * @throws ApiError
 */
export const agentChannelsListChannelTokens = (
  data: AgentChannelsListChannelTokensData
): CancelablePromise<AgentChannelsListChannelTokensResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/channels/tokens",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      agent_preset_id: data.agentPresetId,
      channel_type: data.channelType,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Channel Token
 * @param data The data for the request.
 * @param data.tokenId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentChannelTokenRead Successful Response
 * @throws ApiError
 */
export const agentChannelsUpdateChannelToken = (
  data: AgentChannelsUpdateChannelTokenData
): CancelablePromise<AgentChannelsUpdateChannelTokenResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/agent/channels/tokens/{token_id}",
    path: {
      token_id: data.tokenId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Channel Token
 * @param data The data for the request.
 * @param data.tokenId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const agentChannelsDeleteChannelToken = (
  data: AgentChannelsDeleteChannelTokenData
): CancelablePromise<AgentChannelsDeleteChannelTokenResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/agent/channels/tokens/{token_id}",
    path: {
      token_id: data.tokenId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Rotate Channel Token
 * @param data The data for the request.
 * @param data.tokenId
 * @param data.workspaceId
 * @returns AgentChannelTokenRead Successful Response
 * @throws ApiError
 */
export const agentChannelsRotateChannelToken = (
  data: AgentChannelsRotateChannelTokenData
): CancelablePromise<AgentChannelsRotateChannelTokenResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/channels/tokens/{token_id}/rotate",
    path: {
      token_id: data.tokenId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Start Slack Oauth
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns SlackOAuthStartResponse Successful Response
 * @throws ApiError
 */
export const agentChannelsStartSlackOauth = (
  data: AgentChannelsStartSlackOauthData
): CancelablePromise<AgentChannelsStartSlackOauthResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/channels/tokens/slack/oauth/start",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Agent Presets
 * List all agent presets for the current workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns AgentPresetReadMinimal Successful Response
 * @throws ApiError
 */
export const agentPresetsListAgentPresets = (
  data: AgentPresetsListAgentPresetsData
): CancelablePromise<AgentPresetsListAgentPresetsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/presets",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Agent Preset
 * Create a new agent preset.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentPresetRead Successful Response
 * @throws ApiError
 */
export const agentPresetsCreateAgentPreset = (
  data: AgentPresetsCreateAgentPresetData
): CancelablePromise<AgentPresetsCreateAgentPresetResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/presets",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Agent Preset
 * Retrieve an agent preset by ID.
 * @param data The data for the request.
 * @param data.presetId
 * @param data.workspaceId
 * @returns AgentPresetRead Successful Response
 * @throws ApiError
 */
export const agentPresetsGetAgentPreset = (
  data: AgentPresetsGetAgentPresetData
): CancelablePromise<AgentPresetsGetAgentPresetResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/presets/{preset_id}",
    path: {
      preset_id: data.presetId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Agent Preset
 * Update an existing agent preset.
 * @param data The data for the request.
 * @param data.presetId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentPresetRead Successful Response
 * @throws ApiError
 */
export const agentPresetsUpdateAgentPreset = (
  data: AgentPresetsUpdateAgentPresetData
): CancelablePromise<AgentPresetsUpdateAgentPresetResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/agent/presets/{preset_id}",
    path: {
      preset_id: data.presetId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Agent Preset
 * Delete an agent preset.
 * @param data The data for the request.
 * @param data.presetId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const agentPresetsDeleteAgentPreset = (
  data: AgentPresetsDeleteAgentPresetData
): CancelablePromise<AgentPresetsDeleteAgentPresetResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/agent/presets/{preset_id}",
    path: {
      preset_id: data.presetId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Agent Preset By Slug
 * Retrieve an agent preset by slug.
 * @param data The data for the request.
 * @param data.slug
 * @param data.workspaceId
 * @returns AgentPresetRead Successful Response
 * @throws ApiError
 */
export const agentPresetsGetAgentPresetBySlug = (
  data: AgentPresetsGetAgentPresetBySlugData
): CancelablePromise<AgentPresetsGetAgentPresetBySlugResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/presets/by-slug/{slug}",
    path: {
      slug: data.slug,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Agent Preset Versions
 * List immutable versions for an agent preset.
 * @param data The data for the request.
 * @param data.presetId
 * @param data.workspaceId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_AgentPresetVersionReadMinimal_ Successful Response
 * @throws ApiError
 */
export const agentPresetsListAgentPresetVersions = (
  data: AgentPresetsListAgentPresetVersionsData
): CancelablePromise<AgentPresetsListAgentPresetVersionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/presets/{preset_id}/versions",
    path: {
      preset_id: data.presetId,
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Agent Preset Version
 * Retrieve an immutable agent preset version.
 * @param data The data for the request.
 * @param data.presetId
 * @param data.versionId
 * @param data.workspaceId
 * @returns AgentPresetVersionRead Successful Response
 * @throws ApiError
 */
export const agentPresetsGetAgentPresetVersion = (
  data: AgentPresetsGetAgentPresetVersionData
): CancelablePromise<AgentPresetsGetAgentPresetVersionResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/presets/{preset_id}/versions/{version_id}",
    path: {
      preset_id: data.presetId,
      version_id: data.versionId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Compare Agent Preset Versions
 * Compare two preset versions belonging to the same preset.
 * @param data The data for the request.
 * @param data.presetId
 * @param data.versionId
 * @param data.workspaceId
 * @param data.compareTo Version ID to compare against
 * @returns AgentPresetVersionDiff Successful Response
 * @throws ApiError
 */
export const agentPresetsCompareAgentPresetVersions = (
  data: AgentPresetsCompareAgentPresetVersionsData
): CancelablePromise<AgentPresetsCompareAgentPresetVersionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/presets/{preset_id}/versions/{version_id}/compare",
    path: {
      preset_id: data.presetId,
      version_id: data.versionId,
      workspace_id: data.workspaceId,
    },
    query: {
      compare_to: data.compareTo,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Restore Agent Preset Version
 * Restore a historical preset version as current.
 * @param data The data for the request.
 * @param data.presetId
 * @param data.versionId
 * @param data.workspaceId
 * @returns AgentPresetRead Successful Response
 * @throws ApiError
 */
export const agentPresetsRestoreAgentPresetVersion = (
  data: AgentPresetsRestoreAgentPresetVersionData
): CancelablePromise<AgentPresetsRestoreAgentPresetVersionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/presets/{preset_id}/versions/{version_id}/restore",
    path: {
      preset_id: data.presetId,
      version_id: data.versionId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Move Agent Preset To Folder
 * Move an agent preset to a folder.
 * @param data The data for the request.
 * @param data.presetId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const agentPresetsMoveAgentPresetToFolder = (
  data: AgentPresetsMoveAgentPresetToFolderData
): CancelablePromise<AgentPresetsMoveAgentPresetToFolderResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/presets/{preset_id}/move",
    path: {
      preset_id: data.presetId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Preset Tags
 * List all tags for an agent preset.
 * @param data The data for the request.
 * @param data.presetId
 * @param data.workspaceId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_AgentTagRead_ Successful Response
 * @throws ApiError
 */
export const agentPresetsListPresetTags = (
  data: AgentPresetsListPresetTagsData
): CancelablePromise<AgentPresetsListPresetTagsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/presets/{preset_id}/tags",
    path: {
      preset_id: data.presetId,
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Add Preset Tag
 * Add a tag to an agent preset.
 * @param data The data for the request.
 * @param data.presetId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const agentPresetsAddPresetTag = (
  data: AgentPresetsAddPresetTagData
): CancelablePromise<AgentPresetsAddPresetTagResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/presets/{preset_id}/tags",
    path: {
      preset_id: data.presetId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Remove Preset Tag
 * Remove a tag from an agent preset.
 * @param data The data for the request.
 * @param data.presetId
 * @param data.tagId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const agentPresetsRemovePresetTag = (
  data: AgentPresetsRemovePresetTagData
): CancelablePromise<AgentPresetsRemovePresetTagResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/agent/presets/{preset_id}/tags/{tag_id}",
    path: {
      preset_id: data.presetId,
      tag_id: data.tagId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Directory
 * Get directory items (presets and folders) in the given path.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.path Folder path
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const agentFoldersGetDirectory = (
  data: AgentFoldersGetDirectoryData
): CancelablePromise<AgentFoldersGetDirectoryResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent-folders/directory",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      path: data.path,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Folders
 * List folders under the specified parent path.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.parentPath Parent folder path
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_AgentFolderRead_ Successful Response
 * @throws ApiError
 */
export const agentFoldersListFolders = (
  data: AgentFoldersListFoldersData
): CancelablePromise<AgentFoldersListFoldersResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent-folders",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      parent_path: data.parentPath,
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Folder
 * Create a new agent folder.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentFolderRead Successful Response
 * @throws ApiError
 */
export const agentFoldersCreateFolder = (
  data: AgentFoldersCreateFolderData
): CancelablePromise<AgentFoldersCreateFolderResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent-folders",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Folder
 * Get folder details by ID.
 * @param data The data for the request.
 * @param data.folderId
 * @param data.workspaceId
 * @returns AgentFolderRead Successful Response
 * @throws ApiError
 */
export const agentFoldersGetFolder = (
  data: AgentFoldersGetFolderData
): CancelablePromise<AgentFoldersGetFolderResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent-folders/{folder_id}",
    path: {
      folder_id: data.folderId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Folder
 * Update a folder (rename).
 * @param data The data for the request.
 * @param data.folderId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentFolderRead Successful Response
 * @throws ApiError
 */
export const agentFoldersUpdateFolder = (
  data: AgentFoldersUpdateFolderData
): CancelablePromise<AgentFoldersUpdateFolderResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/agent-folders/{folder_id}",
    path: {
      folder_id: data.folderId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Folder
 * Delete an agent folder.
 * @param data The data for the request.
 * @param data.folderId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const agentFoldersDeleteFolder = (
  data: AgentFoldersDeleteFolderData
): CancelablePromise<AgentFoldersDeleteFolderResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/agent-folders/{folder_id}",
    path: {
      folder_id: data.folderId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Move Folder
 * Move a folder to a new parent folder.
 * @param data The data for the request.
 * @param data.folderId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentFolderRead Successful Response
 * @throws ApiError
 */
export const agentFoldersMoveFolder = (
  data: AgentFoldersMoveFolderData
): CancelablePromise<AgentFoldersMoveFolderResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent-folders/{folder_id}/move",
    path: {
      folder_id: data.folderId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Agent Tags
 * List all agent tags in the workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_AgentTagRead_ Successful Response
 * @throws ApiError
 */
export const agentTagsListAgentTags = (
  data: AgentTagsListAgentTagsData
): CancelablePromise<AgentTagsListAgentTagsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent-tags",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Agent Tag
 * Create a new agent tag definition.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentTagRead Successful Response
 * @throws ApiError
 */
export const agentTagsCreateAgentTag = (
  data: AgentTagsCreateAgentTagData
): CancelablePromise<AgentTagsCreateAgentTagResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent-tags",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Agent Tag
 * Get an agent tag by ID.
 * @param data The data for the request.
 * @param data.tagId
 * @param data.workspaceId
 * @returns AgentTagRead Successful Response
 * @throws ApiError
 */
export const agentTagsGetAgentTag = (
  data: AgentTagsGetAgentTagData
): CancelablePromise<AgentTagsGetAgentTagResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent-tags/{tag_id}",
    path: {
      tag_id: data.tagId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Agent Tag
 * Update an agent tag definition.
 * @param data The data for the request.
 * @param data.tagId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentTagRead Successful Response
 * @throws ApiError
 */
export const agentTagsUpdateAgentTag = (
  data: AgentTagsUpdateAgentTagData
): CancelablePromise<AgentTagsUpdateAgentTagResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/agent-tags/{tag_id}",
    path: {
      tag_id: data.tagId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Agent Tag
 * Delete an agent tag definition.
 * @param data The data for the request.
 * @param data.tagId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const agentTagsDeleteAgentTag = (
  data: AgentTagsDeleteAgentTagData
): CancelablePromise<AgentTagsDeleteAgentTagResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/agent-tags/{tag_id}",
    path: {
      tag_id: data.tagId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Skills
 * List workspace skills for the current workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_SkillReadMinimal_ Successful Response
 * @throws ApiError
 */
export const agentSkillsListSkills = (
  data: AgentSkillsListSkillsData
): CancelablePromise<AgentSkillsListSkillsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/skills",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Skill
 * Create a new logical skill and seed its draft.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns SkillRead Successful Response
 * @throws ApiError
 */
export const agentSkillsCreateSkill = (
  data: AgentSkillsCreateSkillData
): CancelablePromise<AgentSkillsCreateSkillResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/skills",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Upload Skill
 * Create a new skill by importing a full draft file tree.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns SkillRead Successful Response
 * @throws ApiError
 */
export const agentSkillsUploadSkill = (
  data: AgentSkillsUploadSkillData
): CancelablePromise<AgentSkillsUploadSkillResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/skills:upload",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Skill
 * Return a skill summary including draft and current version status.
 * @param data The data for the request.
 * @param data.skillId
 * @param data.workspaceId
 * @returns SkillRead Successful Response
 * @throws ApiError
 */
export const agentSkillsGetSkill = (
  data: AgentSkillsGetSkillData
): CancelablePromise<AgentSkillsGetSkillResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/skills/{skill_id}",
    path: {
      skill_id: data.skillId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Archive Skill
 * Archive a logical skill.
 * @param data The data for the request.
 * @param data.skillId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const agentSkillsArchiveSkill = (
  data: AgentSkillsArchiveSkillData
): CancelablePromise<AgentSkillsArchiveSkillResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/agent/skills/{skill_id}",
    path: {
      skill_id: data.skillId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Skill Draft
 * Return the mutable draft manifest for a skill.
 * @param data The data for the request.
 * @param data.skillId
 * @param data.workspaceId
 * @returns SkillDraftRead Successful Response
 * @throws ApiError
 */
export const agentSkillsGetSkillDraft = (
  data: AgentSkillsGetSkillDraftData
): CancelablePromise<AgentSkillsGetSkillDraftResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/skills/{skill_id}/draft",
    path: {
      skill_id: data.skillId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Patch Skill Draft
 * Apply optimistic-concurrency mutations to a draft.
 * @param data The data for the request.
 * @param data.skillId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns SkillDraftRead Successful Response
 * @throws ApiError
 */
export const agentSkillsPatchSkillDraft = (
  data: AgentSkillsPatchSkillDraftData
): CancelablePromise<AgentSkillsPatchSkillDraftResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/agent/skills/{skill_id}/draft",
    path: {
      skill_id: data.skillId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Skill Draft File
 * Return one draft file inline or as a presigned download.
 * @param data The data for the request.
 * @param data.skillId
 * @param data.workspaceId
 * @param data.path
 * @returns SkillDraftFileRead Successful Response
 * @throws ApiError
 */
export const agentSkillsGetSkillDraftFile = (
  data: AgentSkillsGetSkillDraftFileData
): CancelablePromise<AgentSkillsGetSkillDraftFileResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/skills/{skill_id}/draft/file",
    path: {
      skill_id: data.skillId,
      workspace_id: data.workspaceId,
    },
    query: {
      path: data.path,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Skill Draft Upload
 * Create a staged upload session for a draft file blob.
 * @param data The data for the request.
 * @param data.skillId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns SkillUploadSessionRead Successful Response
 * @throws ApiError
 */
export const agentSkillsCreateSkillDraftUpload = (
  data: AgentSkillsCreateSkillDraftUploadData
): CancelablePromise<AgentSkillsCreateSkillDraftUploadResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/skills/{skill_id}/draft/uploads",
    path: {
      skill_id: data.skillId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Publish Skill
 * Publish the current draft into a new immutable version.
 * @param data The data for the request.
 * @param data.skillId
 * @param data.workspaceId
 * @returns SkillVersionRead Successful Response
 * @throws ApiError
 */
export const agentSkillsPublishSkill = (
  data: AgentSkillsPublishSkillData
): CancelablePromise<AgentSkillsPublishSkillResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/skills/{skill_id}/publish",
    path: {
      skill_id: data.skillId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Skill Versions
 * List immutable versions for a skill.
 * @param data The data for the request.
 * @param data.skillId
 * @param data.workspaceId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_SkillVersionReadMinimal_ Successful Response
 * @throws ApiError
 */
export const agentSkillsListSkillVersions = (
  data: AgentSkillsListSkillVersionsData
): CancelablePromise<AgentSkillsListSkillVersionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/skills/{skill_id}/versions",
    path: {
      skill_id: data.skillId,
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Skill Version
 * Return one immutable skill version manifest.
 * @param data The data for the request.
 * @param data.skillId
 * @param data.versionId
 * @param data.workspaceId
 * @returns SkillVersionRead Successful Response
 * @throws ApiError
 */
export const agentSkillsGetSkillVersion = (
  data: AgentSkillsGetSkillVersionData
): CancelablePromise<AgentSkillsGetSkillVersionResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/skills/{skill_id}/versions/{version_id}",
    path: {
      skill_id: data.skillId,
      version_id: data.versionId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Skill Version File
 * Return one published version file inline or as a presigned download.
 * @param data The data for the request.
 * @param data.skillId
 * @param data.versionId
 * @param data.workspaceId
 * @param data.path
 * @returns SkillDraftFileRead Successful Response
 * @throws ApiError
 */
export const agentSkillsGetSkillVersionFile = (
  data: AgentSkillsGetSkillVersionFileData
): CancelablePromise<AgentSkillsGetSkillVersionFileResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/skills/{skill_id}/versions/{version_id}/file",
    path: {
      skill_id: data.skillId,
      version_id: data.versionId,
      workspace_id: data.workspaceId,
    },
    query: {
      path: data.path,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Restore Skill Version
 * Restore a historical version as the current selected skill version.
 * @param data The data for the request.
 * @param data.skillId
 * @param data.versionId
 * @param data.workspaceId
 * @returns SkillReadMinimal Successful Response
 * @throws ApiError
 */
export const agentSkillsRestoreSkillVersion = (
  data: AgentSkillsRestoreSkillVersionData
): CancelablePromise<AgentSkillsRestoreSkillVersionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/skills/{skill_id}/versions/{version_id}/restore",
    path: {
      skill_id: data.skillId,
      version_id: data.versionId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Session
 * Create a new agent session associated with an entity.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentSessionRead Successful Response
 * @throws ApiError
 */
export const agentSessionsCreateSession = (
  data: AgentSessionsCreateSessionData
): CancelablePromise<AgentSessionsCreateSessionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/sessions",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Sessions
 * List agent sessions for the current workspace with optional filtering.
 *
 * Returns a list of sessions including both active AgentSessions and legacy
 * Chat records. Legacy chats have is_readonly=True.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.entityType Filter by entity type
 * @param data.entityId Filter by entity ID
 * @param data.excludeEntityTypes Entity types to exclude from results
 * @param data.parentSessionId Filter by parent session ID (for finding forked sessions)
 * @param data.limit Maximum number of sessions to return
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const agentSessionsListSessions = (
  data: AgentSessionsListSessionsData
): CancelablePromise<AgentSessionsListSessionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/sessions",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      entity_type: data.entityType,
      entity_id: data.entityId,
      exclude_entity_types: data.excludeEntityTypes,
      parent_session_id: data.parentSessionId,
      limit: data.limit,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Session
 * Get an agent session or legacy chat with its message history.
 *
 * Legacy chats have is_readonly=True.
 * @param data The data for the request.
 * @param data.sessionId
 * @param data.workspaceId
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const agentSessionsGetSession = (
  data: AgentSessionsGetSessionData
): CancelablePromise<AgentSessionsGetSessionResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/sessions/{session_id}",
    path: {
      session_id: data.sessionId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Session
 * Update session properties.
 * @param data The data for the request.
 * @param data.sessionId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentSessionRead Successful Response
 * @throws ApiError
 */
export const agentSessionsUpdateSession = (
  data: AgentSessionsUpdateSessionData
): CancelablePromise<AgentSessionsUpdateSessionResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/agent/sessions/{session_id}",
    path: {
      session_id: data.sessionId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Session
 * Delete an agent session.
 * @param data The data for the request.
 * @param data.sessionId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const agentSessionsDeleteSession = (
  data: AgentSessionsDeleteSessionData
): CancelablePromise<AgentSessionsDeleteSessionResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/agent/sessions/{session_id}",
    path: {
      session_id: data.sessionId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Session Vercel
 * Get an agent session or legacy chat with message history in Vercel format.
 *
 * Legacy chats have is_readonly=True.
 * @param data The data for the request.
 * @param data.sessionId
 * @param data.workspaceId
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const agentSessionsGetSessionVercel = (
  data: AgentSessionsGetSessionVercelData
): CancelablePromise<AgentSessionsGetSessionVercelResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/sessions/{session_id}/vercel",
    path: {
      session_id: data.sessionId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Send Message
 * Send a message to the agent session with streaming response.
 *
 * This endpoint combines message sending with streaming response,
 * compatible with Vercel's AI SDK useChat hook. It:
 * 1. Accepts Vercel UI message format or continuation requests
 * 2. Starts the agent execution
 * 3. Streams the response back in Vercel's data protocol format
 * @param data The data for the request.
 * @param data.sessionId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const agentSessionsSendMessage = (
  data: AgentSessionsSendMessageData
): CancelablePromise<AgentSessionsSendMessageResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/sessions/{session_id}/messages",
    path: {
      session_id: data.sessionId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Stream Session Events
 * Stream session events via Server-Sent Events (SSE).
 *
 * This endpoint provides real-time streaming of AI agent execution steps
 * using Server-Sent Events. It supports automatic reconnection via the
 * Last-Event-ID header.
 * @param data The data for the request.
 * @param data.sessionId
 * @param data.workspaceId
 * @param data.format Streaming format (e.g. 'vercel')
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const agentSessionsStreamSessionEvents = (
  data: AgentSessionsStreamSessionEventsData
): CancelablePromise<AgentSessionsStreamSessionEventsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/agent/sessions/{session_id}/stream",
    path: {
      session_id: data.sessionId,
      workspace_id: data.workspaceId,
    },
    query: {
      format: data.format,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Fork Session
 * Fork an existing session to continue conversation post-decision.
 *
 * Creates a new session linked to the parent session, allowing users
 * to ask the agent for context after making approval decisions.
 *
 * Set entity_type to 'approval' for inbox forks to hide from main chat list.
 * @param data The data for the request.
 * @param data.sessionId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns AgentSessionRead Successful Response
 * @throws ApiError
 */
export const agentSessionsForkSession = (
  data: AgentSessionsForkSessionData
): CancelablePromise<AgentSessionsForkSessionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/agent/sessions/{session_id}/fork",
    path: {
      session_id: data.sessionId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Submit Approvals
 * Submit approval decisions to a running agent workflow.
 *
 * This endpoint sends approval decisions back to an agent workflow
 * that is waiting for human-in-the-loop approval on tool calls.
 *
 * Args:
 * role: The authenticated user role.
 * session_id: The agent session ID (used to lookup the workflow).
 * payload: The approval decisions mapping tool_call_id to decision.
 * session: Database session for workspace-scoped lookups.
 *
 * Raises:
 * HTTPException 400: If the approval submission fails validation.
 * HTTPException 404: If the agent session/workflow is not found.
 * HTTPException 500: For unexpected errors.
 * @param data The data for the request.
 * @param data.sessionId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const approvalsSubmitApprovals = (
  data: ApprovalsSubmitApprovalsData
): CancelablePromise<ApprovalsSubmitApprovalsResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/approvals/{session_id}",
    path: {
      session_id: data.sessionId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Approval
 * Dismiss all pending approvals for a session.
 *
 * If the Temporal workflow is alive, deny the approvals so it fails at the
 * agent step. If the workflow is already gone, delete the approval records
 * directly. The session itself is left intact in both cases.
 * @param data The data for the request.
 * @param data.sessionId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const approvalsDeleteApproval = (
  data: ApprovalsDeleteApprovalData
): CancelablePromise<ApprovalsDeleteApprovalResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/approvals/{session_id}",
    path: {
      session_id: data.sessionId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Watchtower Agents
 * @param data The data for the request.
 * @param data.limit
 * @param data.cursor
 * @param data.agentType
 * @param data.status
 * @returns WatchtowerAgentListResponse Successful Response
 * @throws ApiError
 */
export const watchtowerListWatchtowerAgents = (
  data: WatchtowerListWatchtowerAgentsData = {}
): CancelablePromise<WatchtowerListWatchtowerAgentsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/watchtower/monitor/agents",
    query: {
      limit: data.limit,
      cursor: data.cursor,
      agent_type: data.agentType,
      status: data.status,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Watchtower Agent Sessions
 * @param data The data for the request.
 * @param data.agentId
 * @param data.limit
 * @param data.cursor
 * @param data.workspaceId
 * @param data.state
 * @returns WatchtowerAgentSessionListResponse Successful Response
 * @throws ApiError
 */
export const watchtowerListWatchtowerAgentSessions = (
  data: WatchtowerListWatchtowerAgentSessionsData
): CancelablePromise<WatchtowerListWatchtowerAgentSessionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/watchtower/monitor/agents/{agent_id}/sessions",
    path: {
      agent_id: data.agentId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      workspace_id: data.workspaceId,
      state: data.state,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Watchtower Session Tool Calls
 * @param data The data for the request.
 * @param data.sessionId
 * @param data.limit
 * @param data.cursor
 * @param data.status
 * @returns WatchtowerAgentToolCallListResponse Successful Response
 * @throws ApiError
 */
export const watchtowerListWatchtowerSessionToolCalls = (
  data: WatchtowerListWatchtowerSessionToolCallsData
): CancelablePromise<WatchtowerListWatchtowerSessionToolCallsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/watchtower/monitor/sessions/{session_id}/tool-calls",
    path: {
      session_id: data.sessionId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      status: data.status,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Revoke Watchtower Session
 * @param data The data for the request.
 * @param data.sessionId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const watchtowerRevokeWatchtowerSession = (
  data: WatchtowerRevokeWatchtowerSessionData
): CancelablePromise<WatchtowerRevokeWatchtowerSessionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/watchtower/monitor/sessions/{session_id}/revoke",
    path: {
      session_id: data.sessionId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Disable Watchtower Agent
 * @param data The data for the request.
 * @param data.agentId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const watchtowerDisableWatchtowerAgent = (
  data: WatchtowerDisableWatchtowerAgentData
): CancelablePromise<WatchtowerDisableWatchtowerAgentResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/watchtower/monitor/agents/{agent_id}/disable",
    path: {
      agent_id: data.agentId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Enable Watchtower Agent
 * @param data The data for the request.
 * @param data.agentId
 * @returns void Successful Response
 * @throws ApiError
 */
export const watchtowerEnableWatchtowerAgent = (
  data: WatchtowerEnableWatchtowerAgentData
): CancelablePromise<WatchtowerEnableWatchtowerAgentResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/watchtower/monitor/agents/{agent_id}/enable",
    path: {
      agent_id: data.agentId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Organizations
 * List all organizations.
 * @returns tracecat_ee__admin__organizations__schemas__OrgRead Successful Response
 * @throws ApiError
 */
export const adminListOrganizations =
  (): CancelablePromise<AdminListOrganizationsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/admin/organizations",
    })
  }

/**
 * Create Organization
 * Create a new organization.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns tracecat_ee__admin__organizations__schemas__OrgRead Successful Response
 * @throws ApiError
 */
export const adminCreateOrganization = (
  data: AdminCreateOrganizationData
): CancelablePromise<AdminCreateOrganizationResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/organizations",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Organization
 * Get organization by ID.
 * @param data The data for the request.
 * @param data.orgId
 * @returns tracecat_ee__admin__organizations__schemas__OrgRead Successful Response
 * @throws ApiError
 */
export const adminGetOrganization = (
  data: AdminGetOrganizationData
): CancelablePromise<AdminGetOrganizationResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/organizations/{org_id}",
    path: {
      org_id: data.orgId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Organization
 * Update organization.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.requestBody
 * @returns tracecat_ee__admin__organizations__schemas__OrgRead Successful Response
 * @throws ApiError
 */
export const adminUpdateOrganization = (
  data: AdminUpdateOrganizationData
): CancelablePromise<AdminUpdateOrganizationResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/admin/organizations/{org_id}",
    path: {
      org_id: data.orgId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Organization
 * Delete organization.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.confirm Must exactly match the organization name.
 * @returns void Successful Response
 * @throws ApiError
 */
export const adminDeleteOrganization = (
  data: AdminDeleteOrganizationData
): CancelablePromise<AdminDeleteOrganizationResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/admin/organizations/{org_id}",
    path: {
      org_id: data.orgId,
    },
    query: {
      confirm: data.confirm,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Organization Invitation
 * Create a platform-scoped invitation for an organization.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.requestBody
 * @returns AdminOrgInvitationCreateResponse Successful Response
 * @throws ApiError
 */
export const adminCreateOrganizationInvitation = (
  data: AdminCreateOrganizationInvitationData
): CancelablePromise<AdminCreateOrganizationInvitationResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/organizations/{org_id}/invitations",
    path: {
      org_id: data.orgId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Organization Invitations
 * List platform-created invitations for an organization.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.status
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_AdminOrgInvitationRead_ Successful Response
 * @throws ApiError
 */
export const adminListOrganizationInvitations = (
  data: AdminListOrganizationInvitationsData
): CancelablePromise<AdminListOrganizationInvitationsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/organizations/{org_id}/invitations",
    path: {
      org_id: data.orgId,
    },
    query: {
      status: data.status,
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Organization Invitation Token
 * Get the raw token for a platform-created organization invitation.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.invitationId
 * @returns AdminOrgInvitationTokenRead Successful Response
 * @throws ApiError
 */
export const adminGetOrganizationInvitationToken = (
  data: AdminGetOrganizationInvitationTokenData
): CancelablePromise<AdminGetOrganizationInvitationTokenResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/organizations/{org_id}/invitations/{invitation_id}/token",
    path: {
      org_id: data.orgId,
      invitation_id: data.invitationId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Revoke Organization Invitation
 * Revoke a pending platform-created organization invitation.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.invitationId
 * @returns void Successful Response
 * @throws ApiError
 */
export const adminRevokeOrganizationInvitation = (
  data: AdminRevokeOrganizationInvitationData
): CancelablePromise<AdminRevokeOrganizationInvitationResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/admin/organizations/{org_id}/invitations/{invitation_id}",
    path: {
      org_id: data.orgId,
      invitation_id: data.invitationId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Organization Domains
 * List all assigned domains for an organization.
 * @param data The data for the request.
 * @param data.orgId
 * @returns tracecat_ee__admin__organizations__schemas__OrgDomainRead Successful Response
 * @throws ApiError
 */
export const adminListOrganizationDomains = (
  data: AdminListOrganizationDomainsData
): CancelablePromise<AdminListOrganizationDomainsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/organizations/{org_id}/domains",
    path: {
      org_id: data.orgId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Organization Domain
 * Create a new assigned domain for an organization.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.requestBody
 * @returns tracecat_ee__admin__organizations__schemas__OrgDomainRead Successful Response
 * @throws ApiError
 */
export const adminCreateOrganizationDomain = (
  data: AdminCreateOrganizationDomainData
): CancelablePromise<AdminCreateOrganizationDomainResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/organizations/{org_id}/domains",
    path: {
      org_id: data.orgId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Organization Domain
 * Update active/primary state for an assigned organization domain.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.domainId
 * @param data.requestBody
 * @returns tracecat_ee__admin__organizations__schemas__OrgDomainRead Successful Response
 * @throws ApiError
 */
export const adminUpdateOrganizationDomain = (
  data: AdminUpdateOrganizationDomainData
): CancelablePromise<AdminUpdateOrganizationDomainResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/admin/organizations/{org_id}/domains/{domain_id}",
    path: {
      org_id: data.orgId,
      domain_id: data.domainId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Organization Domain
 * Delete an assigned organization domain.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.domainId
 * @returns void Successful Response
 * @throws ApiError
 */
export const adminDeleteOrganizationDomain = (
  data: AdminDeleteOrganizationDomainData
): CancelablePromise<AdminDeleteOrganizationDomainResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/admin/organizations/{org_id}/domains/{domain_id}",
    path: {
      org_id: data.orgId,
      domain_id: data.domainId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Org Repositories
 * List registry repositories for an organization.
 * @param data The data for the request.
 * @param data.orgId
 * @returns OrgRegistryRepositoryRead Successful Response
 * @throws ApiError
 */
export const adminListOrgRepositories = (
  data: AdminListOrgRepositoriesData
): CancelablePromise<AdminListOrgRepositoriesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/organizations/{org_id}/registry/repositories",
    path: {
      org_id: data.orgId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Org Repository Versions
 * List versions for a specific repository in an organization.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.repositoryId
 * @returns OrgRegistryVersionRead Successful Response
 * @throws ApiError
 */
export const adminListOrgRepositoryVersions = (
  data: AdminListOrgRepositoryVersionsData
): CancelablePromise<AdminListOrgRepositoryVersionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/organizations/{org_id}/registry/repositories/{repository_id}/versions",
    path: {
      org_id: data.orgId,
      repository_id: data.repositoryId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Sync Org Repository
 * Sync a registry repository for an organization.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.repositoryId
 * @param data.requestBody
 * @returns OrgRegistrySyncResponse Successful Response
 * @throws ApiError
 */
export const adminSyncOrgRepository = (
  data: AdminSyncOrgRepositoryData
): CancelablePromise<AdminSyncOrgRepositoryResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/organizations/{org_id}/registry/repositories/{repository_id}/sync",
    path: {
      org_id: data.orgId,
      repository_id: data.repositoryId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Promote Org Repository Version
 * Promote a registry version to be the current version for an org repository.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.repositoryId
 * @param data.versionId
 * @returns OrgRegistryVersionPromoteResponse Successful Response
 * @throws ApiError
 */
export const adminPromoteOrgRepositoryVersion = (
  data: AdminPromoteOrgRepositoryVersionData
): CancelablePromise<AdminPromoteOrgRepositoryVersionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/organizations/{org_id}/registry/repositories/{repository_id}/versions/{version_id}/promote",
    path: {
      org_id: data.orgId,
      repository_id: data.repositoryId,
      version_id: data.versionId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Registry Settings
 * Get platform registry settings.
 * @returns PlatformRegistrySettingsRead Successful Response
 * @throws ApiError
 */
export const adminGetRegistrySettings =
  (): CancelablePromise<AdminGetRegistrySettingsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/admin/settings/registry",
    })
  }

/**
 * Update Registry Settings
 * Update platform registry settings.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns PlatformRegistrySettingsRead Successful Response
 * @throws ApiError
 */
export const adminUpdateRegistrySettings = (
  data: AdminUpdateRegistrySettingsData
): CancelablePromise<AdminUpdateRegistrySettingsResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/admin/settings/registry",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Tiers
 * List all tiers.
 * @param data The data for the request.
 * @param data.includeInactive Include inactive tiers in results
 * @returns TierRead Successful Response
 * @throws ApiError
 */
export const adminListTiers = (
  data: AdminListTiersData = {}
): CancelablePromise<AdminListTiersResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/tiers",
    query: {
      include_inactive: data.includeInactive,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Tier
 * Create a new tier.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns TierRead Successful Response
 * @throws ApiError
 */
export const adminCreateTier = (
  data: AdminCreateTierData
): CancelablePromise<AdminCreateTierResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/tiers",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Org Tiers
 * List tier assignments for organizations.
 * @param data The data for the request.
 * @param data.orgIds Optional list of organization IDs to filter results
 * @returns OrganizationTierRead Successful Response
 * @throws ApiError
 */
export const adminListOrgTiers = (
  data: AdminListOrgTiersData = {}
): CancelablePromise<AdminListOrgTiersResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/tiers/organizations",
    query: {
      org_ids: data.orgIds,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Tier
 * Get tier by ID.
 * @param data The data for the request.
 * @param data.tierId
 * @returns TierRead Successful Response
 * @throws ApiError
 */
export const adminGetTier = (
  data: AdminGetTierData
): CancelablePromise<AdminGetTierResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/tiers/{tier_id}",
    path: {
      tier_id: data.tierId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Tier
 * Update a tier.
 * @param data The data for the request.
 * @param data.tierId
 * @param data.requestBody
 * @returns TierRead Successful Response
 * @throws ApiError
 */
export const adminUpdateTier = (
  data: AdminUpdateTierData
): CancelablePromise<AdminUpdateTierResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/admin/tiers/{tier_id}",
    path: {
      tier_id: data.tierId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Tier
 * Delete a tier (only if no orgs are assigned to it).
 * @param data The data for the request.
 * @param data.tierId
 * @returns void Successful Response
 * @throws ApiError
 */
export const adminDeleteTier = (
  data: AdminDeleteTierData
): CancelablePromise<AdminDeleteTierResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/admin/tiers/{tier_id}",
    path: {
      tier_id: data.tierId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Org Tier
 * Get tier assignment for an organization.
 * @param data The data for the request.
 * @param data.orgId
 * @returns OrganizationTierRead Successful Response
 * @throws ApiError
 */
export const adminGetOrgTier = (
  data: AdminGetOrgTierData
): CancelablePromise<AdminGetOrgTierResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/tiers/organizations/{org_id}",
    path: {
      org_id: data.orgId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Org Tier
 * Update organization's tier assignment and overrides.
 * @param data The data for the request.
 * @param data.orgId
 * @param data.requestBody
 * @returns OrganizationTierRead Successful Response
 * @throws ApiError
 */
export const adminUpdateOrgTier = (
  data: AdminUpdateOrgTierData
): CancelablePromise<AdminUpdateOrgTierResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/admin/tiers/organizations/{org_id}",
    path: {
      org_id: data.orgId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Users
 * List all users.
 * @returns AdminUserRead Successful Response
 * @throws ApiError
 */
export const adminListUsers = (): CancelablePromise<AdminListUsersResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/users",
  })
}

/**
 * Create User
 * Create a platform-level user without org membership.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns AdminUserRead Successful Response
 * @throws ApiError
 */
export const adminCreateUser = (
  data: AdminCreateUserData
): CancelablePromise<AdminCreateUserResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/users",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get User
 * Get user by ID.
 * @param data The data for the request.
 * @param data.userId
 * @returns AdminUserRead Successful Response
 * @throws ApiError
 */
export const adminGetUser = (
  data: AdminGetUserData
): CancelablePromise<AdminGetUserResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/users/{user_id}",
    path: {
      user_id: data.userId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Promote To Superuser
 * Promote a user to superuser status.
 * @param data The data for the request.
 * @param data.userId
 * @returns AdminUserRead Successful Response
 * @throws ApiError
 */
export const adminPromoteToSuperuser = (
  data: AdminPromoteToSuperuserData
): CancelablePromise<AdminPromoteToSuperuserResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/users/{user_id}/promote",
    path: {
      user_id: data.userId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Demote From Superuser
 * Remove superuser status from a user.
 * @param data The data for the request.
 * @param data.userId
 * @returns AdminUserRead Successful Response
 * @throws ApiError
 */
export const adminDemoteFromSuperuser = (
  data: AdminDemoteFromSuperuserData
): CancelablePromise<AdminDemoteFromSuperuserResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/users/{user_id}/demote",
    path: {
      user_id: data.userId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Platform Catalog
 * List platform-owned agent catalog entries.
 * @param data The data for the request.
 * @param data.provider
 * @param data.modelName
 * @param data.cursor
 * @param data.limit
 * @returns AgentCatalogListResponse Successful Response
 * @throws ApiError
 */
export const adminAgentListPlatformCatalog = (
  data: AdminAgentListPlatformCatalogData = {}
): CancelablePromise<AdminAgentListPlatformCatalogResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/agent/catalog",
    query: {
      provider: data.provider,
      model_name: data.modelName,
      cursor: data.cursor,
      limit: data.limit,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Platform Repositories
 * List all platform registry repositories.
 * @returns RegistryRepositoryReadMinimal Successful Response
 * @throws ApiError
 */
export const adminRegistryListPlatformRepositories =
  (): CancelablePromise<AdminRegistryListPlatformRepositoriesResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/admin/registry/repos",
    })
  }

/**
 * Get Platform Repository
 * Get a specific platform registry repository.
 * @param data The data for the request.
 * @param data.repositoryId
 * @returns RegistryRepositoryRead Successful Response
 * @throws ApiError
 */
export const adminRegistryGetPlatformRepository = (
  data: AdminRegistryGetPlatformRepositoryData
): CancelablePromise<AdminRegistryGetPlatformRepositoryResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/registry/repos/{repository_id}",
    path: {
      repository_id: data.repositoryId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Sync All Repositories
 * Trigger sync for all platform registry repositories.
 * @param data The data for the request.
 * @param data.force Force sync by deleting existing version
 * @returns tracecat__admin__registry__schemas__RegistrySyncResponse Successful Response
 * @throws ApiError
 */
export const adminRegistrySyncAllRepositories = (
  data: AdminRegistrySyncAllRepositoriesData = {}
): CancelablePromise<AdminRegistrySyncAllRepositoriesResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/registry/sync",
    query: {
      force: data.force,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Sync Repository
 * Trigger sync for a specific platform registry repository.
 * @param data The data for the request.
 * @param data.repositoryId
 * @param data.force Force sync by deleting existing version
 * @returns tracecat__admin__registry__schemas__RegistrySyncResponse Successful Response
 * @throws ApiError
 */
export const adminRegistrySyncRepository = (
  data: AdminRegistrySyncRepositoryData
): CancelablePromise<AdminRegistrySyncRepositoryResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/registry/sync/{repository_id}",
    path: {
      repository_id: data.repositoryId,
    },
    query: {
      force: data.force,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Registry Status
 * Get registry sync status and health.
 * @returns RegistryStatusResponse Successful Response
 * @throws ApiError
 */
export const adminRegistryGetRegistryStatus =
  (): CancelablePromise<AdminRegistryGetRegistryStatusResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/admin/registry/status",
    })
  }

/**
 * List Registry Versions
 * List registry versions with optional filtering.
 * @param data The data for the request.
 * @param data.repositoryId
 * @param data.limit
 * @returns tracecat__admin__registry__schemas__RegistryVersionRead Successful Response
 * @throws ApiError
 */
export const adminRegistryListRegistryVersions = (
  data: AdminRegistryListRegistryVersionsData = {}
): CancelablePromise<AdminRegistryListRegistryVersionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/admin/registry/versions",
    query: {
      repository_id: data.repositoryId,
      limit: data.limit,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Start Registry Artifacts Backfill
 * Start a workflow to backfill artifacts for selected versions.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns RegistryArtifactsBackfillStartResponse Successful Response
 * @throws ApiError
 */
export const adminRegistryStartRegistryArtifactsBackfill = (
  data: AdminRegistryStartRegistryArtifactsBackfillData
): CancelablePromise<AdminRegistryStartRegistryArtifactsBackfillResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/registry/versions/artifacts/backfill",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Promote Registry Version
 * Promote a registry version to be the current version for a repository.
 * @param data The data for the request.
 * @param data.repositoryId
 * @param data.versionId
 * @returns tracecat__admin__registry__schemas__RegistryVersionPromoteResponse Successful Response
 * @throws ApiError
 */
export const adminRegistryPromoteRegistryVersion = (
  data: AdminRegistryPromoteRegistryVersionData
): CancelablePromise<AdminRegistryPromoteRegistryVersionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/admin/registry/{repository_id}/versions/{version_id}/promote",
    path: {
      repository_id: data.repositoryId,
      version_id: data.versionId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Pending Count
 * Get the number of pending inbox items that require attention.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns InboxPendingCount Successful Response
 * @throws ApiError
 */
export const inboxGetPendingCount = (
  data: InboxGetPendingCountData
): CancelablePromise<InboxGetPendingCountResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/inbox/items/pending-count",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Items
 * List inbox items with cursor-based pagination.
 *
 * Supports sorting by created_at, updated_at, or status.
 * Default sort is by created_at descending.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @param data.orderBy Column name to order by (created_at, updated_at, status)
 * @param data.sort Sort direction (asc or desc)
 * @returns CursorPaginatedResponse_InboxItemRead_ Successful Response
 * @throws ApiError
 */
export const inboxListItems = (
  data: InboxListItemsData
): CancelablePromise<InboxListItemsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/inbox/items",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
      order_by: data.orderBy,
      sort: data.sort,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Functions
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns EditorFunctionRead Successful Response
 * @throws ApiError
 */
export const editorListFunctions = (
  data: EditorListFunctionsData
): CancelablePromise<EditorListFunctionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/editor/functions",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Actions
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.workflowId
 * @returns EditorActionRead Successful Response
 * @throws ApiError
 */
export const editorListActions = (
  data: EditorListActionsData
): CancelablePromise<EditorListActionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/editor/actions",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      workflow_id: data.workflowId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Validate Expression
 * LSP endpoint for validating template expressions using the Lark grammar.
 *
 * This endpoint provides syntax validation and token information for syntax highlighting
 * of template expressions like: ACTIONS.step1.result, SECRETS.api_key, etc.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns ExpressionValidationResponse Successful Response
 * @throws ApiError
 */
export const editorValidateExpression = (
  data: EditorValidateExpressionData
): CancelablePromise<EditorValidateExpressionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/editor/expressions/validate",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Field Schema
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns EditorComponent Successful Response
 * @throws ApiError
 */
export const editorFieldSchema = (
  data: EditorFieldSchemaData
): CancelablePromise<EditorFieldSchemaResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/editor/field-schema",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Sync Registry Repository
 * Sync an org-scoped registry repository.
 *
 * For platform registries (base registry), use the admin API at /admin/registry/sync.
 *
 * Args:
 * repository_id: The ID of the repository to sync
 * sync_params: Optional sync parameters, including target commit SHA and force flag
 *
 * Raises:
 * 422: If there is an error syncing the repository (validation error)
 * 404: If the repository is not found
 * 400: If there is an error syncing the repository
 * @param data The data for the request.
 * @param data.repositoryId
 * @param data.requestBody
 * @returns tracecat__registry__repositories__schemas__RegistrySyncResponse Successful Response
 * @throws ApiError
 */
export const registryRepositoriesSyncRegistryRepository = (
  data: RegistryRepositoriesSyncRegistryRepositoryData
): CancelablePromise<RegistryRepositoriesSyncRegistryRepositoryResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/registry/repos/{repository_id}/sync",
    path: {
      repository_id: data.repositoryId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      400: "Cannot sync repository",
      404: "Registry repository not found",
      422: "Registry sync validation error",
    },
  })
}

/**
 * List Repository Versions
 * List all versions for an org-scoped registry repository.
 *
 * For platform registry versions, use the admin API at /admin/registry/versions.
 * @param data The data for the request.
 * @param data.repositoryId
 * @returns tracecat__registry__repositories__schemas__RegistryVersionRead Successful Response
 * @throws ApiError
 */
export const registryRepositoriesListRepositoryVersions = (
  data: RegistryRepositoriesListRepositoryVersionsData
): CancelablePromise<RegistryRepositoriesListRepositoryVersionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/registry/repos/{repository_id}/versions",
    path: {
      repository_id: data.repositoryId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Registry Repositories
 * List org-scoped registry repositories.
 *
 * This endpoint ensures org-scoped repositories (local, custom git) exist
 * before returning the list. Platform registry is handled separately at startup.
 *
 * For platform registries (base registry), use the admin API at /admin/registry/repos.
 * @returns RegistryRepositoryReadMinimal Successful Response
 * @throws ApiError
 */
export const registryRepositoriesListRegistryRepositories =
  (): CancelablePromise<RegistryRepositoriesListRegistryRepositoriesResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/registry/repos",
    })
  }

/**
 * Create Registry Repository
 * Create a new registry repository.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns RegistryRepositoryRead Successful Response
 * @throws ApiError
 */
export const registryRepositoriesCreateRegistryRepository = (
  data: RegistryRepositoriesCreateRegistryRepositoryData
): CancelablePromise<RegistryRepositoriesCreateRegistryRepositoryResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/registry/repos",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Registry Repository
 * Get a specific org-scoped registry repository by ID.
 *
 * For platform registries, use the admin API at /admin/registry/repos/{repository_id}.
 * @param data The data for the request.
 * @param data.repositoryId
 * @returns RegistryRepositoryRead Successful Response
 * @throws ApiError
 */
export const registryRepositoriesGetRegistryRepository = (
  data: RegistryRepositoriesGetRegistryRepositoryData
): CancelablePromise<RegistryRepositoriesGetRegistryRepositoryResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/registry/repos/{repository_id}",
    path: {
      repository_id: data.repositoryId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Registry Repository
 * Update an existing registry repository.
 * @param data The data for the request.
 * @param data.repositoryId
 * @param data.requestBody
 * @returns RegistryRepositoryRead Successful Response
 * @throws ApiError
 */
export const registryRepositoriesUpdateRegistryRepository = (
  data: RegistryRepositoriesUpdateRegistryRepositoryData
): CancelablePromise<RegistryRepositoriesUpdateRegistryRepositoryResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/registry/repos/{repository_id}",
    path: {
      repository_id: data.repositoryId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Registry Repository
 * Delete a registry repository.
 * @param data The data for the request.
 * @param data.repositoryId
 * @returns void Successful Response
 * @throws ApiError
 */
export const registryRepositoriesDeleteRegistryRepository = (
  data: RegistryRepositoriesDeleteRegistryRepositoryData
): CancelablePromise<RegistryRepositoriesDeleteRegistryRepositoryResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/registry/repos/{repository_id}",
    path: {
      repository_id: data.repositoryId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Repository Commits
 * List commits from a specific registry repository.
 * @param data The data for the request.
 * @param data.repositoryId
 * @param data.branch
 * @param data.limit
 * @returns GitCommitInfo Successful Response
 * @throws ApiError
 */
export const registryRepositoriesListRepositoryCommits = (
  data: RegistryRepositoriesListRepositoryCommitsData
): CancelablePromise<RegistryRepositoriesListRepositoryCommitsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/registry/repos/{repository_id}/commits",
    path: {
      repository_id: data.repositoryId,
    },
    query: {
      branch: data.branch,
      limit: data.limit,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Promote Registry Version
 * Promote a specific version to be the current version of an org-scoped repository.
 *
 * This endpoint allows administrators to manually promote or rollback to a
 * specific registry version, overriding the auto-promotion that happens during sync.
 *
 * For platform registries, use the admin API at
 * /admin/registry/{repository_id}/versions/{version_id}/promote.
 *
 * Args:
 * repository_id: The ID of the repository
 * version_id: The ID of the version to promote
 *
 * Returns:
 * RegistryVersionPromoteResponse with previous and current version info
 *
 * Raises:
 * 404: If repository or version not found
 * 400: If version doesn't belong to repository or has no tarball
 * @param data The data for the request.
 * @param data.repositoryId
 * @param data.versionId
 * @returns tracecat__registry__repositories__schemas__RegistryVersionPromoteResponse Successful Response
 * @throws ApiError
 */
export const registryRepositoriesPromoteRegistryVersion = (
  data: RegistryRepositoriesPromoteRegistryVersionData
): CancelablePromise<RegistryRepositoriesPromoteRegistryVersionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/registry/repos/{repository_id}/versions/{version_id}/promote",
    path: {
      repository_id: data.repositoryId,
      version_id: data.versionId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Registry Version
 * Delete a specific registry version.
 *
 * Safety checks:
 * - Cannot delete the currently promoted version
 * - Cannot delete versions referenced by published workflow definitions
 *
 * For platform registries, use the admin API.
 * @param data The data for the request.
 * @param data.repositoryId
 * @param data.versionId
 * @returns void Successful Response
 * @throws ApiError
 */
export const registryRepositoriesDeleteRegistryVersion = (
  data: RegistryRepositoriesDeleteRegistryVersionData
): CancelablePromise<RegistryRepositoriesDeleteRegistryVersionResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/registry/repos/{repository_id}/versions/{version_id}",
    path: {
      repository_id: data.repositoryId,
      version_id: data.versionId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Compare Registry Versions
 * Compare two registry versions and return the diff.
 *
 * Args:
 * repository_id: The repository ID
 * version_id: The base version ID (typically older)
 * compare_to: The version ID to compare against (typically newer)
 *
 * Returns:
 * VersionDiff with added, removed, and modified actions
 * @param data The data for the request.
 * @param data.repositoryId
 * @param data.versionId
 * @param data.compareTo
 * @returns VersionDiff Successful Response
 * @throws ApiError
 */
export const registryRepositoriesCompareRegistryVersions = (
  data: RegistryRepositoriesCompareRegistryVersionsData
): CancelablePromise<RegistryRepositoriesCompareRegistryVersionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/registry/repos/{repository_id}/versions/{version_id}/diff",
    path: {
      repository_id: data.repositoryId,
      version_id: data.versionId,
    },
    query: {
      compare_to: data.compareTo,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Previous Registry Version
 * Get the previous version before the specified version.
 *
 * Useful for quick rollback UX - returns the version to rollback to.
 * Returns null if there is no previous version.
 * @param data The data for the request.
 * @param data.repositoryId
 * @param data.versionId
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const registryRepositoriesGetPreviousRegistryVersion = (
  data: RegistryRepositoriesGetPreviousRegistryVersionData
): CancelablePromise<RegistryRepositoriesGetPreviousRegistryVersionResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/registry/repos/{repository_id}/versions/{version_id}/previous",
    path: {
      repository_id: data.repositoryId,
      version_id: data.versionId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Registry Actions
 * List all actions from registry index.
 * @param data The data for the request.
 * @param data.includeLocked Include actions locked by missing entitlements
 * @returns RegistryActionReadMinimal Successful Response
 * @throws ApiError
 */
export const registryActionsListRegistryActions = (
  data: RegistryActionsListRegistryActionsData = {}
): CancelablePromise<RegistryActionsListRegistryActionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/registry/actions",
    query: {
      include_locked: data.includeLocked,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Registry Action
 * Get a specific registry action.
 * @param data The data for the request.
 * @param data.actionName
 * @returns RegistryActionRead Successful Response
 * @throws ApiError
 */
export const registryActionsGetRegistryAction = (
  data: RegistryActionsGetRegistryActionData
): CancelablePromise<RegistryActionsGetRegistryActionResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/registry/actions/{action_name}",
    path: {
      action_name: data.actionName,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Git Settings
 * @returns GitSettingsRead Successful Response
 * @throws ApiError
 */
export const settingsGetGitSettings =
  (): CancelablePromise<SettingsGetGitSettingsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/settings/git",
    })
  }

/**
 * Update Git Settings
 * @param data The data for the request.
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const settingsUpdateGitSettings = (
  data: SettingsUpdateGitSettingsData
): CancelablePromise<SettingsUpdateGitSettingsResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/settings/git",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Saml Settings
 * @returns SAMLSettingsRead Successful Response
 * @throws ApiError
 */
export const settingsGetSamlSettings =
  (): CancelablePromise<SettingsGetSamlSettingsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/settings/saml",
    })
  }

/**
 * Update Saml Settings
 * @param data The data for the request.
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const settingsUpdateSamlSettings = (
  data: SettingsUpdateSamlSettingsData
): CancelablePromise<SettingsUpdateSamlSettingsResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/settings/saml",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get App Settings
 * @returns AppSettingsRead Successful Response
 * @throws ApiError
 */
export const settingsGetAppSettings =
  (): CancelablePromise<SettingsGetAppSettingsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/settings/app",
    })
  }

/**
 * Update App Settings
 * @param data The data for the request.
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const settingsUpdateAppSettings = (
  data: SettingsUpdateAppSettingsData
): CancelablePromise<SettingsUpdateAppSettingsResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/settings/app",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Audit Settings
 * @returns AuditSettingsRead Successful Response
 * @throws ApiError
 */
export const settingsGetAuditSettings =
  (): CancelablePromise<SettingsGetAuditSettingsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/settings/audit",
    })
  }

/**
 * Update Audit Settings
 * @param data The data for the request.
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const settingsUpdateAuditSettings = (
  data: SettingsUpdateAuditSettingsData
): CancelablePromise<SettingsUpdateAuditSettingsResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/settings/audit",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Agent Settings
 * @returns AgentSettingsRead Successful Response
 * @throws ApiError
 */
export const settingsGetAgentSettings =
  (): CancelablePromise<SettingsGetAgentSettingsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/settings/agent",
    })
  }

/**
 * Update Agent Settings
 * @param data The data for the request.
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const settingsUpdateAgentSettings = (
  data: SettingsUpdateAgentSettingsData
): CancelablePromise<SettingsUpdateAgentSettingsResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/settings/agent",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Org Secrets
 * List organization secrets.
 * @param data The data for the request.
 * @param data.type Filter by secret type
 * @returns SecretReadMinimal Successful Response
 * @throws ApiError
 */
export const organizationSecretsListOrgSecrets = (
  data: OrganizationSecretsListOrgSecretsData = {}
): CancelablePromise<OrganizationSecretsListOrgSecretsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/secrets",
    query: {
      type: data.type,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Org Secret
 * Create an organization secret.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const organizationSecretsCreateOrgSecret = (
  data: OrganizationSecretsCreateOrgSecretData
): CancelablePromise<OrganizationSecretsCreateOrgSecretResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/secrets",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Org Secret By Name
 * Get an organization secret by name.
 * @param data The data for the request.
 * @param data.secretName
 * @param data.environment
 * @returns OrganizationSecretRead Successful Response
 * @throws ApiError
 */
export const organizationSecretsGetOrgSecretByName = (
  data: OrganizationSecretsGetOrgSecretByNameData
): CancelablePromise<OrganizationSecretsGetOrgSecretByNameResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/secrets/{secret_name}",
    path: {
      secret_name: data.secretName,
    },
    query: {
      environment: data.environment,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Org Secret By Id
 * Update an organization secret by ID.
 * @param data The data for the request.
 * @param data.secretId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const organizationSecretsUpdateOrgSecretById = (
  data: OrganizationSecretsUpdateOrgSecretByIdData
): CancelablePromise<OrganizationSecretsUpdateOrgSecretByIdResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/secrets/{secret_id}",
    path: {
      secret_id: data.secretId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Org Secret By Id
 * Delete an organization secret by ID.
 * @param data The data for the request.
 * @param data.secretId
 * @returns void Successful Response
 * @throws ApiError
 */
export const organizationSecretsDeleteOrgSecretById = (
  data: OrganizationSecretsDeleteOrgSecretByIdData
): CancelablePromise<OrganizationSecretsDeleteOrgSecretByIdResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/organization/secrets/{secret_id}",
    path: {
      secret_id: data.secretId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Tables
 * List all tables.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns TableReadMinimal Successful Response
 * @throws ApiError
 */
export const tablesListTables = (
  data: TablesListTablesData
): CancelablePromise<TablesListTablesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/tables",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Table
 * Create a new table.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const tablesCreateTable = (
  data: TablesCreateTableData
): CancelablePromise<TablesCreateTableResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/tables",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Table
 * Get a table by ID.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.workspaceId
 * @returns TableRead Successful Response
 * @throws ApiError
 */
export const tablesGetTable = (
  data: TablesGetTableData
): CancelablePromise<TablesGetTableResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/tables/{table_id}",
    path: {
      table_id: data.tableId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Table
 * Update table metadata.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const tablesUpdateTable = (
  data: TablesUpdateTableData
): CancelablePromise<TablesUpdateTableResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/tables/{table_id}",
    path: {
      table_id: data.tableId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Table
 * Delete a table.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const tablesDeleteTable = (
  data: TablesDeleteTableData
): CancelablePromise<TablesDeleteTableResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/tables/{table_id}",
    path: {
      table_id: data.tableId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Column
 * Add a column to a table.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const tablesCreateColumn = (
  data: TablesCreateColumnData
): CancelablePromise<TablesCreateColumnResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/tables/{table_id}/columns",
    path: {
      table_id: data.tableId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Column
 * Update a column.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.columnId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const tablesUpdateColumn = (
  data: TablesUpdateColumnData
): CancelablePromise<TablesUpdateColumnResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/tables/{table_id}/columns/{column_id}",
    path: {
      table_id: data.tableId,
      column_id: data.columnId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Column
 * Delete a column from a table.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.columnId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const tablesDeleteColumn = (
  data: TablesDeleteColumnData
): CancelablePromise<TablesDeleteColumnResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/tables/{table_id}/columns/{column_id}",
    path: {
      table_id: data.tableId,
      column_id: data.columnId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Rows
 * List table rows with cursor-based pagination and sorting.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.workspaceId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @param data.orderBy Column name to order by
 * @param data.sort Sort direction (asc or desc)
 * @returns CursorPaginatedResponse_TableRowRead_ Successful Response
 * @throws ApiError
 */
export const tablesListRows = (
  data: TablesListRowsData
): CancelablePromise<TablesListRowsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/tables/{table_id}/rows",
    path: {
      table_id: data.tableId,
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
      order_by: data.orderBy,
      sort: data.sort,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Insert Row
 * Create a new row in a table.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const tablesInsertRow = (
  data: TablesInsertRowData
): CancelablePromise<TablesInsertRowResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/tables/{table_id}/rows",
    path: {
      table_id: data.tableId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Row
 * Get a row by ID.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.rowId
 * @param data.workspaceId
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const tablesGetRow = (
  data: TablesGetRowData
): CancelablePromise<TablesGetRowResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/tables/{table_id}/rows/{row_id}",
    path: {
      table_id: data.tableId,
      row_id: data.rowId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Row
 * Delete a row from a table.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.rowId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const tablesDeleteRow = (
  data: TablesDeleteRowData
): CancelablePromise<TablesDeleteRowResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/tables/{table_id}/rows/{row_id}",
    path: {
      table_id: data.tableId,
      row_id: data.rowId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Row
 * Update a row in a table.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.rowId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns TableRowRead Successful Response
 * @throws ApiError
 */
export const tablesUpdateRow = (
  data: TablesUpdateRowData
): CancelablePromise<TablesUpdateRowResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/tables/{table_id}/rows/{row_id}",
    path: {
      table_id: data.tableId,
      row_id: data.rowId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Batch Insert Rows
 * Insert multiple rows into a table atomically.
 *
 * All rows will be inserted in a single transaction. If any row fails,
 * the entire batch will be rolled back.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns TableRowInsertBatchResponse Successful Response
 * @throws ApiError
 */
export const tablesBatchInsertRows = (
  data: TablesBatchInsertRowsData
): CancelablePromise<TablesBatchInsertRowsResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/tables/{table_id}/rows/batch",
    path: {
      table_id: data.tableId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Batch Delete Rows
 * Delete multiple rows from a table.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns TableRowBatchDeleteResponse Successful Response
 * @throws ApiError
 */
export const tablesBatchDeleteRows = (
  data: TablesBatchDeleteRowsData
): CancelablePromise<TablesBatchDeleteRowsResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/tables/{table_id}/rows/batch-delete",
    path: {
      table_id: data.tableId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Batch Update Rows
 * Update multiple rows in a table with the same data.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns TableRowBatchUpdateResponse Successful Response
 * @throws ApiError
 */
export const tablesBatchUpdateRows = (
  data: TablesBatchUpdateRowsData
): CancelablePromise<TablesBatchUpdateRowsResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/tables/{table_id}/rows/batch-update",
    path: {
      table_id: data.tableId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Import Table From Csv
 * Create a new table by importing a CSV file.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.formData
 * @returns TableImportResponse Successful Response
 * @throws ApiError
 */
export const tablesImportTableFromCsv = (
  data: TablesImportTableFromCsvData
): CancelablePromise<TablesImportTableFromCsvResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/tables/import",
    path: {
      workspace_id: data.workspaceId,
    },
    formData: data.formData,
    mediaType: "multipart/form-data",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Import Csv
 * Import data from a CSV file into a table.
 * @param data The data for the request.
 * @param data.tableId
 * @param data.workspaceId
 * @param data.formData
 * @returns TableRowInsertBatchResponse Successful Response
 * @throws ApiError
 */
export const tablesImportCsv = (
  data: TablesImportCsvData
): CancelablePromise<TablesImportCsvResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/tables/{table_id}/import",
    path: {
      table_id: data.tableId,
      workspace_id: data.workspaceId,
    },
    formData: data.formData,
    mediaType: "multipart/form-data",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Cases
 * List cases with default filtering and sorting options.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.limit Maximum items per page
 * @param data.cursor Cursor for pagination
 * @param data.reverse Reverse pagination direction
 * @param data.orderBy Column name to order by (e.g. created_at, updated_at, priority, severity, status, tasks). Default: created_at
 * @param data.sort Direction to sort (asc or desc)
 * @param data.includeRows Include linked table rows
 * @param data.fieldIds Include only the requested custom field IDs
 * @param data.includeDurations Include case duration values
 * @returns CursorPaginatedResponse_CaseReadMinimal_ Successful Response
 * @throws ApiError
 */
export const casesListCases = (
  data: CasesListCasesData
): CancelablePromise<CasesListCasesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
      order_by: data.orderBy,
      sort: data.sort,
      include_rows: data.includeRows,
      field_ids: data.fieldIds,
      include_durations: data.includeDurations,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Case
 * Create a new case.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const casesCreateCase = (
  data: CasesCreateCaseData
): CancelablePromise<CasesCreateCaseResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/cases",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Search Cases
 * Search cases with cursor-based pagination, filtering, and sorting.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.limit Maximum items per page
 * @param data.cursor Cursor for pagination
 * @param data.reverse Reverse pagination direction
 * @param data.searchTerm Text to search for in case summary, description, or short ID
 * @param data.shortId Search by exact case short ID (e.g. 42 or CASE-0042)
 * @param data.status Filter by case status
 * @param data.priority Filter by case priority
 * @param data.severity Filter by case severity
 * @param data.tags Filter by tag IDs or slugs (AND logic)
 * @param data.dropdown Filter by dropdown values. Format: definition_ref:option_ref (AND across definitions, OR within)
 * @param data.startTime Return cases created at or after this timestamp
 * @param data.endTime Return cases created at or before this timestamp
 * @param data.updatedAfter Return cases updated at or after this timestamp
 * @param data.updatedBefore Return cases updated at or before this timestamp
 * @param data.assigneeId Filter by assignee ID or 'unassigned'
 * @param data.orderBy Column name to order by (e.g. created_at, updated_at, priority, severity, status, tasks). Default: created_at
 * @param data.sort Direction to sort (asc or desc)
 * @param data.includeRows Include linked table rows
 * @param data.fieldIds Include only the requested custom field IDs
 * @param data.includeDurations Include case duration values
 * @returns CursorPaginatedResponse_CaseReadMinimal_ Successful Response
 * @throws ApiError
 */
export const casesSearchCases = (
  data: CasesSearchCasesData
): CancelablePromise<CasesSearchCasesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/search",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
      search_term: data.searchTerm,
      short_id: data.shortId,
      status: data.status,
      priority: data.priority,
      severity: data.severity,
      tags: data.tags,
      dropdown: data.dropdown,
      start_time: data.startTime,
      end_time: data.endTime,
      updated_after: data.updatedAfter,
      updated_before: data.updatedBefore,
      assignee_id: data.assigneeId,
      order_by: data.orderBy,
      sort: data.sort,
      include_rows: data.includeRows,
      field_ids: data.fieldIds,
      include_durations: data.includeDurations,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Search Case Aggregates
 * Return global case totals and per-stage counts for the current filters.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.searchTerm Text to search for in case summary, description, or short ID
 * @param data.status Filter by case status
 * @param data.priority Filter by case priority
 * @param data.severity Filter by case severity
 * @param data.tags Filter by tag IDs or slugs (AND logic)
 * @param data.dropdown Filter by dropdown values. Format: definition_ref:option_ref (AND across definitions, OR within)
 * @param data.startTime Return cases created at or after this timestamp
 * @param data.endTime Return cases created at or before this timestamp
 * @param data.updatedAfter Return cases updated at or after this timestamp
 * @param data.updatedBefore Return cases updated at or before this timestamp
 * @param data.assigneeId Filter by assignee ID or 'unassigned'
 * @returns CaseSearchAggregateRead Successful Response
 * @throws ApiError
 */
export const casesSearchCaseAggregates = (
  data: CasesSearchCaseAggregatesData
): CancelablePromise<CasesSearchCaseAggregatesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/search/aggregate",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      search_term: data.searchTerm,
      status: data.status,
      priority: data.priority,
      severity: data.severity,
      tags: data.tags,
      dropdown: data.dropdown,
      start_time: data.startTime,
      end_time: data.endTime,
      updated_after: data.updatedAfter,
      updated_before: data.updatedBefore,
      assignee_id: data.assigneeId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Case
 * Get a specific case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @param data.includeRows Include linked table rows
 * @returns CaseRead Successful Response
 * @throws ApiError
 */
export const casesGetCase = (
  data: CasesGetCaseData
): CancelablePromise<CasesGetCaseResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    query: {
      include_rows: data.includeRows,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Case
 * Update a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const casesUpdateCase = (
  data: CasesUpdateCaseData
): CancelablePromise<CasesUpdateCaseResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/cases/{case_id}",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Case
 * Delete a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const casesDeleteCase = (
  data: CasesDeleteCaseData
): CancelablePromise<CasesDeleteCaseResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/cases/{case_id}",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Comments
 * List all comments for a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @returns CaseCommentRead Successful Response
 * @throws ApiError
 */
export const casesListComments = (
  data: CasesListCommentsData
): CancelablePromise<CasesListCommentsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}/comments",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Comment
 * Create a new comment on a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const casesCreateComment = (
  data: CasesCreateCommentData
): CancelablePromise<CasesCreateCommentResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/cases/{case_id}/comments",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Comment Threads
 * List case comment threads.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @returns CaseCommentThreadRead Successful Response
 * @throws ApiError
 */
export const casesListCommentThreads = (
  data: CasesListCommentThreadsData
): CancelablePromise<CasesListCommentThreadsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}/comments/threads",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Comment
 * Update an existing comment.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.commentId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const casesUpdateComment = (
  data: CasesUpdateCommentData
): CancelablePromise<CasesUpdateCommentResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/cases/{case_id}/comments/{comment_id}",
    path: {
      case_id: data.caseId,
      comment_id: data.commentId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Comment
 * Delete a comment.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.commentId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const casesDeleteComment = (
  data: CasesDeleteCommentData
): CancelablePromise<CasesDeleteCommentResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/cases/{case_id}/comments/{comment_id}",
    path: {
      case_id: data.caseId,
      comment_id: data.commentId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Events With Users
 * List all users for a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @returns CaseEventsWithUsers Successful Response
 * @throws ApiError
 */
export const casesListEventsWithUsers = (
  data: CasesListEventsWithUsersData
): CancelablePromise<CasesListEventsWithUsersResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}/events",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Tasks
 * List all tasks for a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @returns CaseTaskRead Successful Response
 * @throws ApiError
 */
export const casesListTasks = (
  data: CasesListTasksData
): CancelablePromise<CasesListTasksResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}/tasks",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Task
 * Create a new task for a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseTaskRead Successful Response
 * @throws ApiError
 */
export const casesCreateTask = (
  data: CasesCreateTaskData
): CancelablePromise<CasesCreateTaskResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/cases/{case_id}/tasks",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Task
 * Update a task.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.taskId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseTaskRead Successful Response
 * @throws ApiError
 */
export const casesUpdateTask = (
  data: CasesUpdateTaskData
): CancelablePromise<CasesUpdateTaskResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/cases/{case_id}/tasks/{task_id}",
    path: {
      case_id: data.caseId,
      task_id: data.taskId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Task
 * Delete a task.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.taskId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const casesDeleteTask = (
  data: CasesDeleteTaskData
): CancelablePromise<CasesDeleteTaskResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/cases/{case_id}/tasks/{task_id}",
    path: {
      case_id: data.caseId,
      task_id: data.taskId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Case Rows
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @param data.limit
 * @param data.cursor
 * @param data.reverse
 * @returns CursorPaginatedResponse_CaseTableRowRead_ Successful Response
 * @throws ApiError
 */
export const casesListCaseRows = (
  data: CasesListCaseRowsData
): CancelablePromise<CasesListCaseRowsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}/rows",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    query: {
      limit: data.limit,
      cursor: data.cursor,
      reverse: data.reverse,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Link Case Row
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseTableRowRead Successful Response
 * @throws ApiError
 */
export const casesLinkCaseRow = (
  data: CasesLinkCaseRowData
): CancelablePromise<CasesLinkCaseRowResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/cases/{case_id}/rows",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Insert Case Row
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseTableRowRead Successful Response
 * @throws ApiError
 */
export const casesInsertCaseRow = (
  data: CasesInsertCaseRowData
): CancelablePromise<CasesInsertCaseRowResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/cases/{case_id}/rows/insert",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Unlink Case Row
 * @param data The data for the request.
 * @param data.caseId
 * @param data.tableId
 * @param data.rowId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const casesUnlinkCaseRow = (
  data: CasesUnlinkCaseRowData
): CancelablePromise<CasesUnlinkCaseRowResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/cases/{case_id}/rows/{table_id}/{row_id}",
    path: {
      case_id: data.caseId,
      table_id: data.tableId,
      row_id: data.rowId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Fields
 * List all case fields.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns CaseFieldReadMinimal Successful Response
 * @throws ApiError
 */
export const casesListFields = (
  data: CasesListFieldsData
): CancelablePromise<CasesListFieldsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/case-fields",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Field
 * Create a new case field.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const casesCreateField = (
  data: CasesCreateFieldData
): CancelablePromise<CasesCreateFieldResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/case-fields",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Field
 * Update a case field.
 * @param data The data for the request.
 * @param data.fieldId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const casesUpdateField = (
  data: CasesUpdateFieldData
): CancelablePromise<CasesUpdateFieldResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/case-fields/{field_id}",
    path: {
      field_id: data.fieldId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Field
 * Delete a case field.
 * @param data The data for the request.
 * @param data.fieldId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const casesDeleteField = (
  data: CasesDeleteFieldData
): CancelablePromise<CasesDeleteFieldResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/case-fields/{field_id}",
    path: {
      field_id: data.fieldId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Tags
 * List all tags for a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @returns CaseTagRead Successful Response
 * @throws ApiError
 */
export const casesListTags = (
  data: CasesListTagsData
): CancelablePromise<CasesListTagsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}/tags",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Add Tag
 * Add a tag to a case using tag ID or slug.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseTagRead Successful Response
 * @throws ApiError
 */
export const casesAddTag = (
  data: CasesAddTagData
): CancelablePromise<CasesAddTagResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/cases/{case_id}/tags",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Remove Tag
 * Remove a tag from a case using tag ID or ref.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.tagIdentifier
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const casesRemoveTag = (
  data: CasesRemoveTagData
): CancelablePromise<CasesRemoveTagResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/cases/{case_id}/tags/{tag_identifier}",
    path: {
      case_id: data.caseId,
      tag_identifier: data.tagIdentifier,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Case Tags
 * List all case tags available in the current workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns CaseTagRead Successful Response
 * @throws ApiError
 */
export const caseTagsListCaseTags = (
  data: CaseTagsListCaseTagsData
): CancelablePromise<CaseTagsListCaseTagsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/case-tags",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Case Tag
 * Create a new case tag definition.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseTagRead Successful Response
 * @throws ApiError
 */
export const caseTagsCreateCaseTag = (
  data: CaseTagsCreateCaseTagData
): CancelablePromise<CaseTagsCreateCaseTagResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/case-tags",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Case Tag
 * Retrieve a single case tag by ID.
 * @param data The data for the request.
 * @param data.tagId
 * @param data.workspaceId
 * @returns CaseTagRead Successful Response
 * @throws ApiError
 */
export const caseTagsGetCaseTag = (
  data: CaseTagsGetCaseTagData
): CancelablePromise<CaseTagsGetCaseTagResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/case-tags/{tag_id}",
    path: {
      tag_id: data.tagId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Case Tag
 * Update an existing case tag definition.
 * @param data The data for the request.
 * @param data.tagId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseTagRead Successful Response
 * @throws ApiError
 */
export const caseTagsUpdateCaseTag = (
  data: CaseTagsUpdateCaseTagData
): CancelablePromise<CaseTagsUpdateCaseTagResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/case-tags/{tag_id}",
    path: {
      tag_id: data.tagId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Case Tag
 * Delete a case tag definition.
 * @param data The data for the request.
 * @param data.tagId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const caseTagsDeleteCaseTag = (
  data: CaseTagsDeleteCaseTagData
): CancelablePromise<CaseTagsDeleteCaseTagResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/case-tags/{tag_id}",
    path: {
      tag_id: data.tagId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Attachments
 * List all attachments for a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @returns CaseAttachmentRead Successful Response
 * @throws ApiError
 */
export const caseAttachmentsListAttachments = (
  data: CaseAttachmentsListAttachmentsData
): CancelablePromise<CaseAttachmentsListAttachmentsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}/attachments",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Attachment
 * Upload a new attachment to a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @param data.formData
 * @returns CaseAttachmentRead Successful Response
 * @throws ApiError
 */
export const caseAttachmentsCreateAttachment = (
  data: CaseAttachmentsCreateAttachmentData
): CancelablePromise<CaseAttachmentsCreateAttachmentResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/cases/{case_id}/attachments",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    formData: data.formData,
    mediaType: "multipart/form-data",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Download Attachment
 * Download an attachment.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.attachmentId
 * @param data.workspaceId
 * @param data.preview If true, allows inline preview for safe image types
 * @returns CaseAttachmentDownloadResponse Successful Response
 * @throws ApiError
 */
export const caseAttachmentsDownloadAttachment = (
  data: CaseAttachmentsDownloadAttachmentData
): CancelablePromise<CaseAttachmentsDownloadAttachmentResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}/attachments/{attachment_id}",
    path: {
      case_id: data.caseId,
      attachment_id: data.attachmentId,
      workspace_id: data.workspaceId,
    },
    query: {
      preview: data.preview,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Attachment
 * Delete an attachment (soft delete).
 * @param data The data for the request.
 * @param data.caseId
 * @param data.attachmentId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const caseAttachmentsDeleteAttachment = (
  data: CaseAttachmentsDeleteAttachmentData
): CancelablePromise<CaseAttachmentsDeleteAttachmentResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/cases/{case_id}/attachments/{attachment_id}",
    path: {
      case_id: data.caseId,
      attachment_id: data.attachmentId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Dropdown Definitions
 * List all dropdown definitions for the workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns CaseDropdownDefinitionRead Successful Response
 * @throws ApiError
 */
export const caseDropdownsListDropdownDefinitions = (
  data: CaseDropdownsListDropdownDefinitionsData
): CancelablePromise<CaseDropdownsListDropdownDefinitionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/case-dropdowns",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Dropdown Definition
 * Create a new dropdown definition with initial options.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseDropdownDefinitionRead Successful Response
 * @throws ApiError
 */
export const caseDropdownsCreateDropdownDefinition = (
  data: CaseDropdownsCreateDropdownDefinitionData
): CancelablePromise<CaseDropdownsCreateDropdownDefinitionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/case-dropdowns",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Dropdown Definition
 * Get a single dropdown definition.
 * @param data The data for the request.
 * @param data.definitionId
 * @param data.workspaceId
 * @returns CaseDropdownDefinitionRead Successful Response
 * @throws ApiError
 */
export const caseDropdownsGetDropdownDefinition = (
  data: CaseDropdownsGetDropdownDefinitionData
): CancelablePromise<CaseDropdownsGetDropdownDefinitionResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/case-dropdowns/{definition_id}",
    path: {
      definition_id: data.definitionId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Dropdown Definition
 * Update a dropdown definition.
 * @param data The data for the request.
 * @param data.definitionId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseDropdownDefinitionRead Successful Response
 * @throws ApiError
 */
export const caseDropdownsUpdateDropdownDefinition = (
  data: CaseDropdownsUpdateDropdownDefinitionData
): CancelablePromise<CaseDropdownsUpdateDropdownDefinitionResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/case-dropdowns/{definition_id}",
    path: {
      definition_id: data.definitionId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Dropdown Definition
 * Delete a dropdown definition and all its options/values.
 * @param data The data for the request.
 * @param data.definitionId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const caseDropdownsDeleteDropdownDefinition = (
  data: CaseDropdownsDeleteDropdownDefinitionData
): CancelablePromise<CaseDropdownsDeleteDropdownDefinitionResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/case-dropdowns/{definition_id}",
    path: {
      definition_id: data.definitionId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Add Dropdown Option
 * Add a new option to a dropdown definition.
 * @param data The data for the request.
 * @param data.definitionId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseDropdownOptionRead Successful Response
 * @throws ApiError
 */
export const caseDropdownsAddDropdownOption = (
  data: CaseDropdownsAddDropdownOptionData
): CancelablePromise<CaseDropdownsAddDropdownOptionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/case-dropdowns/{definition_id}/options",
    path: {
      definition_id: data.definitionId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Dropdown Option
 * Update an option within a dropdown definition.
 * @param data The data for the request.
 * @param data.definitionId
 * @param data.optionId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseDropdownOptionRead Successful Response
 * @throws ApiError
 */
export const caseDropdownsUpdateDropdownOption = (
  data: CaseDropdownsUpdateDropdownOptionData
): CancelablePromise<CaseDropdownsUpdateDropdownOptionResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/case-dropdowns/{definition_id}/options/{option_id}",
    path: {
      definition_id: data.definitionId,
      option_id: data.optionId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Dropdown Option
 * Delete an option from a dropdown definition.
 * @param data The data for the request.
 * @param data.definitionId
 * @param data.optionId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const caseDropdownsDeleteDropdownOption = (
  data: CaseDropdownsDeleteDropdownOptionData
): CancelablePromise<CaseDropdownsDeleteDropdownOptionResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/case-dropdowns/{definition_id}/options/{option_id}",
    path: {
      definition_id: data.definitionId,
      option_id: data.optionId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Reorder Dropdown Options
 * Reorder options within a dropdown definition.
 * @param data The data for the request.
 * @param data.definitionId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const caseDropdownsReorderDropdownOptions = (
  data: CaseDropdownsReorderDropdownOptionsData
): CancelablePromise<CaseDropdownsReorderDropdownOptionsResponse> => {
  return __request(OpenAPI, {
    method: "PUT",
    url: "/workspaces/{workspace_id}/case-dropdowns/{definition_id}/options/reorder",
    path: {
      definition_id: data.definitionId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Case Dropdown Values
 * List all dropdown values for a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @returns CaseDropdownValueRead Successful Response
 * @throws ApiError
 */
export const casesListCaseDropdownValues = (
  data: CasesListCaseDropdownValuesData
): CancelablePromise<CasesListCaseDropdownValuesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}/dropdowns",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Set Case Dropdown Value
 * Set or clear a dropdown value for a case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.definitionId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseDropdownValueRead Successful Response
 * @throws ApiError
 */
export const casesSetCaseDropdownValue = (
  data: CasesSetCaseDropdownValueData
): CancelablePromise<CasesSetCaseDropdownValueResponse> => {
  return __request(OpenAPI, {
    method: "PUT",
    url: "/workspaces/{workspace_id}/cases/{case_id}/dropdowns/{definition_id}",
    path: {
      case_id: data.caseId,
      definition_id: data.definitionId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Case Duration Definitions
 * List all case duration definitions for the active workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns CaseDurationDefinitionRead Successful Response
 * @throws ApiError
 */
export const caseDurationsListCaseDurationDefinitions = (
  data: CaseDurationsListCaseDurationDefinitionsData
): CancelablePromise<CaseDurationsListCaseDurationDefinitionsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/case-durations",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Case Duration Definition
 * Create a new case duration definition.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseDurationDefinitionRead Successful Response
 * @throws ApiError
 */
export const caseDurationsCreateCaseDurationDefinition = (
  data: CaseDurationsCreateCaseDurationDefinitionData
): CancelablePromise<CaseDurationsCreateCaseDurationDefinitionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/case-durations",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Case Duration Definition
 * Retrieve a single case duration definition.
 * @param data The data for the request.
 * @param data.durationId
 * @param data.workspaceId
 * @returns CaseDurationDefinitionRead Successful Response
 * @throws ApiError
 */
export const caseDurationsGetCaseDurationDefinition = (
  data: CaseDurationsGetCaseDurationDefinitionData
): CancelablePromise<CaseDurationsGetCaseDurationDefinitionResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/case-durations/{duration_id}",
    path: {
      duration_id: data.durationId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Case Duration Definition
 * Update an existing case duration definition.
 * @param data The data for the request.
 * @param data.durationId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseDurationDefinitionRead Successful Response
 * @throws ApiError
 */
export const caseDurationsUpdateCaseDurationDefinition = (
  data: CaseDurationsUpdateCaseDurationDefinitionData
): CancelablePromise<CaseDurationsUpdateCaseDurationDefinitionResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/case-durations/{duration_id}",
    path: {
      duration_id: data.durationId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Case Duration Definition
 * Delete a case duration definition.
 * @param data The data for the request.
 * @param data.durationId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const caseDurationsDeleteCaseDurationDefinition = (
  data: CaseDurationsDeleteCaseDurationDefinitionData
): CancelablePromise<CaseDurationsDeleteCaseDurationDefinitionResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/case-durations/{duration_id}",
    path: {
      duration_id: data.durationId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Case Durations
 * Sync and list case durations for the provided case.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @returns CaseDurationRead Successful Response
 * @throws ApiError
 */
export const caseDurationsListCaseDurations = (
  data: CaseDurationsListCaseDurationsData
): CancelablePromise<CaseDurationsListCaseDurationsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}/durations",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Case Duration
 * Create a persisted case duration.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseDurationRead Successful Response
 * @throws ApiError
 */
export const caseDurationsCreateCaseDuration = (
  data: CaseDurationsCreateCaseDurationData
): CancelablePromise<CaseDurationsCreateCaseDurationResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/cases/{case_id}/durations",
    path: {
      case_id: data.caseId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Case Duration
 * Retrieve a persisted case duration.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.durationId
 * @param data.workspaceId
 * @returns CaseDurationRead Successful Response
 * @throws ApiError
 */
export const caseDurationsGetCaseDuration = (
  data: CaseDurationsGetCaseDurationData
): CancelablePromise<CaseDurationsGetCaseDurationResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/cases/{case_id}/durations/{duration_id}",
    path: {
      case_id: data.caseId,
      duration_id: data.durationId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Case Duration
 * Update a persisted case duration.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.durationId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns CaseDurationRead Successful Response
 * @throws ApiError
 */
export const caseDurationsUpdateCaseDuration = (
  data: CaseDurationsUpdateCaseDurationData
): CancelablePromise<CaseDurationsUpdateCaseDurationResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/cases/{case_id}/durations/{duration_id}",
    path: {
      case_id: data.caseId,
      duration_id: data.durationId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Case Duration
 * Delete a persisted case duration.
 * @param data The data for the request.
 * @param data.caseId
 * @param data.durationId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const caseDurationsDeleteCaseDuration = (
  data: CaseDurationsDeleteCaseDurationData
): CancelablePromise<CaseDurationsDeleteCaseDurationResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/cases/{case_id}/durations/{duration_id}",
    path: {
      case_id: data.caseId,
      duration_id: data.durationId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Directory
 * Get directory items (workflows and folders) in the given path.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.path Folder path
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const foldersGetDirectory = (
  data: FoldersGetDirectoryData
): CancelablePromise<FoldersGetDirectoryResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/folders/directory",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      path: data.path,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Folders
 * List folders under the specified parent path.
 *
 * If parent_path is not provided, returns root-level folders.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.parentPath Parent folder path
 * @returns WorkflowFolderRead Successful Response
 * @throws ApiError
 */
export const foldersListFolders = (
  data: FoldersListFoldersData
): CancelablePromise<FoldersListFoldersResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/folders",
    path: {
      workspace_id: data.workspaceId,
    },
    query: {
      parent_path: data.parentPath,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Folder
 * Create a new folder.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns WorkflowFolderRead Successful Response
 * @throws ApiError
 */
export const foldersCreateFolder = (
  data: FoldersCreateFolderData
): CancelablePromise<FoldersCreateFolderResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/folders",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Folder
 * Get folder details by ID.
 * @param data The data for the request.
 * @param data.folderId
 * @param data.workspaceId
 * @returns WorkflowFolderRead Successful Response
 * @throws ApiError
 */
export const foldersGetFolder = (
  data: FoldersGetFolderData
): CancelablePromise<FoldersGetFolderResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/folders/{folder_id}",
    path: {
      folder_id: data.folderId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Folder
 * Update a folder (rename).
 * @param data The data for the request.
 * @param data.folderId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns WorkflowFolderRead Successful Response
 * @throws ApiError
 */
export const foldersUpdateFolder = (
  data: FoldersUpdateFolderData
): CancelablePromise<FoldersUpdateFolderResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/workspaces/{workspace_id}/folders/{folder_id}",
    path: {
      folder_id: data.folderId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Folder
 * Delete a folder.
 *
 * If recursive=true, deletes all subfolders and moves the contained workflows to root.
 * If recursive=false (default), fails if the folder contains any subfolders or workflows.
 * @param data The data for the request.
 * @param data.folderId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns void Successful Response
 * @throws ApiError
 */
export const foldersDeleteFolder = (
  data: FoldersDeleteFolderData
): CancelablePromise<FoldersDeleteFolderResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/folders/{folder_id}",
    path: {
      folder_id: data.folderId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Move Folder
 * Move a folder to a new parent folder.
 * @param data The data for the request.
 * @param data.folderId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns WorkflowFolderRead Successful Response
 * @throws ApiError
 */
export const foldersMoveFolder = (
  data: FoldersMoveFolderData
): CancelablePromise<FoldersMoveFolderResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/folders/{folder_id}/move",
    path: {
      folder_id: data.folderId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Oauth Callback
 * Handle OAuth callback for the specified provider.
 *
 * Validates the state parameter against the database to ensure it was issued
 * by our server and hasn't expired. This prevents CSRF attacks.
 * @param data The data for the request.
 * @param data.code Authorization code from OAuth provider
 * @param data.state State parameter from authorization request
 * @returns IntegrationOAuthCallback Successful Response
 * @throws ApiError
 */
export const integrationsOauthCallback = (
  data: IntegrationsOauthCallbackData
): CancelablePromise<IntegrationsOauthCallbackResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/integrations/callback",
    query: {
      code: data.code,
      state: data.state,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Integrations
 * List all integrations for the current user.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns IntegrationReadMinimal Successful Response
 * @throws ApiError
 */
export const integrationsListIntegrations = (
  data: IntegrationsListIntegrationsData
): CancelablePromise<IntegrationsListIntegrationsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/integrations",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Integration
 * Get integration for the specified provider.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.providerId
 * @param data.grantType
 * @returns IntegrationRead Successful Response
 * @throws ApiError
 */
export const integrationsGetIntegration = (
  data: IntegrationsGetIntegrationData
): CancelablePromise<IntegrationsGetIntegrationResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/integrations/{provider_id}",
    path: {
      workspace_id: data.workspaceId,
      provider_id: data.providerId,
    },
    query: {
      grant_type: data.grantType,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Integration
 * Delete integration for the specified provider (removes the integration record completely).
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.providerId
 * @param data.grantType
 * @returns void Successful Response
 * @throws ApiError
 */
export const integrationsDeleteIntegration = (
  data: IntegrationsDeleteIntegrationData
): CancelablePromise<IntegrationsDeleteIntegrationResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/integrations/{provider_id}",
    path: {
      workspace_id: data.workspaceId,
      provider_id: data.providerId,
    },
    query: {
      grant_type: data.grantType,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Integration
 * Update OAuth client credentials for the specified provider integration.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.providerId
 * @param data.requestBody
 * @param data.grantType
 * @returns void Successful Response
 * @throws ApiError
 */
export const integrationsUpdateIntegration = (
  data: IntegrationsUpdateIntegrationData
): CancelablePromise<IntegrationsUpdateIntegrationResponse> => {
  return __request(OpenAPI, {
    method: "PUT",
    url: "/workspaces/{workspace_id}/integrations/{provider_id}",
    path: {
      workspace_id: data.workspaceId,
      provider_id: data.providerId,
    },
    query: {
      grant_type: data.grantType,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Connect Provider
 * Initiate OAuth integration for the specified provider.
 *
 * Creates a secure state parameter stored in the database to prevent CSRF attacks.
 * The state is validated on the callback to ensure it was issued by our server.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.providerId
 * @returns IntegrationOAuthConnect Successful Response
 * @throws ApiError
 */
export const integrationsConnectProvider = (
  data: IntegrationsConnectProviderData
): CancelablePromise<IntegrationsConnectProviderResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/integrations/{provider_id}/connect",
    path: {
      workspace_id: data.workspaceId,
      provider_id: data.providerId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Disconnect Integration
 * Disconnect integration for the specified provider (revokes tokens but keeps configuration).
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.providerId
 * @param data.grantType
 * @returns void Successful Response
 * @throws ApiError
 */
export const integrationsDisconnectIntegration = (
  data: IntegrationsDisconnectIntegrationData
): CancelablePromise<IntegrationsDisconnectIntegrationResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/integrations/{provider_id}/disconnect",
    path: {
      workspace_id: data.workspaceId,
      provider_id: data.providerId,
    },
    query: {
      grant_type: data.grantType,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Test Connection
 * Test client credentials connection for the specified provider.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.providerId
 * @returns IntegrationTestConnectionResponse Successful Response
 * @throws ApiError
 */
export const integrationsTestConnection = (
  data: IntegrationsTestConnectionData
): CancelablePromise<IntegrationsTestConnectionResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/integrations/{provider_id}/test",
    path: {
      workspace_id: data.workspaceId,
      provider_id: data.providerId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Custom Provider
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns ProviderReadMinimal Successful Response
 * @throws ApiError
 */
export const providersCreateCustomProvider = (
  data: ProvidersCreateCustomProviderData
): CancelablePromise<ProvidersCreateCustomProviderResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/providers",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Providers
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns ProviderReadMinimal Successful Response
 * @throws ApiError
 */
export const providersListProviders = (
  data: ProvidersListProvidersData
): CancelablePromise<ProvidersListProvidersResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/providers",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Provider
 * Get provider metadata, scopes, and schema.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.providerId
 * @param data.grantType
 * @returns ProviderRead Successful Response
 * @throws ApiError
 */
export const providersGetProvider = (
  data: ProvidersGetProviderData
): CancelablePromise<ProvidersGetProviderResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/providers/{provider_id}",
    path: {
      workspace_id: data.workspaceId,
      provider_id: data.providerId,
    },
    query: {
      grant_type: data.grantType,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Mcp Integration
 * Create a new MCP integration.
 * @param data The data for the request.
 * @param data.workspaceId
 * @param data.requestBody
 * @returns MCPIntegrationRead Successful Response
 * @throws ApiError
 */
export const mcpIntegrationsCreateMcpIntegration = (
  data: McpIntegrationsCreateMcpIntegrationData
): CancelablePromise<McpIntegrationsCreateMcpIntegrationResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/workspaces/{workspace_id}/mcp-integrations",
    path: {
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Mcp Integrations
 * List all MCP integrations for the workspace.
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns MCPIntegrationRead Successful Response
 * @throws ApiError
 */
export const mcpIntegrationsListMcpIntegrations = (
  data: McpIntegrationsListMcpIntegrationsData
): CancelablePromise<McpIntegrationsListMcpIntegrationsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/mcp-integrations",
    path: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Mcp Integration
 * Get an MCP integration by ID.
 * @param data The data for the request.
 * @param data.mcpIntegrationId
 * @param data.workspaceId
 * @returns MCPIntegrationRead Successful Response
 * @throws ApiError
 */
export const mcpIntegrationsGetMcpIntegration = (
  data: McpIntegrationsGetMcpIntegrationData
): CancelablePromise<McpIntegrationsGetMcpIntegrationResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/workspaces/{workspace_id}/mcp-integrations/{mcp_integration_id}",
    path: {
      mcp_integration_id: data.mcpIntegrationId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Mcp Integration
 * Update an MCP integration.
 * @param data The data for the request.
 * @param data.mcpIntegrationId
 * @param data.workspaceId
 * @param data.requestBody
 * @returns MCPIntegrationRead Successful Response
 * @throws ApiError
 */
export const mcpIntegrationsUpdateMcpIntegration = (
  data: McpIntegrationsUpdateMcpIntegrationData
): CancelablePromise<McpIntegrationsUpdateMcpIntegrationResponse> => {
  return __request(OpenAPI, {
    method: "PUT",
    url: "/workspaces/{workspace_id}/mcp-integrations/{mcp_integration_id}",
    path: {
      mcp_integration_id: data.mcpIntegrationId,
      workspace_id: data.workspaceId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Mcp Integration
 * Delete an MCP integration.
 * @param data The data for the request.
 * @param data.mcpIntegrationId
 * @param data.workspaceId
 * @returns void Successful Response
 * @throws ApiError
 */
export const mcpIntegrationsDeleteMcpIntegration = (
  data: McpIntegrationsDeleteMcpIntegrationData
): CancelablePromise<McpIntegrationsDeleteMcpIntegrationResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/workspaces/{workspace_id}/mcp-integrations/{mcp_integration_id}",
    path: {
      mcp_integration_id: data.mcpIntegrationId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Feature Flags
 * Get the list of enabled feature flags.
 *
 * This endpoint is public and doesn't require authentication,
 * as feature flags are not sensitive information.
 * @returns FeatureFlagsRead Successful Response
 * @throws ApiError
 */
export const featureFlagsGetFeatureFlags =
  (): CancelablePromise<FeatureFlagsGetFeatureFlagsResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/feature-flags",
    })
  }

/**
 * Get Github App Manifest
 * Generate GitHub App manifest for enterprise installation.
 * @returns GitHubAppManifestResponse Successful Response
 * @throws ApiError
 */
export const vcsGetGithubAppManifest =
  (): CancelablePromise<VcsGetGithubAppManifestResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/organization/vcs/github/manifest",
    })
  }

/**
 * Github App Install Callback
 * Handle GitHub App installation flow.
 *
 * This endpoint handles two different flows:
 * 1. Code exchange: When GitHub redirects with a temporary code after manifest submission
 * 2. Installation callback: When GitHub redirects after app installation
 * @param data The data for the request.
 * @param data.code Temporary code from GitHub manifest flow
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const vcsGithubAppInstallCallback = (
  data: VcsGithubAppInstallCallbackData
): CancelablePromise<VcsGithubAppInstallCallbackResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/organization/vcs/github/install",
    query: {
      code: data.code,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Github Webhook
 * Handle GitHub webhook events.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns string Successful Response
 * @throws ApiError
 */
export const vcsGithubWebhook = (
  data: VcsGithubWebhookData
): CancelablePromise<VcsGithubWebhookResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/vcs/github/webhook",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Save Github App Credentials
 * Save GitHub App credentials (register new or update existing).
 * @param data The data for the request.
 * @param data.requestBody
 * @returns string Successful Response
 * @throws ApiError
 */
export const vcsSaveGithubAppCredentials = (
  data: VcsSaveGithubAppCredentialsData
): CancelablePromise<VcsSaveGithubAppCredentialsResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/organization/vcs/github/credentials",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Github App Credentials
 * Delete GitHub App credentials.
 * @returns void Successful Response
 * @throws ApiError
 */
export const vcsDeleteGithubAppCredentials =
  (): CancelablePromise<VcsDeleteGithubAppCredentialsResponse> => {
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/organization/vcs/github/credentials",
    })
  }

/**
 * Get Github App Credentials Status
 * Get the status of GitHub App credentials.
 * @returns GitHubAppCredentialsStatus Successful Response
 * @throws ApiError
 */
export const vcsGetGithubAppCredentialsStatus =
  (): CancelablePromise<VcsGetGithubAppCredentialsStatusResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/organization/vcs/github/credentials/status",
    })
  }

/**
 * Get My Scopes
 * Get the current user's effective scopes.
 *
 * Scopes are computed from DB-driven role assignments during auth
 * (UserRoleAssignment + GroupRoleAssignment → Role → RoleScope → Scope).
 * @param data The data for the request.
 * @param data.workspaceId
 * @returns UserScopesRead Successful Response
 * @throws ApiError
 */
export const usersGetMyScopes = (
  data: UsersGetMyScopesData = {}
): CancelablePromise<UsersGetMyScopesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/users/me/scopes",
    query: {
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Roles
 * List roles for the organization.
 *
 * Requires: authenticated organization member.
 * @returns RoleList Successful Response
 * @throws ApiError
 */
export const rbacListRoles = (): CancelablePromise<RbacListRolesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/rbac/roles",
  })
}

/**
 * Create Role
 * Create a custom role.
 *
 * Requires: org:rbac:create scope
 * @param data The data for the request.
 * @param data.requestBody
 * @returns RoleReadWithScopes Successful Response
 * @throws ApiError
 */
export const rbacCreateRole = (
  data: RbacCreateRoleData
): CancelablePromise<RbacCreateRoleResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/rbac/roles",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List User Assignments
 * List user role assignments for the organization.
 * @param data The data for the request.
 * @param data.userId Filter by user ID
 * @param data.workspaceId Filter by workspace ID
 * @returns UserRoleAssignmentList Successful Response
 * @throws ApiError
 */
export const rbacListUserAssignments = (
  data: RbacListUserAssignmentsData = {}
): CancelablePromise<RbacListUserAssignmentsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/rbac/user-assignments",
    query: {
      user_id: data.userId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create User Assignment
 * Create a user role assignment.
 *
 * Assigns a role directly to a user. If workspace_id is None, creates an org-wide
 * assignment that applies to all workspaces. Each user can have at most
 * one assignment per workspace (or one org-wide assignment).
 *
 * Requires: org:rbac:create scope
 * @param data The data for the request.
 * @param data.requestBody
 * @returns UserRoleAssignmentReadWithDetails Successful Response
 * @throws ApiError
 */
export const rbacCreateUserAssignment = (
  data: RbacCreateUserAssignmentData
): CancelablePromise<RbacCreateUserAssignmentResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/rbac/user-assignments",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get User Assignment
 * Get a user role assignment by ID.
 * @param data The data for the request.
 * @param data.assignmentId
 * @returns UserRoleAssignmentReadWithDetails Successful Response
 * @throws ApiError
 */
export const rbacGetUserAssignment = (
  data: RbacGetUserAssignmentData
): CancelablePromise<RbacGetUserAssignmentResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/rbac/user-assignments/{assignment_id}",
    path: {
      assignment_id: data.assignmentId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update User Assignment
 * Update a user role assignment (change role).
 *
 * Requires: org:rbac:update scope
 * @param data The data for the request.
 * @param data.assignmentId
 * @param data.requestBody
 * @returns UserRoleAssignmentReadWithDetails Successful Response
 * @throws ApiError
 */
export const rbacUpdateUserAssignment = (
  data: RbacUpdateUserAssignmentData
): CancelablePromise<RbacUpdateUserAssignmentResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/rbac/user-assignments/{assignment_id}",
    path: {
      assignment_id: data.assignmentId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete User Assignment
 * Delete a user role assignment.
 *
 * Requires: org:rbac:delete scope
 * @param data The data for the request.
 * @param data.assignmentId
 * @returns void Successful Response
 * @throws ApiError
 */
export const rbacDeleteUserAssignment = (
  data: RbacDeleteUserAssignmentData
): CancelablePromise<RbacDeleteUserAssignmentResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/rbac/user-assignments/{assignment_id}",
    path: {
      assignment_id: data.assignmentId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Scopes
 * List scopes available to the organization.
 *
 * Requires: org:rbac:read scope
 * @param data The data for the request.
 * @param data.includeSystem Include system/registry scopes
 * @param data.source Filter by scope source
 * @returns ScopeList Successful Response
 * @throws ApiError
 */
export const rbacListScopes = (
  data: RbacListScopesData = {}
): CancelablePromise<RbacListScopesResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/rbac/scopes",
    query: {
      include_system: data.includeSystem,
      source: data.source,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Scope
 * Create a custom scope.
 *
 * Requires: org:rbac:create scope
 * @param data The data for the request.
 * @param data.requestBody
 * @returns ScopeRead Successful Response
 * @throws ApiError
 */
export const rbacCreateScope = (
  data: RbacCreateScopeData
): CancelablePromise<RbacCreateScopeResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/rbac/scopes",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Scope
 * Get a scope by ID.
 *
 * Requires: org:rbac:read scope
 * @param data The data for the request.
 * @param data.scopeId
 * @returns ScopeRead Successful Response
 * @throws ApiError
 */
export const rbacGetScope = (
  data: RbacGetScopeData
): CancelablePromise<RbacGetScopeResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/rbac/scopes/{scope_id}",
    path: {
      scope_id: data.scopeId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Scope
 * Delete a custom scope.
 *
 * Only custom scopes can be deleted. System and registry scopes are protected.
 *
 * Requires: org:rbac:delete scope
 * @param data The data for the request.
 * @param data.scopeId
 * @returns void Successful Response
 * @throws ApiError
 */
export const rbacDeleteScope = (
  data: RbacDeleteScopeData
): CancelablePromise<RbacDeleteScopeResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/rbac/scopes/{scope_id}",
    path: {
      scope_id: data.scopeId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Role
 * Get a role by ID with its scopes.
 *
 * Requires: org:rbac:read scope
 * @param data The data for the request.
 * @param data.roleId
 * @returns RoleReadWithScopes Successful Response
 * @throws ApiError
 */
export const rbacGetRole = (
  data: RbacGetRoleData
): CancelablePromise<RbacGetRoleResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/rbac/roles/{role_id}",
    path: {
      role_id: data.roleId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Role
 * Update a role.
 *
 * Requires: org:rbac:update scope
 * @param data The data for the request.
 * @param data.roleId
 * @param data.requestBody
 * @returns RoleReadWithScopes Successful Response
 * @throws ApiError
 */
export const rbacUpdateRole = (
  data: RbacUpdateRoleData
): CancelablePromise<RbacUpdateRoleResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/rbac/roles/{role_id}",
    path: {
      role_id: data.roleId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Role
 * Delete a role.
 *
 * Roles with active assignments must have all assignments removed first.
 *
 * Requires: org:rbac:delete scope
 * @param data The data for the request.
 * @param data.roleId
 * @returns void Successful Response
 * @throws ApiError
 */
export const rbacDeleteRole = (
  data: RbacDeleteRoleData
): CancelablePromise<RbacDeleteRoleResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/rbac/roles/{role_id}",
    path: {
      role_id: data.roleId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Groups
 * List groups for the organization.
 *
 * Requires: org:rbac:read scope
 * @returns GroupList Successful Response
 * @throws ApiError
 */
export const rbacListGroups = (): CancelablePromise<RbacListGroupsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/rbac/groups",
  })
}

/**
 * Create Group
 * Create a group.
 *
 * Requires: org:rbac:create scope
 * @param data The data for the request.
 * @param data.requestBody
 * @returns GroupReadWithMembers Successful Response
 * @throws ApiError
 */
export const rbacCreateGroup = (
  data: RbacCreateGroupData
): CancelablePromise<RbacCreateGroupResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/rbac/groups",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Group
 * Get a group by ID with its members.
 *
 * Requires: org:rbac:read scope
 * @param data The data for the request.
 * @param data.groupId
 * @returns GroupReadWithMembers Successful Response
 * @throws ApiError
 */
export const rbacGetGroup = (
  data: RbacGetGroupData
): CancelablePromise<RbacGetGroupResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/rbac/groups/{group_id}",
    path: {
      group_id: data.groupId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Group
 * Update a group.
 *
 * Requires: org:rbac:update scope
 * @param data The data for the request.
 * @param data.groupId
 * @param data.requestBody
 * @returns GroupReadWithMembers Successful Response
 * @throws ApiError
 */
export const rbacUpdateGroup = (
  data: RbacUpdateGroupData
): CancelablePromise<RbacUpdateGroupResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/rbac/groups/{group_id}",
    path: {
      group_id: data.groupId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Group
 * Delete a group.
 *
 * This will also delete all group assignments and memberships.
 *
 * Requires: org:rbac:delete scope
 * @param data The data for the request.
 * @param data.groupId
 * @returns void Successful Response
 * @throws ApiError
 */
export const rbacDeleteGroup = (
  data: RbacDeleteGroupData
): CancelablePromise<RbacDeleteGroupResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/rbac/groups/{group_id}",
    path: {
      group_id: data.groupId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Add Group Member
 * Add a member to a group.
 *
 * Requires: org:rbac:update scope
 * @param data The data for the request.
 * @param data.groupId
 * @param data.requestBody
 * @returns string Successful Response
 * @throws ApiError
 */
export const rbacAddGroupMember = (
  data: RbacAddGroupMemberData
): CancelablePromise<RbacAddGroupMemberResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/rbac/groups/{group_id}/members",
    path: {
      group_id: data.groupId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Remove Group Member
 * Remove a member from a group.
 *
 * Requires: org:rbac:update scope
 * @param data The data for the request.
 * @param data.groupId
 * @param data.userId
 * @returns void Successful Response
 * @throws ApiError
 */
export const rbacRemoveGroupMember = (
  data: RbacRemoveGroupMemberData
): CancelablePromise<RbacRemoveGroupMemberResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/rbac/groups/{group_id}/members/{user_id}",
    path: {
      group_id: data.groupId,
      user_id: data.userId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * List Assignments
 * List group assignments for the organization.
 *
 * Requires: org:rbac:read scope
 * @param data The data for the request.
 * @param data.groupId Filter by group ID
 * @param data.workspaceId Filter by workspace ID
 * @returns GroupRoleAssignmentList Successful Response
 * @throws ApiError
 */
export const rbacListAssignments = (
  data: RbacListAssignmentsData = {}
): CancelablePromise<RbacListAssignmentsResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/rbac/assignments",
    query: {
      group_id: data.groupId,
      workspace_id: data.workspaceId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Create Assignment
 * Create a group assignment.
 *
 * Assigns a role to a group. If workspace_id is None, creates an org-wide
 * assignment that applies to all workspaces. Each group can have at most
 * one assignment per workspace (or one org-wide assignment).
 *
 * Requires: org:rbac:create scope
 * @param data The data for the request.
 * @param data.requestBody
 * @returns GroupRoleAssignmentReadWithDetails Successful Response
 * @throws ApiError
 */
export const rbacCreateAssignment = (
  data: RbacCreateAssignmentData
): CancelablePromise<RbacCreateAssignmentResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/rbac/assignments",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Get Assignment
 * Get a group assignment by ID.
 *
 * Requires: org:rbac:read scope
 * @param data The data for the request.
 * @param data.assignmentId
 * @returns GroupRoleAssignmentReadWithDetails Successful Response
 * @throws ApiError
 */
export const rbacGetAssignment = (
  data: RbacGetAssignmentData
): CancelablePromise<RbacGetAssignmentResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/rbac/assignments/{assignment_id}",
    path: {
      assignment_id: data.assignmentId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Update Assignment
 * Update a group assignment (change role).
 *
 * Requires: org:rbac:update scope
 * @param data The data for the request.
 * @param data.assignmentId
 * @param data.requestBody
 * @returns GroupRoleAssignmentReadWithDetails Successful Response
 * @throws ApiError
 */
export const rbacUpdateAssignment = (
  data: RbacUpdateAssignmentData
): CancelablePromise<RbacUpdateAssignmentResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/rbac/assignments/{assignment_id}",
    path: {
      assignment_id: data.assignmentId,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Delete Assignment
 * Delete a group assignment.
 *
 * Requires: org:rbac:delete scope
 * @param data The data for the request.
 * @param data.assignmentId
 * @returns void Successful Response
 * @throws ApiError
 */
export const rbacDeleteAssignment = (
  data: RbacDeleteAssignmentData
): CancelablePromise<RbacDeleteAssignmentResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/rbac/assignments/{assignment_id}",
    path: {
      assignment_id: data.assignmentId,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Users:Current User
 * @returns UserRead Successful Response
 * @throws ApiError
 */
export const usersUsersCurrentUser =
  (): CancelablePromise<UsersUsersCurrentUserResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/users/me",
      errors: {
        401: "Missing token or inactive user.",
      },
    })
  }

/**
 * Users:Patch Current User
 * @param data The data for the request.
 * @param data.requestBody
 * @returns UserRead Successful Response
 * @throws ApiError
 */
export const usersUsersPatchCurrentUser = (
  data: UsersUsersPatchCurrentUserData
): CancelablePromise<UsersUsersPatchCurrentUserResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/users/me",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      400: "Bad Request",
      401: "Missing token or inactive user.",
      422: "Validation Error",
    },
  })
}

/**
 * Users:User
 * @param data The data for the request.
 * @param data.id
 * @returns UserRead Successful Response
 * @throws ApiError
 */
export const usersUsersUser = (
  data: UsersUsersUserData
): CancelablePromise<UsersUsersUserResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/users/{id}",
    path: {
      id: data.id,
    },
    errors: {
      401: "Missing token or inactive user.",
      403: "Not a superuser.",
      404: "The user does not exist.",
      422: "Validation Error",
    },
  })
}

/**
 * Users:Patch User
 * @param data The data for the request.
 * @param data.id
 * @param data.requestBody
 * @returns UserRead Successful Response
 * @throws ApiError
 */
export const usersUsersPatchUser = (
  data: UsersUsersPatchUserData
): CancelablePromise<UsersUsersPatchUserResponse> => {
  return __request(OpenAPI, {
    method: "PATCH",
    url: "/users/{id}",
    path: {
      id: data.id,
    },
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      400: "Bad Request",
      401: "Missing token or inactive user.",
      403: "Not a superuser.",
      404: "The user does not exist.",
      422: "Validation Error",
    },
  })
}

/**
 * Users:Delete User
 * @param data The data for the request.
 * @param data.id
 * @returns void Successful Response
 * @throws ApiError
 */
export const usersUsersDeleteUser = (
  data: UsersUsersDeleteUserData
): CancelablePromise<UsersUsersDeleteUserResponse> => {
  return __request(OpenAPI, {
    method: "DELETE",
    url: "/users/{id}",
    path: {
      id: data.id,
    },
    errors: {
      401: "Missing token or inactive user.",
      403: "Not a superuser.",
      404: "The user does not exist.",
      422: "Validation Error",
    },
  })
}

/**
 * Auth:Database.Login
 * @param data The data for the request.
 * @param data.formData
 * @returns unknown Successful Response
 * @returns void No Content
 * @throws ApiError
 */
export const authAuthDatabaseLogin = (
  data: AuthAuthDatabaseLoginData
): CancelablePromise<AuthAuthDatabaseLoginResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/auth/login",
    formData: data.formData,
    mediaType: "application/x-www-form-urlencoded",
    errors: {
      400: "Bad Request",
      422: "Validation Error",
    },
  })
}

/**
 * Auth:Database.Logout
 * @returns unknown Successful Response
 * @returns void No Content
 * @throws ApiError
 */
export const authAuthDatabaseLogout =
  (): CancelablePromise<AuthAuthDatabaseLogoutResponse> => {
    return __request(OpenAPI, {
      method: "POST",
      url: "/auth/logout",
      errors: {
        401: "Missing token or inactive user.",
      },
    })
  }

/**
 * Register:Register
 * @param data The data for the request.
 * @param data.requestBody
 * @returns UserRead Successful Response
 * @throws ApiError
 */
export const authRegisterRegister = (
  data: AuthRegisterRegisterData
): CancelablePromise<AuthRegisterRegisterResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/auth/register",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      400: "Bad Request",
      422: "Validation Error",
    },
  })
}

/**
 * Reset:Forgot Password
 * @param data The data for the request.
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const authResetForgotPassword = (
  data: AuthResetForgotPasswordData
): CancelablePromise<AuthResetForgotPasswordResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/auth/forgot-password",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Reset:Reset Password
 * @param data The data for the request.
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const authResetResetPassword = (
  data: AuthResetResetPasswordData
): CancelablePromise<AuthResetResetPasswordResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/auth/reset-password",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      400: "Bad Request",
      422: "Validation Error",
    },
  })
}

/**
 * Verify:Request-Token
 * @param data The data for the request.
 * @param data.requestBody
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const authVerifyRequestToken = (
  data: AuthVerifyRequestTokenData
): CancelablePromise<AuthVerifyRequestTokenResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/auth/request-verify-token",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Verify:Verify
 * @param data The data for the request.
 * @param data.requestBody
 * @returns UserRead Successful Response
 * @throws ApiError
 */
export const authVerifyVerify = (
  data: AuthVerifyVerifyData
): CancelablePromise<AuthVerifyVerifyResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/auth/verify",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      400: "Bad Request",
      422: "Validation Error",
    },
  })
}

/**
 * Oauth:Oidc.Database.Authorize
 * @param data The data for the request.
 * @param data.scopes
 * @returns OAuth2AuthorizeResponse Successful Response
 * @throws ApiError
 */
export const authOauthOidcDatabaseAuthorize = (
  data: AuthOauthOidcDatabaseAuthorizeData = {}
): CancelablePromise<AuthOauthOidcDatabaseAuthorizeResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/auth/oauth/authorize",
    query: {
      scopes: data.scopes,
    },
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Oauth:Oidc.Database.Callback
 * The response varies based on the authentication backend used.
 * @param data The data for the request.
 * @param data.code
 * @param data.codeVerifier
 * @param data.state
 * @param data.error
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const authOauthOidcDatabaseCallback = (
  data: AuthOauthOidcDatabaseCallbackData = {}
): CancelablePromise<AuthOauthOidcDatabaseCallbackResponse> => {
  return __request(OpenAPI, {
    method: "GET",
    url: "/auth/oauth/callback",
    query: {
      code: data.code,
      code_verifier: data.codeVerifier,
      state: data.state,
      error: data.error,
    },
    errors: {
      400: "Bad Request",
      422: "Validation Error",
    },
  })
}

/**
 * Saml:Database.Login
 * Initiate SAML login flow
 * @returns SAMLDatabaseLoginResponse Successful Response
 * @throws ApiError
 */
export const authSamlDatabaseLogin =
  (): CancelablePromise<AuthSamlDatabaseLoginResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/auth/saml/login",
    })
  }

/**
 * Sso Acs
 * Handle the SAML SSO response from the IdP post-authentication.
 * @param data The data for the request.
 * @param data.formData
 * @returns unknown Successful Response
 * @throws ApiError
 */
export const authSsoAcs = (
  data: AuthSsoAcsData
): CancelablePromise<AuthSsoAcsResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/auth/saml/acs",
    formData: data.formData,
    mediaType: "application/x-www-form-urlencoded",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Discover Auth Method
 * Return the next-step auth method for a given email.
 * @param data The data for the request.
 * @param data.requestBody
 * @returns AuthDiscoverResponse Successful Response
 * @throws ApiError
 */
export const authDiscoverAuthMethod = (
  data: AuthDiscoverAuthMethodData
): CancelablePromise<AuthDiscoverAuthMethodResponse> => {
  return __request(OpenAPI, {
    method: "POST",
    url: "/auth/discover",
    body: data.requestBody,
    mediaType: "application/json",
    errors: {
      422: "Validation Error",
    },
  })
}

/**
 * Check Health
 * @returns HealthResponse Successful Response
 * @throws ApiError
 */
export const publicCheckHealth =
  (): CancelablePromise<PublicCheckHealthResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/health",
    })
  }

/**
 * Check Ready
 * Readiness check - returns 200 only after startup and registry sync complete.
 *
 * Use this endpoint for Docker healthchecks to ensure the API has finished
 * initializing and the platform registry is synced before accepting traffic.
 *
 * Returns a detailed response including registry sync status.
 * @returns ReadinessResponse Successful Response
 * @throws ApiError
 */
export const publicCheckReady =
  (): CancelablePromise<PublicCheckReadyResponse> => {
    return __request(OpenAPI, {
      method: "GET",
      url: "/ready",
      errors: {
        503: "API startup or platform registry sync is incomplete.",
      },
    })
  }
