From ff00a8ba7a5ef602573d2e0e7b19a5becfffe2ba Mon Sep 17 00:00:00 2001 From: Karan Saraswat Date: Mon, 28 Oct 2024 17:21:39 +0000 Subject: [PATCH] fix: [CODE-2628]: replaced TypesRepository with RepoRepositoryOutput from swagger (#2882) * fixed other types too * fix: [CODE-2628]: replaced TypesRepository with RepoRepositoryOutput from swagger --- app/api/openapi/space.go | 3 +- .../GitnessRepoImportForm.tsx | 6 +- .../CreateBranchModal/CreateBranchModal.tsx | 8 +- .../CreateTagModal/CreateTagModal.tsx | 8 +- .../components/LatestCommit/LatestCommit.tsx | 8 +- .../NewRepoModalButton/NewRepoModalButton.tsx | 3 +- web/src/hooks/useFindGitBranch.ts | 4 +- .../PullRequestOverviewPanel.tsx | 4 +- .../BranchesContent/BranchesContent.tsx | 24 +- .../RepositoryBranchesContent.tsx | 4 +- .../TagsContent/TagsContent.tsx | 10 +- .../pages/UserProfile/NewToken/NewToken.tsx | 4 +- web/src/pages/WebhookNew/WehookForm.tsx | 4 +- web/src/services/code/index.tsx | 1041 ++++++++++++--- web/src/services/code/swagger.yaml | 1171 +++++++++++++++-- 15 files changed, 1990 insertions(+), 312 deletions(-) diff --git a/app/api/openapi/space.go b/app/api/openapi/space.go index 9e64d2474..8c048d93a 100644 --- a/app/api/openapi/space.go +++ b/app/api/openapi/space.go @@ -17,6 +17,7 @@ package openapi import ( "net/http" + "github.com/harness/gitness/app/api/controller/repo" "github.com/harness/gitness/app/api/controller/space" "github.com/harness/gitness/app/api/request" "github.com/harness/gitness/app/api/usererror" @@ -319,7 +320,7 @@ func spaceOperations(reflector *openapi3.Reflector) { opRepos.WithParameters(queryParameterQueryRepo, queryParameterSortRepo, queryParameterOrder, QueryParameterPage, QueryParameterLimit) _ = reflector.SetRequest(&opRepos, new(spaceRequest), http.MethodGet) - _ = reflector.SetJSONResponse(&opRepos, []types.Repository{}, http.StatusOK) + _ = reflector.SetJSONResponse(&opRepos, []repo.RepositoryOutput{}, http.StatusOK) _ = reflector.SetJSONResponse(&opRepos, new(usererror.Error), http.StatusInternalServerError) _ = reflector.SetJSONResponse(&opRepos, new(usererror.Error), http.StatusUnauthorized) _ = reflector.SetJSONResponse(&opRepos, new(usererror.Error), http.StatusForbidden) diff --git a/web/src/cde-gitness/components/GitnessRepoImportForm/GitnessRepoImportForm.tsx b/web/src/cde-gitness/components/GitnessRepoImportForm/GitnessRepoImportForm.tsx index 17ffef466..8f7657384 100644 --- a/web/src/cde-gitness/components/GitnessRepoImportForm/GitnessRepoImportForm.tsx +++ b/web/src/cde-gitness/components/GitnessRepoImportForm/GitnessRepoImportForm.tsx @@ -22,7 +22,7 @@ import { Color } from '@harnessio/design-system' import { Icon } from '@harnessio/icons' import { Repository } from 'iconoir-react' import { useFormikContext } from 'formik' -import type { TypesRepository } from 'services/code' +import type { RepoRepositoryOutput } from 'services/code' import { useGetSpaceParam } from 'hooks/useGetSpaceParam' import { String, useStrings } from 'framework/strings' import { LIST_FETCHING_LIMIT } from 'utils/Utils' @@ -41,7 +41,7 @@ const RepositoryText = ({ value, isCDE }: { - repoList: TypesRepository[] | null + repoList: RepoRepositoryOutput[] | null value?: string isCDE?: boolean }) => { @@ -105,7 +105,7 @@ export const GitnessRepoImportForm = ({ isCDE }: { isCDE?: boolean }) => { data: repositories, loading, refetch: refetchRepos - } = useGet({ + } = useGet({ path: `/api/v1/spaces/${space}/+/repos`, queryParams: { query: repoSearch }, debounce: 500 diff --git a/web/src/components/CreateBranchModal/CreateBranchModal.tsx b/web/src/components/CreateBranchModal/CreateBranchModal.tsx index ed65cf1f5..8361add91 100644 --- a/web/src/components/CreateBranchModal/CreateBranchModal.tsx +++ b/web/src/components/CreateBranchModal/CreateBranchModal.tsx @@ -43,7 +43,7 @@ import { useStrings } from 'framework/strings' import { getErrorMessage, permissionProps } from 'utils/Utils' import { GitInfoProps, normalizeGitRef, isGitBranchNameValid } from 'utils/GitUtils' import { BranchTagSelect } from 'components/BranchTagSelect/BranchTagSelect' -import type { TypesBranch } from 'services/code' +import type { TypesBranchExtended } from 'services/code' import { useGetSpaceParam } from 'hooks/useGetSpaceParam' import { useRuleViolationCheck } from 'hooks/useRuleViolationCheck' import { useAppContext } from 'AppContext' @@ -57,14 +57,14 @@ interface FormData { interface UseCreateBranchModalProps extends Pick { suggestedBranchName?: string suggestedSourceBranch?: string - onSuccess: (data: TypesBranch) => void + onSuccess: (data: TypesBranchExtended) => void showSuccessMessage?: boolean showBranchTag?: boolean refIsATag?: boolean } interface CreateBranchModalButtonProps extends Omit, UseCreateBranchModalProps { - onSuccess: (data: TypesBranch) => void + onSuccess: (data: TypesBranchExtended) => void showSuccessMessage?: boolean } @@ -83,7 +83,7 @@ export function useCreateBranchModal({ const [sourceBranch, setSourceBranch] = useState(suggestedSourceBranch || (repoMetadata.default_branch as string)) const { showError, showSuccess } = useToaster() const { violation, bypassable, bypassed, setAllStates } = useRuleViolationCheck() - const { mutate: createBranch, loading } = useMutate({ + const { mutate: createBranch, loading } = useMutate({ verb: 'POST', path: `/api/v1/repos/${repoMetadata.path}/+/branches` }) diff --git a/web/src/components/CreateTagModal/CreateTagModal.tsx b/web/src/components/CreateTagModal/CreateTagModal.tsx index 1901460b6..51f1478d5 100644 --- a/web/src/components/CreateTagModal/CreateTagModal.tsx +++ b/web/src/components/CreateTagModal/CreateTagModal.tsx @@ -41,7 +41,7 @@ import { useStrings } from 'framework/strings' import { getErrorMessage, permissionProps } from 'utils/Utils' import { GitInfoProps, normalizeGitRef, isGitBranchNameValid } from 'utils/GitUtils' import { BranchTagSelect } from 'components/BranchTagSelect/BranchTagSelect' -import type { TypesBranch } from 'services/code' +import type { TypesBranchExtended } from 'services/code' import { useGetSpaceParam } from 'hooks/useGetSpaceParam' import { useAppContext } from 'AppContext' import css from './CreateTagModal.module.scss' @@ -55,12 +55,12 @@ interface FormData { interface UseCreateTagModalProps extends Pick { suggestedBranchName?: string suggestedSourceBranch?: string - onSuccess: (data: TypesBranch) => void + onSuccess: (data: TypesBranchExtended) => void showSuccessMessage?: boolean } interface CreateTagModalButtonProps extends Omit, UseCreateTagModalProps { - onSuccess: (data: TypesBranch) => void + onSuccess: (data: TypesBranchExtended) => void showSuccessMessage?: boolean } @@ -76,7 +76,7 @@ export function useCreateTagModal({ const { getString } = useStrings() const [sourceBranch, setSourceBranch] = useState(suggestedSourceBranch || (repoMetadata.default_branch as string)) const { showError, showSuccess } = useToaster() - const { mutate: createTag, loading } = useMutate({ + const { mutate: createTag, loading } = useMutate({ verb: 'POST', path: `/api/v1/repos/${repoMetadata.path}/+/tags` }) diff --git a/web/src/components/LatestCommit/LatestCommit.tsx b/web/src/components/LatestCommit/LatestCommit.tsx index f78dace34..0525b93a1 100644 --- a/web/src/components/LatestCommit/LatestCommit.tsx +++ b/web/src/components/LatestCommit/LatestCommit.tsx @@ -37,7 +37,7 @@ import { Icon } from '@harnessio/icons' import { useMutate } from 'restful-react' import type { OpenapiCalculateCommitDivergenceRequest, - RepoCommitDivergence, + TypesCommitDivergence, TypesCommit, RepoRepositoryOutput } from 'services/code' @@ -59,7 +59,7 @@ interface LatestCommitProps extends Pick({}) + const [divergence, setDivergence] = useState({}) const commitURL = routes.toCODECommit({ repoPath: repoMetadata.path as string, @@ -111,7 +111,7 @@ export function LatestCommitForFolder({ if (isMounted.current && branchDivergenceRequestBody.requests?.length && gitRef !== repoMetadata.default_branch) { setDivergence({}) getBranchDivergence(branchDivergenceRequestBody) - .then(([response]: RepoCommitDivergence[]) => { + .then(([response]: TypesCommitDivergence[]) => { if (isMounted.current) { setDivergence(response) } diff --git a/web/src/components/NewRepoModalButton/NewRepoModalButton.tsx b/web/src/components/NewRepoModalButton/NewRepoModalButton.tsx index 39727c9c6..85b7b10de 100644 --- a/web/src/components/NewRepoModalButton/NewRepoModalButton.tsx +++ b/web/src/components/NewRepoModalButton/NewRepoModalButton.tsx @@ -75,7 +75,6 @@ import type { OpenapiCreateRepositoryRequest } from 'services/code' import { useAppContext } from 'AppContext' -import type { TypesRepository } from 'cde-gitness/services' import { usePublicResourceConfig } from 'hooks/usePublicResourceConfig' import ImportForm from './ImportForm/ImportForm' import ImportReposForm from './ImportReposForm/ImportReposForm' @@ -97,7 +96,7 @@ export interface NewRepoModalButtonProps extends Omit void + onSubmit: (data: RepoRepositoryOutput & SpaceImportRepositoriesOutput) => void repoCreationType?: RepoCreationType customRenderer?: (onChange: (event: any) => void) => React.ReactNode } diff --git a/web/src/hooks/useFindGitBranch.ts b/web/src/hooks/useFindGitBranch.ts index 8e90425e6..0d8be584c 100644 --- a/web/src/hooks/useFindGitBranch.ts +++ b/web/src/hooks/useFindGitBranch.ts @@ -16,13 +16,13 @@ import { useGet } from 'restful-react' import { useAtomValue } from 'jotai' -import type { TypesBranch } from 'services/code' +import type { TypesBranchExtended } from 'services/code' import { LIST_FETCHING_LIMIT } from 'utils/Utils' import { repoMetadataAtom } from 'atoms/repoMetadata' export function useFindGitBranch(branchName?: string, includeCommit = false) { const repoMetadata = useAtomValue(repoMetadataAtom) - const { data } = useGet({ + const { data } = useGet({ path: `/api/v1/repos/${repoMetadata?.path}/+/branches`, queryParams: { limit: LIST_FETCHING_LIMIT, diff --git a/web/src/pages/PullRequest/Conversation/PullRequestOverviewPanel/PullRequestOverviewPanel.tsx b/web/src/pages/PullRequest/Conversation/PullRequestOverviewPanel/PullRequestOverviewPanel.tsx index 59c2bb23d..a7eca7c4c 100644 --- a/web/src/pages/PullRequest/Conversation/PullRequestOverviewPanel/PullRequestOverviewPanel.tsx +++ b/web/src/pages/PullRequest/Conversation/PullRequestOverviewPanel/PullRequestOverviewPanel.tsx @@ -27,7 +27,7 @@ import type { TypesPullReqReviewer, RepoRepositoryOutput, TypesRuleViolations, - TypesBranch + TypesBranchExtended } from 'services/code' import { PRMergeOption, @@ -125,7 +125,7 @@ const PullRequestOverviewPanel = (props: PullRequestOverviewPanelProps) => { data: sourceBranch, error, refetch: refetchBranch - } = useGet({ + } = useGet({ path: `/api/v1/repos/${repoMetadata?.path}/+/branches/${pullReqMetadata?.source_branch}`, queryParams: { repo_ref: repoMetadata.path || '', diff --git a/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx b/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx index 3e8fef22f..5d5bdfac2 100644 --- a/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx +++ b/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx @@ -39,8 +39,8 @@ import { String, useStrings } from 'framework/strings' import { useAppContext } from 'AppContext' import type { OpenapiCalculateCommitDivergenceRequest, - TypesBranch, - RepoCommitDivergence, + TypesBranchExtended, + TypesCommitDivergence, RepoRepositoryOutput } from 'services/code' import { CommitActions } from 'components/CommitActions/CommitActions' @@ -55,7 +55,7 @@ import css from './BranchesContent.module.scss' interface BranchesContentProps { searchTerm?: string repoMetadata: RepoRepositoryOutput - branches: TypesBranch[] + branches: TypesBranchExtended[] onDeleteSuccess: () => void } @@ -67,7 +67,7 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel verb: 'POST', path: `/api/v1/repos/${repoMetadata.path}/+/commits/calculate-divergence` }) - const [divergence, setDivergence] = useState([]) + const [divergence, setDivergence] = useState([]) const branchDivergenceRequestBody: OpenapiCalculateCommitDivergenceRequest = useMemo(() => { return { maxCount: 0, @@ -80,7 +80,7 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel if (isMounted.current && branchDivergenceRequestBody.requests?.length) { setDivergence([]) getBranchDivergence(branchDivergenceRequestBody) - .then((response: RepoCommitDivergence[]) => { + .then((response: TypesCommitDivergence[]) => { if (isMounted.current) { setDivergence(response) } @@ -89,12 +89,12 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel } }, [getBranchDivergence, branchDivergenceRequestBody, isMounted]) - const columns: Column[] = useMemo( + const columns: Column[] = useMemo( () => [ { Header: getString('branch'), width: '30%', - Cell: ({ row }: CellProps) => { + Cell: ({ row }: CellProps) => { return ( ) => { + Cell: ({ row }: CellProps) => { if (row.original?.name === repoMetadata.default_branch) { return ( @@ -141,7 +141,7 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel Header: getString('commit'), Id: 'commit', width: '15%', - Cell: ({ row }: CellProps) => { + Cell: ({ row }: CellProps) => { return ( ) => { + Cell: ({ row }: CellProps) => { return ( @@ -170,7 +170,7 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel { id: 'action', width: '30px', - Cell: ({ row }: CellProps) => { + Cell: ({ row }: CellProps) => { const { violation, bypassable, bypassed, setAllStates } = useRuleViolationCheck() const [persistModal, setPersistModal] = useState(true) const { mutate: deleteBranch } = useMutate({ @@ -277,7 +277,7 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel return ( - + className={css.table} columns={columns} data={branches || []} diff --git a/web/src/pages/RepositoryBranches/RepositoryBranchesContent/RepositoryBranchesContent.tsx b/web/src/pages/RepositoryBranches/RepositoryBranchesContent/RepositoryBranchesContent.tsx index f086cce64..290a2ec1d 100644 --- a/web/src/pages/RepositoryBranches/RepositoryBranchesContent/RepositoryBranchesContent.tsx +++ b/web/src/pages/RepositoryBranches/RepositoryBranchesContent/RepositoryBranchesContent.tsx @@ -19,7 +19,7 @@ import { Container } from '@harnessio/uicore' import { useGet } from 'restful-react' import { Render } from 'react-jsx-match' import { useHistory } from 'react-router-dom' -import type { TypesBranch, RepoRepositoryOutput } from 'services/code' +import type { TypesBranchExtended, RepoRepositoryOutput } from 'services/code' import { usePageIndex } from 'hooks/usePageIndex' import { LIST_FETCHING_LIMIT, PageBrowserProps } from 'utils/Utils' import { useAppContext } from 'AppContext' @@ -48,7 +48,7 @@ export function RepositoryBranchesContent({ repoMetadata }: Partial({ + } = useGet({ path: `/api/v1/repos/${repoMetadata?.path}/+/branches`, queryParams: { limit: LIST_FETCHING_LIMIT, diff --git a/web/src/pages/RepositoryTags/TagsContent/TagsContent.tsx b/web/src/pages/RepositoryTags/TagsContent/TagsContent.tsx index 1d36d45cb..f78a10828 100644 --- a/web/src/pages/RepositoryTags/TagsContent/TagsContent.tsx +++ b/web/src/pages/RepositoryTags/TagsContent/TagsContent.tsx @@ -26,7 +26,7 @@ import { noop } from 'lodash-es' import { String, useStrings } from 'framework/strings' import { useAppContext } from 'AppContext' -import type { TypesBranch, RepoCommitTag, RepoRepositoryOutput } from 'services/code' +import type { TypesBranchExtended, RepoCommitTag, RepoRepositoryOutput } from 'services/code' import { formatDate, getErrorMessage, voidFn } from 'utils/Utils' import { useConfirmAction } from 'hooks/useConfirmAction' import { OptionsMenuButton } from 'components/OptionsMenuButton/OptionsMenuButton' @@ -38,7 +38,7 @@ import css from './TagsContent.module.scss' interface TagsContentProps { searchTerm?: string repoMetadata: RepoRepositoryOutput - branches: TypesBranch[] + branches: TypesBranchExtended[] onDeleteSuccess: () => void } @@ -49,7 +49,7 @@ export function TagsContent({ repoMetadata, searchTerm = '', branches, onDeleteS const onSuccess = voidFn(noop) - const columns: Column[] = useMemo( + const columns: Column[] = useMemo( () => [ { Header: getString('tag'), @@ -139,7 +139,7 @@ export function TagsContent({ repoMetadata, searchTerm = '', branches, onDeleteS { id: 'action', width: '30px', - Cell: ({ row }: CellProps) => { + Cell: ({ row }: CellProps) => { const { mutate: deleteBranch } = useMutate({ verb: 'DELETE', path: `/api/v1/repos/${repoMetadata.path}/+/tags/${row.original.name}` @@ -235,7 +235,7 @@ export function TagsContent({ repoMetadata, searchTerm = '', branches, onDeleteS return ( - + className={css.table} columns={columns} data={branches || []} diff --git a/web/src/pages/UserProfile/NewToken/NewToken.tsx b/web/src/pages/UserProfile/NewToken/NewToken.tsx index bf7ef4d6b..d5704b377 100644 --- a/web/src/pages/UserProfile/NewToken/NewToken.tsx +++ b/web/src/pages/UserProfile/NewToken/NewToken.tsx @@ -37,7 +37,7 @@ import { Else, Match, Render, Truthy } from 'react-jsx-match' import { omit } from 'lodash-es' import { useModalHook } from 'hooks/useModalHook' import { useStrings } from 'framework/strings' -import type { OpenapiCreateTokenRequest } from 'services/code' +import type { UserCreateTokenInput } from 'services/code' import { REGEX_VALID_REPO_NAME, getErrorMessage } from 'utils/Utils' import { CodeIcon } from 'utils/GitUtils' import { CopyButton } from 'components/CopyButton/CopyButton' @@ -73,7 +73,7 @@ const useNewToken = ({ onClose }: { onClose: () => void }) => { const [openModal, hideModal] = useModalHook(() => { return ( - + initialValues={{ identifier: '' }} diff --git a/web/src/pages/WebhookNew/WehookForm.tsx b/web/src/pages/WebhookNew/WehookForm.tsx index fef9a9e13..db4a44599 100644 --- a/web/src/pages/WebhookNew/WehookForm.tsx +++ b/web/src/pages/WebhookNew/WehookForm.tsx @@ -32,7 +32,7 @@ import { FormGroup } from '@blueprintjs/core' import { useHistory } from 'react-router-dom' import * as yup from 'yup' import React from 'react' -import type { OpenapiUpdateWebhookRequest, EnumWebhookTrigger, OpenapiWebhookType } from 'services/code' +import type { OpenapiUpdateRepoWebhookRequest, EnumWebhookTrigger, OpenapiWebhookType } from 'services/code' import { getErrorMessage, permissionProps } from 'utils/Utils' import { useStrings } from 'framework/strings' import { WebhookIndividualEvent, type GitInfoProps, WebhookEventType } from 'utils/GitUtils' @@ -177,7 +177,7 @@ export function WehookForm({ repoMetadata, isEdit, webhook }: WebHookFormProps) const secret = (formData.secret || '').trim() - const data: OpenapiUpdateWebhookRequest = { + const data: OpenapiUpdateRepoWebhookRequest = { identifier: formData.name, description: formData.description, url: formData.url, diff --git a/web/src/services/code/index.tsx b/web/src/services/code/index.tsx index 5f0ab56b3..fe769a986 100644 --- a/web/src/services/code/index.tsx +++ b/web/src/services/code/index.tsx @@ -79,6 +79,7 @@ export type EnumGitspaceEventType = | 'agent_gitspace_state_report_error' | 'agent_gitspace_state_report_stopped' | 'agent_gitspace_state_report_unknown' + | 'gitspace_action_auto_stop' export type EnumGitspaceInstanceStateType = | 'running' @@ -181,6 +182,7 @@ export type EnumWebhookTrigger = | 'pullreq_closed' | 'pullreq_comment_created' | 'pullreq_created' + | 'pullreq_label_assigned' | 'pullreq_merged' | 'pullreq_reopened' | 'pullreq_updated' @@ -191,6 +193,12 @@ export type EnumWebhookTrigger = export interface GitBlamePart { commit?: GitCommit lines?: string[] | null + previous?: GitBlamePartPrevious +} + +export interface GitBlamePartPrevious { + commit_sha?: ShaSHA + file_name?: string } export interface GitCommit { @@ -415,6 +423,18 @@ export interface OpenapiCreatePullReqRequest { title?: string } +export interface OpenapiCreateRepoWebhookRequest { + description?: string + display_name?: string + enabled?: boolean + identifier?: string + insecure?: boolean + secret?: string + triggers?: EnumWebhookTrigger[] | null + uid?: string + url?: string +} + export interface OpenapiCreateRepositoryRequest { default_branch?: string description?: string @@ -444,6 +464,18 @@ export interface OpenapiCreateSpaceRequest { uid?: string } +export interface OpenapiCreateSpaceWebhookRequest { + description?: string + display_name?: string + enabled?: boolean + identifier?: string + insecure?: boolean + secret?: string + triggers?: EnumWebhookTrigger[] | null + uid?: string + url?: string +} + export interface OpenapiCreateTagRequest { bypass_rules?: boolean message?: string @@ -459,12 +491,6 @@ export interface OpenapiCreateTemplateRequest { uid?: string } -export interface OpenapiCreateTokenRequest { - identifier?: string - lifetime?: TimeDuration - uid?: string -} - export interface OpenapiCreateTriggerRequest { actions?: EnumTriggerAction[] | null description?: string @@ -474,18 +500,6 @@ export interface OpenapiCreateTriggerRequest { uid?: string } -export interface OpenapiCreateWebhookRequest { - description?: string - display_name?: string - enabled?: boolean - identifier?: string - insecure?: boolean - secret?: string - triggers?: EnumWebhookTrigger[] | null - uid?: string - url?: string -} - export interface OpenapiDirContent { entries?: OpenapiContentInfo[] | null } @@ -529,6 +543,7 @@ export interface OpenapiLookupRepoGitspaceRequest { export interface OpenapiMergePullReq { bypass_rules?: boolean dry_run?: boolean + dry_run_rules?: boolean message?: string method?: EnumMergeMethod source_sha?: string @@ -650,6 +665,18 @@ export interface OpenapiUpdateRepoRequest { description?: string | null } +export interface OpenapiUpdateRepoWebhookRequest { + description?: string | null + display_name?: string | null + enabled?: boolean | null + identifier?: string | null + insecure?: boolean | null + secret?: string | null + triggers?: EnumWebhookTrigger[] | null + uid?: string | null + url?: string | null +} + export interface OpenapiUpdateSecretRequest { data?: string | null description?: string | null @@ -665,6 +692,18 @@ export interface OpenapiUpdateSpaceRequest { description?: string | null } +export interface OpenapiUpdateSpaceWebhookRequest { + description?: string | null + display_name?: string | null + enabled?: boolean | null + identifier?: string | null + insecure?: boolean | null + secret?: string | null + triggers?: EnumWebhookTrigger[] | null + uid?: string | null + url?: string | null +} + export interface OpenapiUpdateTemplateRequest { data?: string | null description?: string | null @@ -681,18 +720,6 @@ export interface OpenapiUpdateTriggerRequest { uid?: string | null } -export interface OpenapiUpdateWebhookRequest { - description?: string | null - display_name?: string | null - enabled?: boolean | null - identifier?: string | null - insecure?: boolean | null - secret?: string | null - triggers?: EnumWebhookTrigger[] | null - uid?: string | null - url?: string | null -} - export interface OpenapiWebhookType { created?: number created_by?: number @@ -776,11 +803,6 @@ export interface PullreqSuggestionReference { comment_id?: number } -export interface RepoCommitDivergence { - ahead?: number - behind?: number -} - export interface RepoCommitDivergenceRequest { from?: string to?: string @@ -929,9 +951,14 @@ export interface SystemConfigOutput { gitspace_enabled?: boolean public_resource_creation_enabled?: boolean ssh_enabled?: boolean + ui?: SystemUI user_signup_allowed?: boolean } +export interface SystemUI { + show_plugin?: boolean +} + export type TimeDuration = number | null export interface TypesBasicAuthCreds { @@ -943,10 +970,15 @@ export interface TypesBearerTokenCreds { token?: TypesSecretRef } -export interface TypesBranch { +export interface TypesBranchExtended { + check_summary?: TypesCheckCountSummary commit?: TypesCommit + commit_divergence?: TypesCommitDivergence + is_default?: boolean name?: string - sha?: string + pull_requests?: TypesPullReq[] + rules?: TypesRuleInfo[] + sha?: ShaSHA } export interface TypesChangeStats { @@ -970,6 +1002,14 @@ export interface TypesCheck { updated?: number } +export interface TypesCheckCountSummary { + error?: number + failure?: number + pending?: number + running?: number + success?: number +} + export interface TypesCheckPayload { data?: {} kind?: EnumCheckPayloadKind @@ -1009,6 +1049,11 @@ export interface TypesCommit { title?: string } +export interface TypesCommitDivergence { + ahead?: number + behind?: number +} + export interface TypesCommitFileStats { changes?: number deletions?: number @@ -1059,7 +1104,7 @@ export interface TypesCreateBranchOutput { dry_run_rules?: boolean name?: string rule_violations?: TypesRuleViolations[] - sha?: string + sha?: ShaSHA } export interface TypesDeleteBranchOutput { @@ -1114,6 +1159,12 @@ export interface TypesExecution { updated?: number } +export interface TypesExecutionInfo { + number?: number + pipeline_id?: number + status?: EnumCIStatus +} + export interface TypesGithubConnectorData { api_url?: string auth?: TypesConnectorAuth @@ -1159,6 +1210,7 @@ export type TypesGitspaceInstance = { active_time_ended?: number | null active_time_started?: number | null created?: number + has_git_changes?: boolean | null identifier?: string last_heartbeat?: number | null last_used?: number | null @@ -1167,7 +1219,6 @@ export type TypesGitspaceInstance = { space_path?: string state?: EnumGitspaceInstanceStateType total_time_used?: number - tracked_changes?: string | null updated?: number url?: string | null } | null @@ -1296,6 +1347,8 @@ export interface TypesMergeResponse { branch_deleted?: boolean conflict_files?: string[] dry_run?: boolean + dry_run_rules?: boolean + mergeable?: boolean minimum_required_approvals_count?: number minimum_required_approvals_count_latest?: number requires_code_owners_approval?: boolean @@ -1328,6 +1381,7 @@ export interface TypesPipeline { execution?: TypesExecution id?: number identifier?: string + last_executions?: TypesExecutionInfo[] repo_id?: number repo_uid?: string seq?: number @@ -1379,6 +1433,8 @@ export interface TypesPullReq { merged?: number | null merger?: TypesPrincipalInfo number?: number + rebase_check_status?: EnumMergeCheckStatus + rebase_conflicts?: string[] source_branch?: string source_repo_id?: number source_sha?: string @@ -1620,6 +1676,14 @@ export interface TypesSpace { updated?: number } +export interface TypesSquashResponse { + conflict_files?: string[] + dry_run?: boolean + dry_run_rules?: boolean + new_head_branch_sha?: ShaSHA + rule_violations?: TypesRuleViolations[] +} + export interface TypesStage { arch?: string depends_on?: string[] @@ -1766,6 +1830,12 @@ export interface UserCreatePublicKeyInput { usage?: EnumPublicKeyUsage } +export interface UserCreateTokenInput { + identifier?: string + lifetime?: TimeDuration + uid?: string +} + export interface UserUpdateInput { display_name?: string | null email?: string | null @@ -2766,10 +2836,6 @@ export const useGetBlame = ({ repo_ref, path, ...props }: UseGetBlameProps) => ) export interface ListBranchesQueryParams { - /** - * Indicates whether optional commit information should be included in the response. - */ - include_commit?: boolean /** * The substring by which the branches are filtered. */ @@ -2790,6 +2856,26 @@ export interface ListBranchesQueryParams { * The maximum number of results to return. */ limit?: number + /** + * Indicates whether optional commit information should be included in the response. + */ + include_commit?: boolean + /** + * If true, the summary of check for the branch commit SHA would be included in the response. + */ + include_checks?: boolean + /** + * If true, a list of rules that apply to this branch would be included in the response. + */ + include_rules?: boolean + /** + * If true, a list of pull requests from the branch would be included in the response. + */ + include_pullreqs?: boolean + /** + * If greater than zero, branch divergence from the default branch will be included in the response. The divergence would be calculated up the this many commits. + */ + max_divergence?: number } export interface ListBranchesPathParams { @@ -2797,13 +2883,13 @@ export interface ListBranchesPathParams { } export type ListBranchesProps = Omit< - GetProps, + GetProps, 'path' > & ListBranchesPathParams export const ListBranches = ({ repo_ref, ...props }: ListBranchesProps) => ( - + path={`/repos/${repo_ref}/branches`} base={getConfig('code/api/v1')} {...props} @@ -2811,13 +2897,13 @@ export const ListBranches = ({ repo_ref, ...props }: ListBranchesProps) => ( ) export type UseListBranchesProps = Omit< - UseGetProps, + UseGetProps, 'path' > & ListBranchesPathParams export const useListBranches = ({ repo_ref, ...props }: UseListBranchesProps) => - useGet( + useGet( (paramsInPath: ListBranchesPathParams) => `/repos/${paramsInPath.repo_ref}/branches`, { base: getConfig('code/api/v1'), pathParams: { repo_ref }, ...props } ) @@ -2945,27 +3031,52 @@ export const useDeleteBranch = ({ repo_ref, ...props }: UseDeleteBranchProps) => ...props }) +export interface GetBranchQueryParams { + /** + * If true, the summary of check for the branch commit SHA would be included in the response. + */ + include_checks?: boolean + /** + * If true, a list of rules that apply to this branch would be included in the response. + */ + include_rules?: boolean + /** + * If true, a list of pull requests from the branch would be included in the response. + */ + include_pullreqs?: boolean + /** + * If greater than zero, branch divergence from the default branch will be included in the response. The divergence would be calculated up the this many commits. + */ + max_divergence?: number +} + export interface GetBranchPathParams { repo_ref: string branch_name: string } -export type GetBranchProps = Omit, 'path'> & +export type GetBranchProps = Omit< + GetProps, + 'path' +> & GetBranchPathParams export const GetBranch = ({ repo_ref, branch_name, ...props }: GetBranchProps) => ( - + path={`/repos/${repo_ref}/branches/${branch_name}`} base={getConfig('code/api/v1')} {...props} /> ) -export type UseGetBranchProps = Omit, 'path'> & +export type UseGetBranchProps = Omit< + UseGetProps, + 'path' +> & GetBranchPathParams export const useGetBranch = ({ repo_ref, branch_name, ...props }: UseGetBranchProps) => - useGet( + useGet( (paramsInPath: GetBranchPathParams) => `/repos/${paramsInPath.repo_ref}/branches/${paramsInPath.branch_name}`, { base: getConfig('code/api/v1'), pathParams: { repo_ref, branch_name }, ...props } ) @@ -3334,7 +3445,7 @@ export interface CalculateCommitDivergencePathParams { export type CalculateCommitDivergenceProps = Omit< MutateProps< - RepoCommitDivergence[], + TypesCommitDivergence[], UsererrorError, void, OpenapiCalculateCommitDivergenceRequest, @@ -3346,7 +3457,7 @@ export type CalculateCommitDivergenceProps = Omit< export const CalculateCommitDivergence = ({ repo_ref, ...props }: CalculateCommitDivergenceProps) => ( useMutate< - RepoCommitDivergence[], + TypesCommitDivergence[], UsererrorError, void, OpenapiCalculateCommitDivergenceRequest, @@ -4825,9 +4936,9 @@ export interface ListPullReqQueryParams { */ updated_gt?: number /** - * By providing this parameter the description would be included in the response. + * By providing this parameter the description would be excluded from the response. */ - include_description?: boolean + exclude_description?: boolean /** * The page to return. */ @@ -6168,6 +6279,56 @@ export const useStatePullReq = ({ repo_ref, pullreq_number, ...props }: UseState { base: getConfig('code/api/v1'), pathParams: { repo_ref, pullreq_number }, ...props } ) +export interface GetPullReqByBranchesQueryParams { + /** + * Source repository ref of the pull requests. + */ + source_repo_ref?: string +} + +export interface GetPullReqByBranchesPathParams { + repo_ref: string + target_branch: string + source_branch: string +} + +export type GetPullReqByBranchesProps = Omit< + GetProps, + 'path' +> & + GetPullReqByBranchesPathParams + +export const GetPullReqByBranches = ({ + repo_ref, + target_branch, + source_branch, + ...props +}: GetPullReqByBranchesProps) => ( + + path={`/repos/${repo_ref}/pullreq/${target_branch}...${source_branch}`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseGetPullReqByBranchesProps = Omit< + UseGetProps, + 'path' +> & + GetPullReqByBranchesPathParams + +export const useGetPullReqByBranches = ({ + repo_ref, + target_branch, + source_branch, + ...props +}: UseGetPullReqByBranchesProps) => + useGet( + (paramsInPath: GetPullReqByBranchesPathParams) => + `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.target_branch}...${paramsInPath.source_branch}`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref, target_branch, source_branch }, ...props } + ) + export interface PurgeRepositoryQueryParams { /** * The exact time the resource was delete at in epoch format. @@ -6245,6 +6406,7 @@ export interface RebaseBranchPathParams { export interface RebaseBranchRequestBody { base_branch?: string + base_commit_sha?: ShaSHA bypass_rules?: boolean dry_run?: boolean dry_run_rules?: boolean @@ -6764,6 +6926,74 @@ export const useUpdateSecuritySettings = ({ repo_ref, ...props }: UseUpdateSecur ...props }) +export interface SquashBranchPathParams { + repo_ref: string +} + +export interface SquashBranchRequestBody { + base_branch?: string + base_commit_sha?: ShaSHA + bypass_rules?: boolean + dry_run?: boolean + dry_run_rules?: boolean + head_branch?: string + head_commit_sha?: ShaSHA + message?: string + title?: string +} + +export type SquashBranchProps = Omit< + MutateProps< + TypesSquashResponse, + UsererrorError | TypesMergeViolations, + void, + SquashBranchRequestBody, + SquashBranchPathParams + >, + 'path' | 'verb' +> & + SquashBranchPathParams + +export const SquashBranch = ({ repo_ref, ...props }: SquashBranchProps) => ( + + verb="POST" + path={`/repos/${repo_ref}/squash`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseSquashBranchProps = Omit< + UseMutateProps< + TypesSquashResponse, + UsererrorError | TypesMergeViolations, + void, + SquashBranchRequestBody, + SquashBranchPathParams + >, + 'path' | 'verb' +> & + SquashBranchPathParams + +export const useSquashBranch = ({ repo_ref, ...props }: UseSquashBranchProps) => + useMutate< + TypesSquashResponse, + UsererrorError | TypesMergeViolations, + void, + SquashBranchRequestBody, + SquashBranchPathParams + >('POST', (paramsInPath: SquashBranchPathParams) => `/repos/${paramsInPath.repo_ref}/squash`, { + base: getConfig('code/api/v1'), + pathParams: { repo_ref }, + ...props + }) + export interface SummaryPathParams { repo_ref: string } @@ -6989,7 +7219,7 @@ export const useRepoArtifactDownload = ({ repo_ref, file_ref, ...props }: UseRep { base: getConfig('code/api/v1'), pathParams: { repo_ref, file_ref }, ...props } ) -export interface ListWebhooksQueryParams { +export interface ListRepoWebhooksQueryParams { /** * The substring which is used to filter the webhooks by their identifier. */ @@ -7012,48 +7242,48 @@ export interface ListWebhooksQueryParams { limit?: number } -export interface ListWebhooksPathParams { +export interface ListRepoWebhooksPathParams { repo_ref: string } -export type ListWebhooksProps = Omit< - GetProps, +export type ListRepoWebhooksProps = Omit< + GetProps, 'path' > & - ListWebhooksPathParams + ListRepoWebhooksPathParams -export const ListWebhooks = ({ repo_ref, ...props }: ListWebhooksProps) => ( - +export const ListRepoWebhooks = ({ repo_ref, ...props }: ListRepoWebhooksProps) => ( + path={`/repos/${repo_ref}/webhooks`} base={getConfig('code/api/v1')} {...props} /> ) -export type UseListWebhooksProps = Omit< - UseGetProps, +export type UseListRepoWebhooksProps = Omit< + UseGetProps, 'path' > & - ListWebhooksPathParams + ListRepoWebhooksPathParams -export const useListWebhooks = ({ repo_ref, ...props }: UseListWebhooksProps) => - useGet( - (paramsInPath: ListWebhooksPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks`, +export const useListRepoWebhooks = ({ repo_ref, ...props }: UseListRepoWebhooksProps) => + useGet( + (paramsInPath: ListRepoWebhooksPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks`, { base: getConfig('code/api/v1'), pathParams: { repo_ref }, ...props } ) -export interface CreateWebhookPathParams { +export interface CreateRepoWebhookPathParams { repo_ref: string } -export type CreateWebhookProps = Omit< - MutateProps, +export type CreateRepoWebhookProps = Omit< + MutateProps, 'path' | 'verb' > & - CreateWebhookPathParams + CreateRepoWebhookPathParams -export const CreateWebhook = ({ repo_ref, ...props }: CreateWebhookProps) => ( - +export const CreateRepoWebhook = ({ repo_ref, ...props }: CreateRepoWebhookProps) => ( + verb="POST" path={`/repos/${repo_ref}/webhooks`} base={getConfig('code/api/v1')} @@ -7061,31 +7291,37 @@ export const CreateWebhook = ({ repo_ref, ...props }: CreateWebhookProps) => ( /> ) -export type UseCreateWebhookProps = Omit< - UseMutateProps, +export type UseCreateRepoWebhookProps = Omit< + UseMutateProps< + OpenapiWebhookType, + UsererrorError, + void, + OpenapiCreateRepoWebhookRequest, + CreateRepoWebhookPathParams + >, 'path' | 'verb' > & - CreateWebhookPathParams + CreateRepoWebhookPathParams -export const useCreateWebhook = ({ repo_ref, ...props }: UseCreateWebhookProps) => - useMutate( +export const useCreateRepoWebhook = ({ repo_ref, ...props }: UseCreateRepoWebhookProps) => + useMutate( 'POST', - (paramsInPath: CreateWebhookPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks`, + (paramsInPath: CreateRepoWebhookPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks`, { base: getConfig('code/api/v1'), pathParams: { repo_ref }, ...props } ) -export interface DeleteWebhookPathParams { +export interface DeleteRepoWebhookPathParams { repo_ref: string } -export type DeleteWebhookProps = Omit< - MutateProps, +export type DeleteRepoWebhookProps = Omit< + MutateProps, 'path' | 'verb' > & - DeleteWebhookPathParams + DeleteRepoWebhookPathParams -export const DeleteWebhook = ({ repo_ref, ...props }: DeleteWebhookProps) => ( - +export const DeleteRepoWebhook = ({ repo_ref, ...props }: DeleteRepoWebhookProps) => ( + verb="DELETE" path={`/repos/${repo_ref}/webhooks`} base={getConfig('code/api/v1')} @@ -7093,61 +7329,64 @@ export const DeleteWebhook = ({ repo_ref, ...props }: DeleteWebhookProps) => ( /> ) -export type UseDeleteWebhookProps = Omit< - UseMutateProps, +export type UseDeleteRepoWebhookProps = Omit< + UseMutateProps, 'path' | 'verb' > & - DeleteWebhookPathParams + DeleteRepoWebhookPathParams -export const useDeleteWebhook = ({ repo_ref, ...props }: UseDeleteWebhookProps) => - useMutate( +export const useDeleteRepoWebhook = ({ repo_ref, ...props }: UseDeleteRepoWebhookProps) => + useMutate( 'DELETE', - (paramsInPath: DeleteWebhookPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks`, + (paramsInPath: DeleteRepoWebhookPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks`, { base: getConfig('code/api/v1'), pathParams: { repo_ref }, ...props } ) -export interface GetWebhookPathParams { +export interface GetRepoWebhookPathParams { repo_ref: string webhook_identifier: number } -export type GetWebhookProps = Omit, 'path'> & - GetWebhookPathParams +export type GetRepoWebhookProps = Omit< + GetProps, + 'path' +> & + GetRepoWebhookPathParams -export const GetWebhook = ({ repo_ref, webhook_identifier, ...props }: GetWebhookProps) => ( - +export const GetRepoWebhook = ({ repo_ref, webhook_identifier, ...props }: GetRepoWebhookProps) => ( + path={`/repos/${repo_ref}/webhooks/${webhook_identifier}`} base={getConfig('code/api/v1')} {...props} /> ) -export type UseGetWebhookProps = Omit< - UseGetProps, +export type UseGetRepoWebhookProps = Omit< + UseGetProps, 'path' > & - GetWebhookPathParams + GetRepoWebhookPathParams -export const useGetWebhook = ({ repo_ref, webhook_identifier, ...props }: UseGetWebhookProps) => - useGet( - (paramsInPath: GetWebhookPathParams) => +export const useGetRepoWebhook = ({ repo_ref, webhook_identifier, ...props }: UseGetRepoWebhookProps) => + useGet( + (paramsInPath: GetRepoWebhookPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks/${paramsInPath.webhook_identifier}`, { base: getConfig('code/api/v1'), pathParams: { repo_ref, webhook_identifier }, ...props } ) -export interface UpdateWebhookPathParams { +export interface UpdateRepoWebhookPathParams { repo_ref: string webhook_identifier: number } -export type UpdateWebhookProps = Omit< - MutateProps, +export type UpdateRepoWebhookProps = Omit< + MutateProps, 'path' | 'verb' > & - UpdateWebhookPathParams + UpdateRepoWebhookPathParams -export const UpdateWebhook = ({ repo_ref, webhook_identifier, ...props }: UpdateWebhookProps) => ( - +export const UpdateRepoWebhook = ({ repo_ref, webhook_identifier, ...props }: UpdateRepoWebhookProps) => ( + verb="PATCH" path={`/repos/${repo_ref}/webhooks/${webhook_identifier}`} base={getConfig('code/api/v1')} @@ -7155,21 +7394,27 @@ export const UpdateWebhook = ({ repo_ref, webhook_identifier, ...props }: Update /> ) -export type UseUpdateWebhookProps = Omit< - UseMutateProps, +export type UseUpdateRepoWebhookProps = Omit< + UseMutateProps< + OpenapiWebhookType, + UsererrorError, + void, + OpenapiUpdateRepoWebhookRequest, + UpdateRepoWebhookPathParams + >, 'path' | 'verb' > & - UpdateWebhookPathParams + UpdateRepoWebhookPathParams -export const useUpdateWebhook = ({ repo_ref, webhook_identifier, ...props }: UseUpdateWebhookProps) => - useMutate( +export const useUpdateRepoWebhook = ({ repo_ref, webhook_identifier, ...props }: UseUpdateRepoWebhookProps) => + useMutate( 'PATCH', - (paramsInPath: UpdateWebhookPathParams) => + (paramsInPath: UpdateRepoWebhookPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks/${paramsInPath.webhook_identifier}`, { base: getConfig('code/api/v1'), pathParams: { repo_ref, webhook_identifier }, ...props } ) -export interface ListWebhookExecutionsQueryParams { +export interface ListRepoWebhookExecutionsQueryParams { /** * The page to return. */ @@ -7180,44 +7425,67 @@ export interface ListWebhookExecutionsQueryParams { limit?: number } -export interface ListWebhookExecutionsPathParams { +export interface ListRepoWebhookExecutionsPathParams { repo_ref: string webhook_identifier: number } -export type ListWebhookExecutionsProps = Omit< - GetProps, +export type ListRepoWebhookExecutionsProps = Omit< + GetProps< + TypesWebhookExecution[], + UsererrorError, + ListRepoWebhookExecutionsQueryParams, + ListRepoWebhookExecutionsPathParams + >, 'path' > & - ListWebhookExecutionsPathParams + ListRepoWebhookExecutionsPathParams -export const ListWebhookExecutions = ({ repo_ref, webhook_identifier, ...props }: ListWebhookExecutionsProps) => ( - +export const ListRepoWebhookExecutions = ({ + repo_ref, + webhook_identifier, + ...props +}: ListRepoWebhookExecutionsProps) => ( + path={`/repos/${repo_ref}/webhooks/${webhook_identifier}/executions`} base={getConfig('code/api/v1')} {...props} /> ) -export type UseListWebhookExecutionsProps = Omit< +export type UseListRepoWebhookExecutionsProps = Omit< UseGetProps< TypesWebhookExecution[], UsererrorError, - ListWebhookExecutionsQueryParams, - ListWebhookExecutionsPathParams + ListRepoWebhookExecutionsQueryParams, + ListRepoWebhookExecutionsPathParams >, 'path' > & - ListWebhookExecutionsPathParams + ListRepoWebhookExecutionsPathParams -export const useListWebhookExecutions = ({ repo_ref, webhook_identifier, ...props }: UseListWebhookExecutionsProps) => - useGet( - (paramsInPath: ListWebhookExecutionsPathParams) => +export const useListRepoWebhookExecutions = ({ + repo_ref, + webhook_identifier, + ...props +}: UseListRepoWebhookExecutionsProps) => + useGet< + TypesWebhookExecution[], + UsererrorError, + ListRepoWebhookExecutionsQueryParams, + ListRepoWebhookExecutionsPathParams + >( + (paramsInPath: ListRepoWebhookExecutionsPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks/${paramsInPath.webhook_identifier}/executions`, { base: getConfig('code/api/v1'), pathParams: { repo_ref, webhook_identifier }, ...props } ) -export interface GetWebhookExecutionQueryParams { +export interface GetRepoWebhookExecutionQueryParams { /** * The page to return. */ @@ -7228,49 +7496,104 @@ export interface GetWebhookExecutionQueryParams { limit?: number } -export interface GetWebhookExecutionPathParams { +export interface GetRepoWebhookExecutionPathParams { repo_ref: string webhook_identifier: number webhook_execution_id: number } -export type GetWebhookExecutionProps = Omit< - GetProps, +export type GetRepoWebhookExecutionProps = Omit< + GetProps< + TypesWebhookExecution, + UsererrorError, + GetRepoWebhookExecutionQueryParams, + GetRepoWebhookExecutionPathParams + >, 'path' > & - GetWebhookExecutionPathParams + GetRepoWebhookExecutionPathParams -export const GetWebhookExecution = ({ +export const GetRepoWebhookExecution = ({ repo_ref, webhook_identifier, webhook_execution_id, ...props -}: GetWebhookExecutionProps) => ( - +}: GetRepoWebhookExecutionProps) => ( + path={`/repos/${repo_ref}/webhooks/${webhook_identifier}/executions/${webhook_execution_id}`} base={getConfig('code/api/v1')} {...props} /> ) -export type UseGetWebhookExecutionProps = Omit< - UseGetProps, +export type UseGetRepoWebhookExecutionProps = Omit< + UseGetProps< + TypesWebhookExecution, + UsererrorError, + GetRepoWebhookExecutionQueryParams, + GetRepoWebhookExecutionPathParams + >, 'path' > & - GetWebhookExecutionPathParams + GetRepoWebhookExecutionPathParams -export const useGetWebhookExecution = ({ +export const useGetRepoWebhookExecution = ({ repo_ref, webhook_identifier, webhook_execution_id, ...props -}: UseGetWebhookExecutionProps) => - useGet( - (paramsInPath: GetWebhookExecutionPathParams) => +}: UseGetRepoWebhookExecutionProps) => + useGet( + (paramsInPath: GetRepoWebhookExecutionPathParams) => `/repos/${paramsInPath.repo_ref}/webhooks/${paramsInPath.webhook_identifier}/executions/${paramsInPath.webhook_execution_id}`, { base: getConfig('code/api/v1'), pathParams: { repo_ref, webhook_identifier, webhook_execution_id }, ...props } ) +export interface RetriggerRepoWebhookExecutionPathParams { + repo_ref: string + webhook_identifier: number + webhook_execution_id: number +} + +export type RetriggerRepoWebhookExecutionProps = Omit< + MutateProps, + 'path' | 'verb' +> & + RetriggerRepoWebhookExecutionPathParams + +export const RetriggerRepoWebhookExecution = ({ + repo_ref, + webhook_identifier, + webhook_execution_id, + ...props +}: RetriggerRepoWebhookExecutionProps) => ( + + verb="POST" + path={`/repos/${repo_ref}/webhooks/${webhook_identifier}/executions/${webhook_execution_id}/retrigger`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseRetriggerRepoWebhookExecutionProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + RetriggerRepoWebhookExecutionPathParams + +export const useRetriggerRepoWebhookExecution = ({ + repo_ref, + webhook_identifier, + webhook_execution_id, + ...props +}: UseRetriggerRepoWebhookExecutionProps) => + useMutate( + 'POST', + (paramsInPath: RetriggerRepoWebhookExecutionPathParams) => + `/repos/${paramsInPath.repo_ref}/webhooks/${paramsInPath.webhook_identifier}/executions/${paramsInPath.webhook_execution_id}/retrigger`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref, webhook_identifier, webhook_execution_id }, ...props } + ) + export interface ImportRepositoryQueryParams { /** * path of parent space (Not needed in standalone). @@ -7512,9 +7835,9 @@ export interface ListSpacePullReqQueryParams { */ updated_lt?: number /** - * By providing this parameter the description would be included in the response. + * By providing this parameter the description would be excluded from the response. */ - include_description?: boolean + exclude_description?: boolean /** * The result should contain entries from the desired space and of its subspaces. */ @@ -8439,13 +8762,13 @@ export interface ListReposPathParams { } export type ListReposProps = Omit< - GetProps, + GetProps, 'path' > & ListReposPathParams export const ListRepos = ({ space_ref, ...props }: ListReposProps) => ( - + path={`/spaces/${space_ref}/repos`} base={getConfig('code/api/v1')} {...props} @@ -8453,13 +8776,13 @@ export const ListRepos = ({ space_ref, ...props }: ListReposProps) => ( ) export type UseListReposProps = Omit< - UseGetProps, + UseGetProps, 'path' > & ListReposPathParams export const useListRepos = ({ space_ref, ...props }: UseListReposProps) => - useGet( + useGet( (paramsInPath: ListReposPathParams) => `/spaces/${paramsInPath.space_ref}/repos`, { base: getConfig('code/api/v1'), pathParams: { space_ref }, ...props } ) @@ -8694,6 +9017,380 @@ export const useListTemplates = ({ space_ref, ...props }: UseListTemplatesProps) { base: getConfig('code/api/v1'), pathParams: { space_ref }, ...props } ) +export interface ListSpaceWebhooksQueryParams { + /** + * The substring which is used to filter the webhooks by their identifier. + */ + query?: string + /** + * The data by which the webhooks are sorted. + */ + sort?: 'id' | 'uid' | 'display_name' | 'created' | 'updated' + /** + * The order of the output. + */ + order?: 'asc' | 'desc' + /** + * The page to return. + */ + page?: number + /** + * The maximum number of results to return. + */ + limit?: number +} + +export interface ListSpaceWebhooksPathParams { + space_ref: string +} + +export type ListSpaceWebhooksProps = Omit< + GetProps, + 'path' +> & + ListSpaceWebhooksPathParams + +export const ListSpaceWebhooks = ({ space_ref, ...props }: ListSpaceWebhooksProps) => ( + + path={`/spaces/${space_ref}/webhooks`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseListSpaceWebhooksProps = Omit< + UseGetProps, + 'path' +> & + ListSpaceWebhooksPathParams + +export const useListSpaceWebhooks = ({ space_ref, ...props }: UseListSpaceWebhooksProps) => + useGet( + (paramsInPath: ListSpaceWebhooksPathParams) => `/spaces/${paramsInPath.space_ref}/webhooks`, + { base: getConfig('code/api/v1'), pathParams: { space_ref }, ...props } + ) + +export interface CreateSpaceWebhookPathParams { + space_ref: string +} + +export type CreateSpaceWebhookProps = Omit< + MutateProps, + 'path' | 'verb' +> & + CreateSpaceWebhookPathParams + +export const CreateSpaceWebhook = ({ space_ref, ...props }: CreateSpaceWebhookProps) => ( + + verb="POST" + path={`/spaces/${space_ref}/webhooks`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseCreateSpaceWebhookProps = Omit< + UseMutateProps< + OpenapiWebhookType, + UsererrorError, + void, + OpenapiCreateSpaceWebhookRequest, + CreateSpaceWebhookPathParams + >, + 'path' | 'verb' +> & + CreateSpaceWebhookPathParams + +export const useCreateSpaceWebhook = ({ space_ref, ...props }: UseCreateSpaceWebhookProps) => + useMutate( + 'POST', + (paramsInPath: CreateSpaceWebhookPathParams) => `/spaces/${paramsInPath.space_ref}/webhooks`, + { base: getConfig('code/api/v1'), pathParams: { space_ref }, ...props } + ) + +export interface DeleteWebhookPathParams { + space_ref: string +} + +export type DeleteWebhookProps = Omit< + MutateProps, + 'path' | 'verb' +> & + DeleteWebhookPathParams + +export const DeleteWebhook = ({ space_ref, ...props }: DeleteWebhookProps) => ( + + verb="DELETE" + path={`/spaces/${space_ref}/webhooks`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseDeleteWebhookProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + DeleteWebhookPathParams + +export const useDeleteWebhook = ({ space_ref, ...props }: UseDeleteWebhookProps) => + useMutate( + 'DELETE', + (paramsInPath: DeleteWebhookPathParams) => `/spaces/${paramsInPath.space_ref}/webhooks`, + { base: getConfig('code/api/v1'), pathParams: { space_ref }, ...props } + ) + +export interface GetSpaceWebhookPathParams { + space_ref: string + webhook_identifier: number +} + +export type GetSpaceWebhookProps = Omit< + GetProps, + 'path' +> & + GetSpaceWebhookPathParams + +export const GetSpaceWebhook = ({ space_ref, webhook_identifier, ...props }: GetSpaceWebhookProps) => ( + + path={`/spaces/${space_ref}/webhooks/${webhook_identifier}`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseGetSpaceWebhookProps = Omit< + UseGetProps, + 'path' +> & + GetSpaceWebhookPathParams + +export const useGetSpaceWebhook = ({ space_ref, webhook_identifier, ...props }: UseGetSpaceWebhookProps) => + useGet( + (paramsInPath: GetSpaceWebhookPathParams) => + `/spaces/${paramsInPath.space_ref}/webhooks/${paramsInPath.webhook_identifier}`, + { base: getConfig('code/api/v1'), pathParams: { space_ref, webhook_identifier }, ...props } + ) + +export interface UpdateWebhookPathParams { + space_ref: string + webhook_identifier: number +} + +export type UpdateWebhookProps = Omit< + MutateProps, + 'path' | 'verb' +> & + UpdateWebhookPathParams + +export const UpdateWebhook = ({ space_ref, webhook_identifier, ...props }: UpdateWebhookProps) => ( + + verb="PATCH" + path={`/spaces/${space_ref}/webhooks/${webhook_identifier}`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseUpdateWebhookProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + UpdateWebhookPathParams + +export const useUpdateWebhook = ({ space_ref, webhook_identifier, ...props }: UseUpdateWebhookProps) => + useMutate( + 'PATCH', + (paramsInPath: UpdateWebhookPathParams) => + `/spaces/${paramsInPath.space_ref}/webhooks/${paramsInPath.webhook_identifier}`, + { base: getConfig('code/api/v1'), pathParams: { space_ref, webhook_identifier }, ...props } + ) + +export interface ListSpaceWebhookExecutionsQueryParams { + /** + * The page to return. + */ + page?: number + /** + * The maximum number of results to return. + */ + limit?: number +} + +export interface ListSpaceWebhookExecutionsPathParams { + space_ref: string + webhook_identifier: number +} + +export type ListSpaceWebhookExecutionsProps = Omit< + GetProps< + TypesWebhookExecution[], + UsererrorError, + ListSpaceWebhookExecutionsQueryParams, + ListSpaceWebhookExecutionsPathParams + >, + 'path' +> & + ListSpaceWebhookExecutionsPathParams + +export const ListSpaceWebhookExecutions = ({ + space_ref, + webhook_identifier, + ...props +}: ListSpaceWebhookExecutionsProps) => ( + + path={`/spaces/${space_ref}/webhooks/${webhook_identifier}/executions`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseListSpaceWebhookExecutionsProps = Omit< + UseGetProps< + TypesWebhookExecution[], + UsererrorError, + ListSpaceWebhookExecutionsQueryParams, + ListSpaceWebhookExecutionsPathParams + >, + 'path' +> & + ListSpaceWebhookExecutionsPathParams + +export const useListSpaceWebhookExecutions = ({ + space_ref, + webhook_identifier, + ...props +}: UseListSpaceWebhookExecutionsProps) => + useGet< + TypesWebhookExecution[], + UsererrorError, + ListSpaceWebhookExecutionsQueryParams, + ListSpaceWebhookExecutionsPathParams + >( + (paramsInPath: ListSpaceWebhookExecutionsPathParams) => + `/spaces/${paramsInPath.space_ref}/webhooks/${paramsInPath.webhook_identifier}/executions`, + { base: getConfig('code/api/v1'), pathParams: { space_ref, webhook_identifier }, ...props } + ) + +export interface GetSpaceWebhookExecutionQueryParams { + /** + * The page to return. + */ + page?: number + /** + * The maximum number of results to return. + */ + limit?: number +} + +export interface GetSpaceWebhookExecutionPathParams { + space_ref: string + webhook_identifier: number + webhook_execution_id: number +} + +export type GetSpaceWebhookExecutionProps = Omit< + GetProps< + TypesWebhookExecution, + UsererrorError, + GetSpaceWebhookExecutionQueryParams, + GetSpaceWebhookExecutionPathParams + >, + 'path' +> & + GetSpaceWebhookExecutionPathParams + +export const GetSpaceWebhookExecution = ({ + space_ref, + webhook_identifier, + webhook_execution_id, + ...props +}: GetSpaceWebhookExecutionProps) => ( + + path={`/spaces/${space_ref}/webhooks/${webhook_identifier}/executions/${webhook_execution_id}`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseGetSpaceWebhookExecutionProps = Omit< + UseGetProps< + TypesWebhookExecution, + UsererrorError, + GetSpaceWebhookExecutionQueryParams, + GetSpaceWebhookExecutionPathParams + >, + 'path' +> & + GetSpaceWebhookExecutionPathParams + +export const useGetSpaceWebhookExecution = ({ + space_ref, + webhook_identifier, + webhook_execution_id, + ...props +}: UseGetSpaceWebhookExecutionProps) => + useGet< + TypesWebhookExecution, + UsererrorError, + GetSpaceWebhookExecutionQueryParams, + GetSpaceWebhookExecutionPathParams + >( + (paramsInPath: GetSpaceWebhookExecutionPathParams) => + `/spaces/${paramsInPath.space_ref}/webhooks/${paramsInPath.webhook_identifier}/executions/${paramsInPath.webhook_execution_id}`, + { base: getConfig('code/api/v1'), pathParams: { space_ref, webhook_identifier, webhook_execution_id }, ...props } + ) + +export interface RetriggerSpaceWebhookExecutionPathParams { + space_ref: string + webhook_identifier: number + webhook_execution_id: number +} + +export type RetriggerSpaceWebhookExecutionProps = Omit< + MutateProps, + 'path' | 'verb' +> & + RetriggerSpaceWebhookExecutionPathParams + +export const RetriggerSpaceWebhookExecution = ({ + space_ref, + webhook_identifier, + webhook_execution_id, + ...props +}: RetriggerSpaceWebhookExecutionProps) => ( + + verb="POST" + path={`/spaces/${space_ref}/webhooks/${webhook_identifier}/executions/${webhook_execution_id}/retrigger`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseRetriggerSpaceWebhookExecutionProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + RetriggerSpaceWebhookExecutionPathParams + +export const useRetriggerSpaceWebhookExecution = ({ + space_ref, + webhook_identifier, + webhook_execution_id, + ...props +}: UseRetriggerSpaceWebhookExecutionProps) => + useMutate( + 'POST', + (paramsInPath: RetriggerSpaceWebhookExecutionPathParams) => + `/spaces/${paramsInPath.space_ref}/webhooks/${paramsInPath.webhook_identifier}/executions/${paramsInPath.webhook_execution_id}/retrigger`, + { base: getConfig('code/api/v1'), pathParams: { space_ref, webhook_identifier, webhook_execution_id }, ...props } + ) + export interface ImportSpaceRequestBody { description?: string identifier?: string @@ -9019,27 +9716,57 @@ export const useMembershipSpaces = (props: UseMembershipSpacesProps) => ...props }) +export type ListTokensProps = Omit, 'path'> + +export const ListTokens = (props: ListTokensProps) => ( + path={`/user/tokens`} base={getConfig('code/api/v1')} {...props} /> +) + +export type UseListTokensProps = Omit, 'path'> + +export const useListTokens = (props: UseListTokensProps) => + useGet(`/user/tokens`, { base: getConfig('code/api/v1'), ...props }) + export type CreateTokenProps = Omit< - MutateProps, + MutateProps, 'path' | 'verb' > export const CreateToken = (props: CreateTokenProps) => ( - + verb="POST" - path={`/user/token`} + path={`/user/tokens`} base={getConfig('code/api/v1')} {...props} /> ) export type UseCreateTokenProps = Omit< - UseMutateProps, + UseMutateProps, 'path' | 'verb' > export const useCreateToken = (props: UseCreateTokenProps) => - useMutate('POST', `/user/token`, { + useMutate('POST', `/user/tokens`, { + base: getConfig('code/api/v1'), + ...props + }) + +export type DeleteTokenProps = Omit, 'path' | 'verb'> + +export const DeleteToken = (props: DeleteTokenProps) => ( + + verb="DELETE" + path={`/user/tokens`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseDeleteTokenProps = Omit, 'path' | 'verb'> + +export const useDeleteToken = (props: UseDeleteTokenProps) => + useMutate('DELETE', `/user/tokens`, { base: getConfig('code/api/v1'), ...props }) diff --git a/web/src/services/code/swagger.yaml b/web/src/services/code/swagger.yaml index fe49da6c2..a2cf55b46 100644 --- a/web/src/services/code/swagger.yaml +++ b/web/src/services/code/swagger.yaml @@ -1441,14 +1441,6 @@ paths: get: operationId: listBranches parameters: - - description: Indicates whether optional commit information should be included - in the response. - in: query - name: include_commit - required: false - schema: - default: false - type: boolean - description: The substring by which the branches are filtered. in: query name: query @@ -1492,6 +1484,47 @@ paths: maximum: 100 minimum: 1 type: integer + - description: Indicates whether optional commit information should be included + in the response. + in: query + name: include_commit + required: false + schema: + default: false + type: boolean + - description: If true, the summary of check for the branch commit SHA would + be included in the response. + in: query + name: include_checks + required: false + schema: + default: false + type: boolean + - description: If true, a list of rules that apply to this branch would be included + in the response. + in: query + name: include_rules + required: false + schema: + default: false + type: boolean + - description: If true, a list of pull requests from the branch would be included + in the response. + in: query + name: include_pullreqs + required: false + schema: + default: false + type: boolean + - description: If greater than zero, branch divergence from the default branch + will be included in the response. The divergence would be calculated up + the this many commits. + in: query + name: max_divergence + required: false + schema: + default: 0 + type: integer - in: path name: repo_ref required: true @@ -1503,7 +1536,7 @@ paths: application/json: schema: items: - $ref: '#/components/schemas/TypesBranch' + $ref: '#/components/schemas/TypesBranchExtended' type: array description: OK '401': @@ -1654,6 +1687,39 @@ paths: get: operationId: getBranch parameters: + - description: If true, the summary of check for the branch commit SHA would + be included in the response. + in: query + name: include_checks + required: false + schema: + default: false + type: boolean + - description: If true, a list of rules that apply to this branch would be included + in the response. + in: query + name: include_rules + required: false + schema: + default: false + type: boolean + - description: If true, a list of pull requests from the branch would be included + in the response. + in: query + name: include_pullreqs + required: false + schema: + default: false + type: boolean + - description: If greater than zero, branch divergence from the default branch + will be included in the response. The divergence would be calculated up + the this many commits. + in: query + name: max_divergence + required: false + schema: + default: 0 + type: integer - in: path name: repo_ref required: true @@ -1669,7 +1735,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/TypesBranch' + $ref: '#/components/schemas/TypesBranchExtended' description: OK '401': content: @@ -2237,7 +2303,7 @@ paths: application/json: schema: items: - $ref: '#/components/schemas/RepoCommitDivergence' + $ref: '#/components/schemas/TypesCommitDivergence' type: array description: OK '401': @@ -4342,10 +4408,10 @@ paths: schema: minimum: 0 type: integer - - description: By providing this parameter the description would be included - in the response. + - description: By providing this parameter the description would be excluded + from the response. in: query - name: include_description + name: exclude_description required: false schema: default: false @@ -6111,6 +6177,70 @@ paths: description: Internal Server Error tags: - pullreq + /repos/{repo_ref}/pullreq/{target_branch}...{source_branch}: + get: + operationId: getPullReqByBranches + parameters: + - description: Source repository ref of the pull requests. + in: query + name: source_repo_ref + required: false + schema: + type: string + - in: path + name: repo_ref + required: true + schema: + type: string + - in: path + name: source_branch + required: true + schema: + type: string + - in: path + name: target_branch + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesPullReq' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - pullreq /repos/{repo_ref}/purge: post: operationId: purgeRepository @@ -6223,6 +6353,8 @@ paths: properties: base_branch: type: string + base_commit_sha: + $ref: '#/components/schemas/ShaSHA' bypass_rules: type: boolean dry_run: @@ -6892,6 +7024,84 @@ paths: description: Internal Server Error tags: - repository + /repos/{repo_ref}/squash: + post: + operationId: squashBranch + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + base_branch: + type: string + base_commit_sha: + $ref: '#/components/schemas/ShaSHA' + bypass_rules: + type: boolean + dry_run: + type: boolean + dry_run_rules: + type: boolean + head_branch: + type: string + head_commit_sha: + $ref: '#/components/schemas/ShaSHA' + message: + type: string + title: + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesSquashResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesMergeViolations' + description: Unprocessable Entity + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - repository /repos/{repo_ref}/summary: get: operationId: summary @@ -7254,7 +7464,7 @@ paths: - upload /repos/{repo_ref}/webhooks: get: - operationId: listWebhooks + operationId: listRepoWebhooks parameters: - description: The substring which is used to filter the webhooks by their identifier. in: query @@ -7343,7 +7553,7 @@ paths: tags: - webhook post: - operationId: createWebhook + operationId: createRepoWebhook parameters: - in: path name: repo_ref @@ -7354,7 +7564,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/OpenapiCreateWebhookRequest' + $ref: '#/components/schemas/OpenapiCreateRepoWebhookRequest' responses: '201': content: @@ -7390,7 +7600,7 @@ paths: - webhook /repos/{repo_ref}/webhooks/{webhook_identifier}: delete: - operationId: deleteWebhook + operationId: deleteRepoWebhook parameters: - in: path name: repo_ref @@ -7432,7 +7642,7 @@ paths: tags: - webhook get: - operationId: getWebhook + operationId: getRepoWebhook parameters: - in: path name: repo_ref @@ -7478,7 +7688,7 @@ paths: tags: - webhook patch: - operationId: updateWebhook + operationId: updateRepoWebhook parameters: - in: path name: repo_ref @@ -7494,7 +7704,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/OpenapiUpdateWebhookRequest' + $ref: '#/components/schemas/OpenapiUpdateRepoWebhookRequest' responses: '200': content: @@ -7530,7 +7740,7 @@ paths: - webhook /repos/{repo_ref}/webhooks/{webhook_identifier}/executions: get: - operationId: listWebhookExecutions + operationId: listRepoWebhookExecutions parameters: - description: The page to return. in: query @@ -7596,7 +7806,7 @@ paths: - webhook /repos/{repo_ref}/webhooks/{webhook_identifier}/executions/{webhook_execution_id}: get: - operationId: getWebhookExecution + operationId: getRepoWebhookExecution parameters: - description: The page to return. in: query @@ -7663,6 +7873,58 @@ paths: description: Internal Server Error tags: - webhook + /repos/{repo_ref}/webhooks/{webhook_identifier}/executions/{webhook_execution_id}/retrigger: + post: + operationId: retriggerRepoWebhookExecution + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + - in: path + name: webhook_identifier + required: true + schema: + type: integer + - in: path + name: webhook_execution_id + required: true + schema: + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesWebhookExecution' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - webhook /repos/import: post: operationId: importRepository @@ -8087,10 +8349,10 @@ paths: schema: minimum: 0 type: integer - - description: By providing this parameter the description would be included - in the response. + - description: By providing this parameter the description would be excluded + from the response. in: query - name: include_description + name: exclude_description required: false schema: default: false @@ -9494,7 +9756,7 @@ paths: application/json: schema: items: - $ref: '#/components/schemas/TypesRepository' + $ref: '#/components/schemas/RepoRepositoryOutput' type: array description: OK '401': @@ -9851,6 +10113,469 @@ paths: description: Internal Server Error tags: - space + /spaces/{space_ref}/webhooks: + get: + operationId: listSpaceWebhooks + parameters: + - description: The substring which is used to filter the webhooks by their identifier. + in: query + name: query + required: false + schema: + type: string + - description: The data by which the webhooks are sorted. + in: query + name: sort + required: false + schema: + default: identifier + enum: + - id + - uid + - display_name + - created + - updated + type: string + - description: The order of the output. + in: query + name: order + required: false + schema: + default: asc + enum: + - asc + - desc + type: string + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The maximum number of results to return. + in: query + name: limit + required: false + schema: + default: 30 + maximum: 100 + minimum: 1 + type: integer + - in: path + name: space_ref + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/OpenapiWebhookType' + type: array + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - webhook + post: + operationId: createSpaceWebhook + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiCreateSpaceWebhookRequest' + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiWebhookType' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - webhook + /spaces/{space_ref}/webhooks/{webhook_identifier}: + delete: + operationId: deleteWebhook + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: webhook_identifier + required: true + schema: + type: integer + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - webhook + get: + operationId: getSpaceWebhook + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: webhook_identifier + required: true + schema: + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiWebhookType' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - webhook + patch: + operationId: updateWebhook + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: webhook_identifier + required: true + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiUpdateSpaceWebhookRequest' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiWebhookType' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - webhook + /spaces/{space_ref}/webhooks/{webhook_identifier}/executions: + get: + operationId: listSpaceWebhookExecutions + parameters: + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The maximum number of results to return. + in: query + name: limit + required: false + schema: + default: 30 + maximum: 100 + minimum: 1 + type: integer + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: webhook_identifier + required: true + schema: + type: integer + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TypesWebhookExecution' + type: array + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - webhook + /spaces/{space_ref}/webhooks/{webhook_identifier}/executions/{webhook_execution_id}: + get: + operationId: getSpaceWebhookExecution + parameters: + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The maximum number of results to return. + in: query + name: limit + required: false + schema: + default: 30 + maximum: 100 + minimum: 1 + type: integer + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: webhook_identifier + required: true + schema: + type: integer + - in: path + name: webhook_execution_id + required: true + schema: + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesWebhookExecution' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - webhook + /spaces/{space_ref}/webhooks/{webhook_identifier}/executions/{webhook_execution_id}/retrigger: + post: + operationId: retriggerSpaceWebhookExecution + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: webhook_identifier + required: true + schema: + type: integer + - in: path + name: webhook_execution_id + required: true + schema: + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesWebhookExecution' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - webhook /spaces/import: post: operationId: importSpace @@ -10337,14 +11062,45 @@ paths: description: Internal Server Error tags: - user - /user/token: + /user/tokens: + get: + operationId: listTokens + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TypesToken' + type: array + description: OK + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - user post: operationId: createToken requestBody: content: application/json: schema: - $ref: '#/components/schemas/OpenapiCreateTokenRequest' + $ref: '#/components/schemas/UserCreateTokenInput' responses: '201': content: @@ -10352,6 +11108,56 @@ paths: schema: $ref: '#/components/schemas/TypesTokenResponse' description: Created + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - user + /user/tokens/{token_identifier}: + delete: + operationId: deleteToken + parameters: + - in: path + name: token_identifier + required: true + schema: + type: string + responses: + '204': + description: No Content + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found '500': content: application/json: @@ -10479,6 +11285,7 @@ components: - agent_gitspace_state_report_error - agent_gitspace_state_report_stopped - agent_gitspace_state_report_unknown + - gitspace_action_auto_stop type: string EnumGitspaceInstanceStateType: enum: @@ -10661,6 +11468,7 @@ components: - pullreq_closed - pullreq_comment_created - pullreq_created + - pullreq_label_assigned - pullreq_merged - pullreq_reopened - pullreq_updated @@ -10677,6 +11485,15 @@ components: type: string nullable: true type: array + previous: + $ref: '#/components/schemas/GitBlamePartPrevious' + type: object + GitBlamePartPrevious: + properties: + commit_sha: + $ref: '#/components/schemas/ShaSHA' + file_name: + type: string type: object GitCommit: properties: @@ -11095,6 +11912,31 @@ components: title: type: string type: object + OpenapiCreateRepoWebhookRequest: + properties: + description: + type: string + display_name: + type: string + enabled: + type: boolean + identifier: + type: string + insecure: + type: boolean + secret: + type: string + triggers: + items: + $ref: '#/components/schemas/EnumWebhookTrigger' + nullable: true + type: array + uid: + deprecated: true + type: string + url: + type: string + type: object OpenapiCreateRepositoryRequest: properties: default_branch: @@ -11147,6 +11989,31 @@ components: deprecated: true type: string type: object + OpenapiCreateSpaceWebhookRequest: + properties: + description: + type: string + display_name: + type: string + enabled: + type: boolean + identifier: + type: string + insecure: + type: boolean + secret: + type: string + triggers: + items: + $ref: '#/components/schemas/EnumWebhookTrigger' + nullable: true + type: array + uid: + deprecated: true + type: string + url: + type: string + type: object OpenapiCreateTagRequest: properties: bypass_rules: @@ -11172,16 +12039,6 @@ components: deprecated: true type: string type: object - OpenapiCreateTokenRequest: - properties: - identifier: - type: string - lifetime: - $ref: '#/components/schemas/TimeDuration' - uid: - deprecated: true - type: string - type: object OpenapiCreateTriggerRequest: properties: actions: @@ -11201,31 +12058,6 @@ components: deprecated: true type: string type: object - OpenapiCreateWebhookRequest: - properties: - description: - type: string - display_name: - type: string - enabled: - type: boolean - identifier: - type: string - insecure: - type: boolean - secret: - type: string - triggers: - items: - $ref: '#/components/schemas/EnumWebhookTrigger' - nullable: true - type: array - uid: - deprecated: true - type: string - url: - type: string - type: object OpenapiDirContent: properties: entries: @@ -11295,6 +12127,8 @@ components: type: boolean dry_run: type: boolean + dry_run_rules: + type: boolean message: type: string method: @@ -11501,6 +12335,39 @@ components: nullable: true type: string type: object + OpenapiUpdateRepoWebhookRequest: + properties: + description: + nullable: true + type: string + display_name: + nullable: true + type: string + enabled: + nullable: true + type: boolean + identifier: + nullable: true + type: string + insecure: + nullable: true + type: boolean + secret: + nullable: true + type: string + triggers: + items: + $ref: '#/components/schemas/EnumWebhookTrigger' + nullable: true + type: array + uid: + deprecated: true + nullable: true + type: string + url: + nullable: true + type: string + type: object OpenapiUpdateSecretRequest: properties: data: @@ -11528,6 +12395,39 @@ components: nullable: true type: string type: object + OpenapiUpdateSpaceWebhookRequest: + properties: + description: + nullable: true + type: string + display_name: + nullable: true + type: string + enabled: + nullable: true + type: boolean + identifier: + nullable: true + type: string + insecure: + nullable: true + type: boolean + secret: + nullable: true + type: string + triggers: + items: + $ref: '#/components/schemas/EnumWebhookTrigger' + nullable: true + type: array + uid: + deprecated: true + nullable: true + type: string + url: + nullable: true + type: string + type: object OpenapiUpdateTemplateRequest: properties: data: @@ -11568,39 +12468,6 @@ components: nullable: true type: string type: object - OpenapiUpdateWebhookRequest: - properties: - description: - nullable: true - type: string - display_name: - nullable: true - type: string - enabled: - nullable: true - type: boolean - identifier: - nullable: true - type: string - insecure: - nullable: true - type: boolean - secret: - nullable: true - type: string - triggers: - items: - $ref: '#/components/schemas/EnumWebhookTrigger' - nullable: true - type: array - uid: - deprecated: true - nullable: true - type: string - url: - nullable: true - type: string - type: object OpenapiWebhookType: properties: created: @@ -11749,13 +12616,6 @@ components: comment_id: type: integer type: object - RepoCommitDivergence: - properties: - ahead: - type: integer - behind: - type: integer - type: object RepoCommitDivergenceRequest: properties: from: @@ -12003,9 +12863,16 @@ components: type: boolean ssh_enabled: type: boolean + ui: + $ref: '#/components/schemas/SystemUI' user_signup_allowed: type: boolean type: object + SystemUI: + properties: + show_plugin: + type: boolean + type: object TimeDuration: nullable: true type: integer @@ -12021,14 +12888,28 @@ components: token: $ref: '#/components/schemas/TypesSecretRef' type: object - TypesBranch: + TypesBranchExtended: properties: + check_summary: + $ref: '#/components/schemas/TypesCheckCountSummary' commit: $ref: '#/components/schemas/TypesCommit' + commit_divergence: + $ref: '#/components/schemas/TypesCommitDivergence' + is_default: + type: boolean name: type: string + pull_requests: + items: + $ref: '#/components/schemas/TypesPullReq' + type: array + rules: + items: + $ref: '#/components/schemas/TypesRuleInfo' + type: array sha: - type: string + $ref: '#/components/schemas/ShaSHA' type: object TypesChangeStats: properties: @@ -12065,6 +12946,19 @@ components: updated: type: integer type: object + TypesCheckCountSummary: + properties: + error: + type: integer + failure: + type: integer + pending: + type: integer + running: + type: integer + success: + type: integer + type: object TypesCheckPayload: properties: data: {} @@ -12138,6 +13032,13 @@ components: title: type: string type: object + TypesCommitDivergence: + properties: + ahead: + type: integer + behind: + type: integer + type: object TypesCommitFileStats: properties: changes: @@ -12228,7 +13129,7 @@ components: $ref: '#/components/schemas/TypesRuleViolations' type: array sha: - type: string + $ref: '#/components/schemas/ShaSHA' type: object TypesDeleteBranchOutput: properties: @@ -12331,6 +13232,15 @@ components: updated: type: integer type: object + TypesExecutionInfo: + properties: + number: + type: integer + pipeline_id: + type: integer + status: + $ref: '#/components/schemas/EnumCIStatus' + type: object TypesGithubConnectorData: properties: api_url: @@ -12419,6 +13329,9 @@ components: type: integer created: type: integer + has_git_changes: + nullable: true + type: boolean identifier: type: string last_heartbeat: @@ -12439,9 +13352,6 @@ components: $ref: '#/components/schemas/EnumGitspaceInstanceStateType' total_time_used: type: integer - tracked_changes: - nullable: true - type: string updated: type: integer url: @@ -12689,6 +13599,10 @@ components: type: array dry_run: type: boolean + dry_run_rules: + type: boolean + mergeable: + type: boolean minimum_required_approvals_count: type: integer minimum_required_approvals_count_latest: @@ -12750,6 +13664,10 @@ components: type: integer identifier: type: string + last_executions: + items: + $ref: '#/components/schemas/TypesExecutionInfo' + type: array repo_id: type: integer repo_uid: @@ -12848,6 +13766,12 @@ components: $ref: '#/components/schemas/TypesPrincipalInfo' number: type: integer + rebase_check_status: + $ref: '#/components/schemas/EnumMergeCheckStatus' + rebase_conflicts: + items: + type: string + type: array source_branch: type: string source_repo_id: @@ -13276,6 +14200,23 @@ components: updated: type: integer type: object + TypesSquashResponse: + properties: + conflict_files: + items: + type: string + type: array + dry_run: + type: boolean + dry_run_rules: + type: boolean + new_head_branch_sha: + $ref: '#/components/schemas/ShaSHA' + rule_violations: + items: + $ref: '#/components/schemas/TypesRuleViolations' + type: array + type: object TypesStage: properties: arch: @@ -13537,6 +14478,16 @@ components: usage: $ref: '#/components/schemas/EnumPublicKeyUsage' type: object + UserCreateTokenInput: + properties: + identifier: + type: string + lifetime: + $ref: '#/components/schemas/TimeDuration' + uid: + deprecated: true + type: string + type: object UserUpdateInput: properties: display_name: