From 63c3740e5816878abdd15f43105e66f74dada552 Mon Sep 17 00:00:00 2001 From: Johannes Batzill Date: Thu, 22 Dec 2022 21:58:38 -0800 Subject: [PATCH] [UI] Consume Latest OpenAPI Specs (#134) * regenerate CODE service code to match latest API specs * update readme --- README.md | 12 + .../CreatePullRequestModal.tsx | 16 +- web/src/pages/PullRequest/PullRequest.tsx | 6 +- .../PullRequestCommits/PullRequestCommits.tsx | 2 +- .../pages/PullRequest/PullRequestMetaLine.tsx | 22 +- web/src/pages/PullRequests/PullRequests.tsx | 14 +- web/src/services/code/index.tsx | 205 ++ web/src/services/code/swagger.yaml | 1747 ++++++++++------- web/src/utils/GitUtils.ts | 4 +- web/src/utils/types.ts | 28 - 10 files changed, 1294 insertions(+), 762 deletions(-) diff --git a/README.md b/README.md index e1b9726ab..eb81cc876 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,18 @@ This project includes a simple user interface for interacting with the system. W This project includes a swagger specification. When you run the application, you can access the swagger specification by navigating to `http://localhost:3000/swagger` in your browser. + +## Auto-Generate Gitness API Client used by UI using Swagger +Please make sure to update the autogenerated client code used by the UI when adding new rest APIs. + +To regenerate the code, please execute the following steps: +- Run local gitness instance with latest changes +- Get latest OpenAPI specs from `http://localhost:3000/openapi.yaml` and store it in `web/src/services/code/swagger.yaml` +> Simply copy the whole content of the web response and store it in the `swagger.yaml` file +- Regenerate client code by running `yarn services` in the `web` directory + +The latest API changes should now be reflected in `web/src/services/code/index.tsx` + # CLI This project includes simple command line tools for interacting with the system. Please remember that you must start the server before you can execute commands. diff --git a/web/src/components/CreatePullRequestModal/CreatePullRequestModal.tsx b/web/src/components/CreatePullRequestModal/CreatePullRequestModal.tsx index ddfdf4109..40dbf24f2 100644 --- a/web/src/components/CreatePullRequestModal/CreatePullRequestModal.tsx +++ b/web/src/components/CreatePullRequestModal/CreatePullRequestModal.tsx @@ -29,8 +29,8 @@ import { useModalHook } from '@harness/use-modal' import { useStrings } from 'framework/strings' import { getErrorMessage } from 'utils/Utils' import { CodeIcon, GitInfoProps } from 'utils/GitUtils' -import type { PullRequestPayload, PullRequestResponse } from 'utils/types' import css from './CreatePullRequestModal.module.scss' +import type { OpenapiCreatePullReqRequest, TypesPullReq } from 'services/code' interface FormData { title: string @@ -40,7 +40,7 @@ interface FormData { interface CreatePullRequestModalProps extends Pick { targetGitRef: string sourceGitRef: string - onSuccess: (data: PullRequestResponse) => void + onSuccess: (data: TypesPullReq) => void } interface CreatePullRequestModalButtonProps extends Omit, CreatePullRequestModalProps {} @@ -54,18 +54,18 @@ export function useCreatePullRequestModal({ const ModalComponent: React.FC = () => { const { getString } = useStrings() const { showError } = useToaster() - const { mutate: createPullRequest, loading } = useMutate({ + const { mutate: createPullRequest, loading } = useMutate({ verb: 'POST', path: `/api/v1/repos/${repoMetadata.path}/+/pullreq` }) const handleSubmit = (formData: FormData) => { const title = get(formData, 'title', '').trim() const description = get(formData, 'description', '').trim() - const payload: PullRequestPayload = { - targetBranch: targetGitRef, - sourceBranch: sourceGitRef, - title, - description + const payload: OpenapiCreatePullReqRequest = { + target_branch: targetGitRef, + source_branch: sourceGitRef, + title: title, + description: description } try { diff --git a/web/src/pages/PullRequest/PullRequest.tsx b/web/src/pages/PullRequest/PullRequest.tsx index 2e3886744..1f900fc56 100644 --- a/web/src/pages/PullRequest/PullRequest.tsx +++ b/web/src/pages/PullRequest/PullRequest.tsx @@ -7,13 +7,13 @@ import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata' import { useStrings } from 'framework/strings' import { RepositoryPageHeader } from 'components/RepositoryPageHeader/RepositoryPageHeader' import { getErrorMessage } from 'utils/Utils' -import type { PullRequestResponse } from 'utils/types' import { CodeIcon } from 'utils/GitUtils' import { PullRequestMetaLine } from './PullRequestMetaLine' import { PullRequestConversation } from './PullRequestConversation/PullRequestConversation' import { FilesChanged } from './FilesChanged/FilesChanged' import { PullRequestCommits } from './PullRequestCommits/PullRequestCommits' import css from './PullRequest.module.scss' +import type { TypesPullReq } from 'services/code' enum PullRequestSection { CONVERSATION = 'conversation', @@ -37,7 +37,7 @@ export default function PullRequest() { data: prData, error: prError, loading: prLoading - } = useGet({ + } = useGet({ path: `/api/v1/repos/${repoMetadata?.path}/+/pullreq/${pullRequestId}`, lazy: !repoMetadata }) @@ -110,7 +110,7 @@ export default function PullRequest() { ) } -const PullRequestTitle: React.FC = ({ title, number }) => ( +const PullRequestTitle: React.FC = ({ title, number }) => ( {title} #{number} diff --git a/web/src/pages/PullRequest/PullRequestCommits/PullRequestCommits.tsx b/web/src/pages/PullRequest/PullRequestCommits/PullRequestCommits.tsx index 42d598582..5ed61dfa5 100644 --- a/web/src/pages/PullRequest/PullRequestCommits/PullRequestCommits.tsx +++ b/web/src/pages/PullRequest/PullRequestCommits/PullRequestCommits.tsx @@ -17,7 +17,7 @@ export const PullRequestCommits: React.FC({ path: `/api/v1/repos/${repoMetadata?.path}/+/commits`, queryParams: { - git_ref: pullRequestMetadata.sourceBranch + git_ref: pullRequestMetadata.source_branch }, lazy: !repoMetadata }) diff --git a/web/src/pages/PullRequest/PullRequestMetaLine.tsx b/web/src/pages/PullRequest/PullRequestMetaLine.tsx index f47a4e7b8..b131674ee 100644 --- a/web/src/pages/PullRequest/PullRequestMetaLine.tsx +++ b/web/src/pages/PullRequest/PullRequestMetaLine.tsx @@ -7,14 +7,14 @@ import { useAppContext } from 'AppContext' import { useStrings } from 'framework/strings' import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator' import { GitRefLink } from 'components/GitRefLink/GitRefLink' -import type { PullRequestResponse } from 'utils/types' import css from './PullRequestMetaLine.module.scss' +import type { TypesPullReq } from 'services/code' -export const PullRequestMetaLine: React.FC> = ({ +export const PullRequestMetaLine: React.FC> = ({ repoMetadata, - targetBranch, - sourceBranch, - createdBy = '', + target_branch, + source_branch, + author, updated, merged, state @@ -22,18 +22,18 @@ export const PullRequestMetaLine: React.FC{createdBy}, + user: {author?.name}, number: 5, // TODO: No data from backend now target: ( ), source: ( ) } @@ -47,7 +47,7 @@ export const PullRequestMetaLine: React.FC - + diff --git a/web/src/pages/PullRequests/PullRequests.tsx b/web/src/pages/PullRequests/PullRequests.tsx index 2f801d98c..979792162 100644 --- a/web/src/pages/PullRequests/PullRequests.tsx +++ b/web/src/pages/PullRequests/PullRequests.tsx @@ -21,11 +21,11 @@ import { useStrings } from 'framework/strings' import { RepositoryPageHeader } from 'components/RepositoryPageHeader/RepositoryPageHeader' import { getErrorMessage, LIST_FETCHING_PER_PAGE } from 'utils/Utils' import emptyStateImage from 'images/empty-state.svg' -import type { PullRequestResponse } from 'utils/types' import { usePageIndex } from 'hooks/usePageIndex' import { PullRequestsContentHeader } from './PullRequestsContentHeader/PullRequestsContentHeader' import prOpenImg from './pull-request-open.svg' import css from './PullRequests.module.scss' +import type { TypesPullReq } from 'services/code' export default function PullRequests() { const { getString } = useStrings() @@ -38,7 +38,7 @@ export default function PullRequests() { data, error: prError, loading: prLoading - } = useGet({ + } = useGet({ path: `/api/v1/repos/${repoMetadata?.path}/+/pullreq`, queryParams: { per_page: LIST_FETCHING_PER_PAGE, @@ -50,12 +50,12 @@ export default function PullRequests() { }, lazy: !repoMetadata }) - const columns: Column[] = useMemo( + const columns: Column[] = useMemo( () => [ { id: 'title', width: '100%', - Cell: ({ row }: CellProps) => { + Cell: ({ row }: CellProps) => { return ( @@ -69,8 +69,8 @@ export default function PullRequests() { str={getString('pr.openBy')} vars={{ number: {row.original.number}, - time: , - user: row.original.createdBy + time: , + user: row.original.author?.name }} /> @@ -131,7 +131,7 @@ export default function PullRequests() { /> {!!data?.length && ( - + className={css.table} hideHeaders columns={columns} diff --git a/web/src/services/code/index.tsx b/web/src/services/code/index.tsx index 3945c7223..ace94ea71 100644 --- a/web/src/services/code/index.tsx +++ b/web/src/services/code/index.tsx @@ -11,6 +11,8 @@ export type EnumParentResourceType = string export type EnumPathTargetType = string +export type EnumPullReqState = string + export type EnumTokenType = string export interface FormDataOpenapiLoginRequest { @@ -59,6 +61,14 @@ export interface OpenapiCreatePathRequest { path?: string } +export interface OpenapiCreatePullReqRequest { + description?: string + source_branch?: string + source_repo_ref?: string + target_branch?: string + title?: string +} + export interface OpenapiCreateRepoPathRequest { path?: string } @@ -112,6 +122,11 @@ export interface OpenapiMoveSpaceRequest { uid?: string | null } +export interface OpenapiUpdatePullReqRequest { + description?: string + title?: string +} + export interface OpenapiUpdateRepoRequest { description?: string | null isPublic?: boolean | null @@ -220,6 +235,33 @@ export interface TypesPath { value?: string } +export type TypesPrincipalInfo = { + email?: string + id?: number + name?: string + uid?: string +} | null + +export interface TypesPullReq { + author?: TypesPrincipalInfo + created?: number + description?: string + edited?: number + id?: number + merge_strategy?: string | null + merged?: number | null + merger?: TypesPrincipalInfo + number?: number + source_branch?: string + source_repo_id?: number + state?: EnumPullReqState + target_branch?: string + target_repo_id?: number + title?: string + updated?: number + version?: number +} + export interface TypesRepository { created?: number createdBy?: number @@ -911,6 +953,169 @@ export const useDeleteRepositoryPath = ({ repoRef, ...props }: UseDeleteReposito { base: getConfigNew('code'), pathParams: { repoRef }, ...props } ) +export interface ListPullReqQueryParams { + /** + * The state of the pull requests to include in the result. + */ + state?: ('open' | 'closed' | 'merged' | 'rejected')[] + /** + * Source repository ref of the pull requests. + */ + source_repo_ref?: string + /** + * Source branch of the pull requests. + */ + source_branch?: string + /** + * Target branch of the pull requests. + */ + target_branch?: string + /** + * The substring by which the pull requests are filtered. + */ + query?: string + /** + * The principal ID who created pull requests. + */ + created_by?: number + /** + * The order of the output. + */ + direction?: 'asc' | 'desc' + /** + * The data by which the pull requests are sorted. + */ + sort?: 'number' | 'created' | 'updated' + /** + * The page to return. + */ + page?: number + /** + * The number of entries returned per page. + */ + per_page?: number +} + +export interface ListPullReqPathParams { + repoRef: string +} + +export type ListPullReqProps = Omit< + GetProps, + 'path' +> & + ListPullReqPathParams + +export const ListPullReq = ({ repoRef, ...props }: ListPullReqProps) => ( + + path={`/repos/${repoRef}/pullreq`} + base={getConfigNew('code')} + {...props} + /> +) + +export type UseListPullReqProps = Omit< + UseGetProps, + 'path' +> & + ListPullReqPathParams + +export const useListPullReq = ({ repoRef, ...props }: UseListPullReqProps) => + useGet( + (paramsInPath: ListPullReqPathParams) => `/repos/${paramsInPath.repoRef}/pullreq`, + { base: getConfigNew('code'), pathParams: { repoRef }, ...props } + ) + +export interface CreatePullReqPathParams { + repoRef: string +} + +export type CreatePullReqProps = Omit< + MutateProps, + 'path' | 'verb' +> & + CreatePullReqPathParams + +export const CreatePullReq = ({ repoRef, ...props }: CreatePullReqProps) => ( + + verb="POST" + path={`/repos/${repoRef}/pullreq`} + base={getConfigNew('code')} + {...props} + /> +) + +export type UseCreatePullReqProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + CreatePullReqPathParams + +export const useCreatePullReq = ({ repoRef, ...props }: UseCreatePullReqProps) => + useMutate( + 'POST', + (paramsInPath: CreatePullReqPathParams) => `/repos/${paramsInPath.repoRef}/pullreq`, + { base: getConfigNew('code'), pathParams: { repoRef }, ...props } + ) + +export interface GetPullReqPathParams { + repoRef: string + pullreq_number: number +} + +export type GetPullReqProps = Omit, 'path'> & + GetPullReqPathParams + +export const GetPullReq = ({ repoRef, pullreq_number, ...props }: GetPullReqProps) => ( + + path={`/repos/${repoRef}/pullreq/${pullreq_number}`} + base={getConfigNew('code')} + {...props} + /> +) + +export type UseGetPullReqProps = Omit, 'path'> & + GetPullReqPathParams + +export const useGetPullReq = ({ repoRef, pullreq_number, ...props }: UseGetPullReqProps) => + useGet( + (paramsInPath: GetPullReqPathParams) => `/repos/${paramsInPath.repoRef}/pullreq/${paramsInPath.pullreq_number}`, + { base: getConfigNew('code'), pathParams: { repoRef, pullreq_number }, ...props } + ) + +export interface UpdatePullReqPathParams { + repoRef: string + pullreq_number: number +} + +export type UpdatePullReqProps = Omit< + MutateProps, + 'path' | 'verb' +> & + UpdatePullReqPathParams + +export const UpdatePullReq = ({ repoRef, pullreq_number, ...props }: UpdatePullReqProps) => ( + + verb="PUT" + path={`/repos/${repoRef}/pullreq/${pullreq_number}`} + base={getConfigNew('code')} + {...props} + /> +) + +export type UseUpdatePullReqProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + UpdatePullReqPathParams + +export const useUpdatePullReq = ({ repoRef, pullreq_number, ...props }: UseUpdatePullReqProps) => + useMutate( + 'PUT', + (paramsInPath: UpdatePullReqPathParams) => `/repos/${paramsInPath.repoRef}/pullreq/${paramsInPath.pullreq_number}`, + { base: getConfigNew('code'), pathParams: { repoRef, pullreq_number }, ...props } + ) + export interface ListRepositoryServiceAccountsPathParams { repoRef: string } diff --git a/web/src/services/code/swagger.yaml b/web/src/services/code/swagger.yaml index 5747e4467..c8c8dd294 100644 --- a/web/src/services/code/swagger.yaml +++ b/web/src/services/code/swagger.yaml @@ -3,28 +3,28 @@ info: title: API Specification version: 1.0.0 servers: - - url: /api/v1/ +- url: /api/v1/ security: - - bearerAuth: [] +- bearerAuth: [] paths: /api/user/currentUser: get: operationId: getCurrentUser responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/OpenapiCurrentUserResponse' description: OK - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - user + - user /login: post: operationId: onLogin @@ -34,32 +34,32 @@ paths: schema: $ref: '#/components/schemas/FormDataOpenapiLoginRequest' responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesTokenResponse' description: OK - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - account + - account /register: post: operationId: onRegister @@ -69,268 +69,268 @@ paths: schema: $ref: '#/components/schemas/FormDataOpenapiRegisterRequest' responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesTokenResponse' description: OK - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - account + - account /repos: post: operationId: createRepository parameters: - - description: path of parent space (Not needed in standalone). - in: query - name: spacePath - required: false - schema: - default: false - type: string + - description: path of parent space (Not needed in standalone). + in: query + name: spacePath + required: false + schema: + default: false + type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/OpenapiCreateRepositoryRequest' responses: - '201': + "201": content: application/json: schema: $ref: '#/components/schemas/TypesRepository' description: Created - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository /repos/{repoRef}: delete: operationId: deleteRepository parameters: - - in: path - name: repoRef - required: true - schema: - type: string + - in: path + name: repoRef + required: true + schema: + type: string responses: - '204': + "204": description: No Content - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository get: operationId: findRepository parameters: - - in: path - name: repoRef - required: true - schema: - type: string + - in: path + name: repoRef + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesRepository' description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository patch: operationId: updateRepository parameters: - - in: path - name: repoRef - required: true - schema: - type: string + - in: path + name: repoRef + required: true + schema: + type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/OpenapiUpdateRepoRequest' responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesRepository' description: OK - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository /repos/{repoRef}/branches: 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 - required: false - schema: - type: string - - description: The order of the output. - in: query - name: direction - required: false - schema: - default: asc - enum: - - asc - - desc - type: string - - description: The data by which the branches are sorted. - in: query - name: sort - required: false - schema: - default: name - enum: - - name - - date - type: string - - description: The page to return. - in: query - name: page - required: false - schema: - default: 1 - minimum: 1 - type: integer - - description: The number of entries returned per page. - in: query - name: per_page - required: false - schema: - default: 50 - maximum: 100 - minimum: 1 - type: integer - - in: path - name: repoRef - required: true - schema: - type: string + - 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 + required: false + schema: + type: string + - description: The order of the output. + in: query + name: direction + required: false + schema: + default: asc + enum: + - asc + - desc + type: string + - description: The data by which the branches are sorted. + in: query + name: sort + required: false + schema: + default: name + enum: + - name + - date + type: string + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The number of entries returned per page. + in: query + name: per_page + required: false + schema: + default: 50 + maximum: 100 + minimum: 1 + type: integer + - in: path + name: repoRef + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: @@ -338,158 +338,158 @@ paths: $ref: '#/components/schemas/RepoBranch' type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository post: operationId: createBranch parameters: - - in: path - name: repoRef - required: true - schema: - type: string + - in: path + name: repoRef + required: true + schema: + type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/OpenapiCreateBranchRequest' responses: - '201': + "201": content: application/json: schema: $ref: '#/components/schemas/RepoBranch' description: Created - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository /repos/{repoRef}/branches/{branchName}: delete: operationId: deleteBranch parameters: - - in: path - name: repoRef - required: true - schema: - type: string - - in: path - name: branchName - required: true - schema: - type: string + - in: path + name: repoRef + required: true + schema: + type: string + - in: path + name: branchName + required: true + schema: + type: string responses: - '204': + "204": description: No Content - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository /repos/{repoRef}/commits: get: operationId: listCommits parameters: - - description: The git reference (branch / tag / commitID) that will be used - to retrieve the data. If no value is provided the default branch of the - repository is used. - in: query - name: git_ref - required: false - schema: - default: '{Repository Default Branch}' - type: string - - description: The page to return. - in: query - name: page - required: false - schema: - default: 1 - minimum: 1 - type: integer - - description: The number of entries returned per page. - in: query - name: per_page - required: false - schema: - default: 50 - maximum: 100 - minimum: 1 - type: integer - - in: path - name: repoRef - required: true - schema: - type: string + - description: The git reference (branch / tag / commitID) that will be used + to retrieve the data. If no value is provided the default branch of the + repository is used. + in: query + name: git_ref + required: false + schema: + default: '{Repository Default Branch}' + type: string + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The number of entries returned per page. + in: query + name: per_page + required: false + schema: + default: 50 + maximum: 100 + minimum: 1 + type: integer + - in: path + name: repoRef + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: @@ -497,100 +497,100 @@ paths: $ref: '#/components/schemas/RepoCommit' type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository post: operationId: commitFiles parameters: - - in: path - name: repoRef - required: true - schema: - type: string + - in: path + name: repoRef + required: true + schema: + type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/OpenapiCommitFilesRequest' responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/RepoCommitFilesResponse' description: OK - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository /repos/{repoRef}/commits/calculate_divergence: post: operationId: calculateCommitDivergence parameters: - - in: path - name: repoRef - required: true - schema: - type: string + - in: path + name: repoRef + required: true + schema: + type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/OpenapiCalculateCommitDivergenceRequest' responses: - '200': + "200": content: application/json: schema: @@ -598,171 +598,171 @@ paths: $ref: '#/components/schemas/RepoCommitDivergence' type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository /repos/{repoRef}/content/{path}: get: operationId: getContent parameters: - - description: The git reference (branch / tag / commitID) that will be used - to retrieve the data. If no value is provided the default branch of the - repository is used. - in: query - name: git_ref - required: false - schema: - default: '{Repository Default Branch}' - type: string - - description: Indicates whether optional commit information should be included - in the response. - in: query - name: include_commit - required: false - schema: - default: false - type: boolean - - in: path - name: repoRef - required: true - schema: - type: string - - in: path - name: path - required: true - schema: - type: string + - description: The git reference (branch / tag / commitID) that will be used + to retrieve the data. If no value is provided the default branch of the + repository is used. + in: query + name: git_ref + required: false + schema: + default: '{Repository Default Branch}' + type: string + - description: Indicates whether optional commit information should be included + in the response. + in: query + name: include_commit + required: false + schema: + default: false + type: boolean + - in: path + name: repoRef + required: true + schema: + type: string + - in: path + name: path + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/OpenapiGetContentOutput' description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository /repos/{repoRef}/move: post: operationId: moveRepository parameters: - - in: path - name: repoRef - required: true - schema: - type: string + - in: path + name: repoRef + required: true + schema: + type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/OpenapiMoveRepoRequest' responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesRepository' description: OK - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository /repos/{repoRef}/paths: get: operationId: listRepositoryPaths parameters: - - description: The page to return. - in: query - name: page - required: false - schema: - default: 1 - minimum: 1 - type: integer - - description: The number of entries returned per page. - in: query - name: per_page - required: false - schema: - default: 50 - maximum: 100 - minimum: 1 - type: integer - - in: path - name: repoRef - required: true - schema: - type: string + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The number of entries returned per page. + in: query + name: per_page + required: false + schema: + default: 50 + maximum: 100 + minimum: 1 + type: integer + - in: path + name: repoRef + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: @@ -770,132 +770,402 @@ paths: $ref: '#/components/schemas/TypesPath' type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository post: operationId: createRepositoryPath parameters: - - in: path - name: repoRef - required: true - schema: - type: string + - in: path + name: repoRef + required: true + schema: + type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/OpenapiCreateRepoPathRequest' responses: - '201': + "201": content: application/json: schema: $ref: '#/components/schemas/TypesPath' description: Created - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository /repos/{repoRef}/paths/{pathID}: delete: operationId: deleteRepositoryPath parameters: - - in: path - name: repoRef - required: true - schema: - type: string - - in: path - name: pathID - required: true - schema: - type: string + - in: path + name: repoRef + required: true + schema: + type: string + - in: path + name: pathID + required: true + schema: + type: string responses: - '204': + "204": description: No Content - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository + /repos/{repoRef}/pullreq: + get: + operationId: listPullReq + parameters: + - description: The state of the pull requests to include in the result. + in: query + name: state + required: false + schema: + items: + default: open + enum: + - open + - closed + - merged + - rejected + type: string + type: array + - description: Source repository ref of the pull requests. + in: query + name: source_repo_ref + required: false + schema: + type: string + - description: Source branch of the pull requests. + in: query + name: source_branch + required: false + schema: + type: string + - description: Target branch of the pull requests. + in: query + name: target_branch + required: false + schema: + type: string + - description: The substring by which the pull requests are filtered. + in: query + name: query + required: false + schema: + type: string + - description: The principal ID who created pull requests. + in: query + name: created_by + required: false + schema: + type: integer + - description: The order of the output. + in: query + name: direction + required: false + schema: + default: asc + enum: + - asc + - desc + type: string + - description: The data by which the pull requests are sorted. + in: query + name: sort + required: false + schema: + default: number + enum: + - number + - created + - updated + type: string + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The number of entries returned per page. + in: query + name: per_page + required: false + schema: + default: 50 + maximum: 100 + minimum: 1 + type: integer + - in: path + name: repoRef + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TypesPullReq' + 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: + - pullreq + post: + operationId: createPullReq + parameters: + - in: path + name: repoRef + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiCreatePullReqRequest' + responses: + "201": + content: + application/json: + schema: + $ref: '#/components/schemas/TypesPullReq' + 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: + - pullreq + /repos/{repoRef}/pullreq/{pullreq_number}: + get: + operationId: getPullReq + parameters: + - in: path + name: repoRef + required: true + schema: + type: string + - in: path + name: pullreq_number + required: true + schema: + type: integer + 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 + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - pullreq + put: + operationId: updatePullReq + parameters: + - in: path + name: repoRef + required: true + schema: + type: string + - in: path + name: pullreq_number + required: true + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiUpdatePullReqRequest' + 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 + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - pullreq /repos/{repoRef}/service_accounts: get: operationId: listRepositoryServiceAccounts parameters: - - in: path - name: repoRef - required: true - schema: - type: string + - in: path + name: repoRef + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: @@ -903,94 +1173,94 @@ paths: $ref: '#/components/schemas/TypesServiceAccount' type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository /repos/{repoRef}/tags: get: operationId: listTags 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 tags are filtered. - in: query - name: query - required: false - schema: - type: string - - description: The order of the output. - in: query - name: direction - required: false - schema: - default: asc - enum: - - asc - - desc - type: string - - description: The data by which the tags are sorted. - in: query - name: sort - required: false - schema: - default: name - enum: - - name - - date - type: string - - description: The page to return. - in: query - name: page - required: false - schema: - default: 1 - minimum: 1 - type: integer - - description: The number of entries returned per page. - in: query - name: per_page - required: false - schema: - default: 50 - maximum: 100 - minimum: 1 - type: integer - - in: path - name: repoRef - required: true - schema: - type: string + - 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 tags are filtered. + in: query + name: query + required: false + schema: + type: string + - description: The order of the output. + in: query + name: direction + required: false + schema: + default: asc + enum: + - asc + - desc + type: string + - description: The data by which the tags are sorted. + in: query + name: sort + required: false + schema: + default: name + enum: + - name + - date + type: string + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The number of entries returned per page. + in: query + name: per_page + required: false + schema: + default: 50 + maximum: 100 + minimum: 1 + type: integer + - in: path + name: repoRef + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: @@ -998,37 +1268,37 @@ paths: $ref: '#/components/schemas/RepoCommitTag' type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - repository + - repository /resources/gitignore: get: operationId: listGitignore responses: - '200': + "200": content: application/json: schema: @@ -1036,31 +1306,31 @@ paths: type: string type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - resource + - resource /resources/license: get: operationId: listLicenses responses: - '200': + "200": content: application/json: schema: @@ -1073,26 +1343,26 @@ paths: type: object type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - resource + - resource /spaces: post: operationId: createSpace @@ -1102,244 +1372,244 @@ paths: schema: $ref: '#/components/schemas/OpenapiCreateSpaceRequest' responses: - '201': + "201": content: application/json: schema: $ref: '#/components/schemas/TypesSpace' description: Created - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - space + - space /spaces/{spaceRef}: delete: operationId: deleteSpace parameters: - - in: path - name: spaceRef - required: true - schema: - type: string + - in: path + name: spaceRef + required: true + schema: + type: string responses: - '204': + "204": description: No Content - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - space + - space get: operationId: getSpace parameters: - - in: path - name: spaceRef - required: true - schema: - type: string + - in: path + name: spaceRef + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesSpace' description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - space + - space patch: operationId: updateSpace parameters: - - in: path - name: spaceRef - required: true - schema: - type: string + - in: path + name: spaceRef + required: true + schema: + type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/OpenapiUpdateSpaceRequest' responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesSpace' description: OK - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - space + - space /spaces/{spaceRef}/move: post: operationId: moveSpace parameters: - - in: path - name: spaceRef - required: true - schema: - type: string + - in: path + name: spaceRef + required: true + schema: + type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/OpenapiMoveSpaceRequest' responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesSpace' description: OK - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - space + - space /spaces/{spaceRef}/paths: get: operationId: listPaths parameters: - - description: The page to return. - in: query - name: page - required: false - schema: - default: 1 - minimum: 1 - type: integer - - description: The number of entries returned per page. - in: query - name: per_page - required: false - schema: - default: 50 - maximum: 100 - minimum: 1 - type: integer - - in: path - name: spaceRef - required: true - schema: - type: string + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The number of entries returned per page. + in: query + name: per_page + required: false + schema: + default: 50 + maximum: 100 + minimum: 1 + type: integer + - in: path + name: spaceRef + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: @@ -1347,178 +1617,178 @@ paths: $ref: '#/components/schemas/TypesPath' type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - space + - space post: operationId: createPath parameters: - - in: path - name: spaceRef - required: true - schema: - type: string + - in: path + name: spaceRef + required: true + schema: + type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/OpenapiCreatePathRequest' responses: - '201': + "201": content: application/json: schema: $ref: '#/components/schemas/TypesPath' description: Created - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - space + - space /spaces/{spaceRef}/paths/{pathID}: delete: operationId: deletePath parameters: - - in: path - name: spaceRef - required: true - schema: - type: string - - in: path - name: pathID - required: true - schema: - type: string + - in: path + name: spaceRef + required: true + schema: + type: string + - in: path + name: pathID + required: true + schema: + type: string responses: - '204': + "204": description: No Content - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - space + - space /spaces/{spaceRef}/repos: get: operationId: listRepos parameters: - - description: The substring which is used to filter the repositories by their - path name. - in: query - name: query - required: false - schema: - type: string - - description: The data by which the repositories are sorted. - in: query - name: sort - required: false - schema: - default: uid - enum: - - uid - - path - - created - - updated - type: string - - description: The order of the output. - in: query - name: direction - 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 number of entries returned per page. - in: query - name: per_page - required: false - schema: - default: 50 - maximum: 100 - minimum: 1 - type: integer - - in: path - name: spaceRef - required: true - schema: - type: string + - description: The substring which is used to filter the repositories by their + path name. + in: query + name: query + required: false + schema: + type: string + - description: The data by which the repositories are sorted. + in: query + name: sort + required: false + schema: + default: uid + enum: + - uid + - path + - created + - updated + type: string + - description: The order of the output. + in: query + name: direction + 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 number of entries returned per page. + in: query + name: per_page + required: false + schema: + default: 50 + maximum: 100 + minimum: 1 + type: integer + - in: path + name: spaceRef + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: @@ -1526,43 +1796,43 @@ paths: $ref: '#/components/schemas/TypesRepository' type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - space + - space /spaces/{spaceRef}/service_accounts: get: operationId: listServiceAccounts parameters: - - in: path - name: spaceRef - required: true - schema: - type: string + - in: path + name: spaceRef + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: @@ -1570,89 +1840,89 @@ paths: $ref: '#/components/schemas/TypesServiceAccount' type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - space + - space /spaces/{spaceRef}/spaces: get: operationId: listSpaces parameters: - - description: The substring which is used to filter the spaces by their path - name. - in: query - name: query - required: false - schema: - type: string - - description: The data by which the spaces are sorted. - in: query - name: sort - required: false - schema: - default: uid - enum: - - uid - - path - - created - - updated - type: string - - description: The order of the output. - in: query - name: direction - 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 number of entries returned per page. - in: query - name: per_page - required: false - schema: - default: 50 - maximum: 100 - minimum: 1 - type: integer - - in: path - name: spaceRef - required: true - schema: - type: string + - description: The substring which is used to filter the spaces by their path + name. + in: query + name: query + required: false + schema: + type: string + - description: The data by which the spaces are sorted. + in: query + name: sort + required: false + schema: + default: uid + enum: + - uid + - path + - created + - updated + type: string + - description: The order of the output. + in: query + name: direction + 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 number of entries returned per page. + in: query + name: per_page + required: false + schema: + default: 50 + maximum: 100 + minimum: 1 + type: integer + - in: path + name: spaceRef + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: @@ -1660,50 +1930,50 @@ paths: $ref: '#/components/schemas/TypesSpace' type: array description: OK - '401': + "401": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Unauthorized - '403': + "403": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Forbidden - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - space + - space /user: get: operationId: getUser responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesUser' description: OK - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - user + - user patch: operationId: updateUser requestBody: @@ -1712,20 +1982,20 @@ paths: schema: $ref: '#/components/schemas/UserUpdateInput' responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesUser' description: OK - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - user + - user /user/token: post: operationId: createToken @@ -1735,52 +2005,52 @@ paths: schema: $ref: '#/components/schemas/TypesTokenResponse' responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesUser' description: OK - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - user + - user /users: get: operationId: listUsers parameters: - - in: query - name: sort - schema: - enum: - - id - - email - - created - - updated - type: string - - in: query - name: direction - schema: - enum: - - asc - - desc - type: string - - in: query - name: page - schema: - default: 1 - type: integer - - in: query - name: per_page - schema: - default: 100 - type: integer + - in: query + name: sort + schema: + enum: + - id + - email + - created + - updated + type: string + - in: query + name: direction + schema: + enum: + - asc + - desc + type: string + - in: query + name: page + schema: + default: 1 + type: integer + - in: query + name: per_page + schema: + default: 100 + type: integer responses: - '200': + "200": content: application/json: schema: @@ -1788,26 +2058,26 @@ paths: $ref: '#/components/schemas/TypesUser' type: array description: OK - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - users + - users post: operationId: createUser requestBody: @@ -1816,93 +2086,93 @@ paths: schema: $ref: '#/components/schemas/TypesUserInput' responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesUser' description: OK - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - users + - users /users/{email}: delete: operationId: deleteUser parameters: - - in: path - name: email - required: true - schema: - type: string + - in: path + name: email + required: true + schema: + type: string responses: - '204': + "204": description: No Content - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - users + - users get: operationId: getUserEmail parameters: - - in: path - name: email - required: true - schema: - type: string + - in: path + name: email + required: true + schema: + type: string responses: - '200': + "200": content: application/json: schema: $ref: '#/components/schemas/TypesUser' description: OK - '400': + "400": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Bad Request - '404': + "404": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Not Found - '500': + "500": content: application/json: schema: $ref: '#/components/schemas/UsererrorError' description: Internal Server Error tags: - - users + - users components: schemas: EnumAccessGrant: @@ -1911,6 +2181,8 @@ components: type: string EnumPathTargetType: type: string + EnumPullReqState: + type: string EnumTokenType: type: string FormDataOpenapiLoginRequest: @@ -1929,10 +2201,10 @@ components: type: object GitrpcFileAction: enum: - - CREATE - - UPDATE - - DELETE - - MOVE + - CREATE + - UPDATE + - DELETE + - MOVE type: string OpenapiCalculateCommitDivergenceRequest: properties: @@ -1962,10 +2234,10 @@ components: type: object OpenapiContent: oneOf: - - $ref: '#/components/schemas/RepoFileContent' - - $ref: '#/components/schemas/OpenapiDirContent' - - $ref: '#/components/schemas/RepoSymlinkContent' - - $ref: '#/components/schemas/RepoSubmoduleContent' + - $ref: '#/components/schemas/RepoFileContent' + - $ref: '#/components/schemas/OpenapiDirContent' + - $ref: '#/components/schemas/RepoSymlinkContent' + - $ref: '#/components/schemas/RepoSubmoduleContent' type: object OpenapiContentInfo: properties: @@ -1982,10 +2254,10 @@ components: type: object OpenapiContentType: enum: - - file - - dir - - symlink - - submodule + - file + - dir + - symlink + - submodule type: string OpenapiCreateBranchRequest: properties: @@ -2000,6 +2272,19 @@ components: path: type: string type: object + OpenapiCreatePullReqRequest: + properties: + description: + type: string + source_branch: + type: string + source_repo_ref: + type: string + target_branch: + type: string + title: + type: string + type: object OpenapiCreateRepoPathRequest: properties: path: @@ -2043,9 +2328,9 @@ components: $ref: '#/components/schemas/TypesUser' status: enum: - - SUCCESS - - FAILURE - - ERROR + - SUCCESS + - FAILURE + - ERROR type: string type: object OpenapiDirContent: @@ -2093,6 +2378,13 @@ components: nullable: true type: string type: object + OpenapiUpdatePullReqRequest: + properties: + description: + type: string + title: + type: string + type: object OpenapiUpdateRepoRequest: properties: description: @@ -2257,6 +2549,57 @@ components: value: type: string type: object + TypesPrincipalInfo: + nullable: true + properties: + email: + type: string + id: + type: integer + name: + type: string + uid: + type: string + type: object + TypesPullReq: + properties: + author: + $ref: '#/components/schemas/TypesPrincipalInfo' + created: + type: integer + description: + type: string + edited: + type: integer + id: + type: integer + merge_strategy: + nullable: true + type: string + merged: + nullable: true + type: integer + merger: + $ref: '#/components/schemas/TypesPrincipalInfo' + number: + type: integer + source_branch: + type: string + source_repo_id: + type: integer + state: + $ref: '#/components/schemas/EnumPullReqState' + target_branch: + type: string + target_repo_id: + type: integer + title: + type: string + updated: + type: integer + version: + type: integer + type: object TypesRepository: properties: created: diff --git a/web/src/utils/GitUtils.ts b/web/src/utils/GitUtils.ts index 3282b6076..0aad78d5a 100644 --- a/web/src/utils/GitUtils.ts +++ b/web/src/utils/GitUtils.ts @@ -8,9 +8,9 @@ import type { OpenapiDirContent, OpenapiGetContentOutput, RepoCommit, + TypesPullReq, TypesRepository } from 'services/code' -import type { PullRequestResponse } from './types' export interface GitInfoProps { repoMetadata: TypesRepository @@ -19,7 +19,7 @@ export interface GitInfoProps { resourceContent: OpenapiGetContentOutput commitRef: string commits: RepoCommit[] - pullRequestMetadata: PullRequestResponse + pullRequestMetadata: TypesPullReq } export enum GitContentType { diff --git a/web/src/utils/types.ts b/web/src/utils/types.ts index 63c570b00..869bbb024 100644 --- a/web/src/utils/types.ts +++ b/web/src/utils/types.ts @@ -1,33 +1,5 @@ import type { DiffFile } from 'diff2html/lib/types' -export interface PullRequestPayload { - // TODO: Use from service when it's ready - sourceBranch: string - targetBranch: string - sourceRepoRef?: string - title: string - description?: string -} - -export interface PullRequestResponse { - // TODO: Use from service when it's ready - id: number - createdBy: number - created: number - updated: number - number: number - state: string - title: string - description: string - sourceRepoID: number - sourceBranch: string - targetRepoID: number - targetBranch: string - mergedBy: Unknown - merged: Unknown - merge_strategy: Unknown -} - export interface DiffFileEntry extends DiffFile { containerId: string contentId: string