/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiResponse_BlameResponse } from '../models/ApiResponse_BlameResponse';
import type { ApiResponse_Blob } from '../models/ApiResponse_Blob';
import type { ApiResponse_bool } from '../models/ApiResponse_bool';
import type { ApiResponse_Branch } from '../models/ApiResponse_Branch';
import type { ApiResponse_Commit } from '../models/ApiResponse_Commit';
import type { ApiResponse_CompareCommitsResponse } from '../models/ApiResponse_CompareCommitsResponse';
import type { ApiResponse_CreateCommitResponse } from '../models/ApiResponse_CreateCommitResponse';
import type { ApiResponse_DiffStats } from '../models/ApiResponse_DiffStats';
import type { ApiResponse_GetDiffResponse } from '../models/ApiResponse_GetDiffResponse';
import type { ApiResponse_ListBranchesResponse } from '../models/ApiResponse_ListBranchesResponse';
import type { ApiResponse_ListCommitsResponse } from '../models/ApiResponse_ListCommitsResponse';
import type { ApiResponse_ListMergeConflictsResponse } from '../models/ApiResponse_ListMergeConflictsResponse';
import type { ApiResponse_ListTagsResponse } from '../models/ApiResponse_ListTagsResponse';
import type { ApiResponse_ListTreeResponse } from '../models/ApiResponse_ListTreeResponse';
import type { ApiResponse_MergeResult } from '../models/ApiResponse_MergeResult';
import type { ApiResponse_RebaseResult } from '../models/ApiResponse_RebaseResult';
import type { ApiResponse_Repository } from '../models/ApiResponse_Repository';
import type { ApiResponse_RepositoryHealthResponse } from '../models/ApiResponse_RepositoryHealthResponse';
import type { ApiResponse_RepositoryMaintenanceResponse } from '../models/ApiResponse_RepositoryMaintenanceResponse';
import type { ApiResponse_RepositoryStatistics } from '../models/ApiResponse_RepositoryStatistics';
import type { ApiResponse_String } from '../models/ApiResponse_String';
import type { ApiResponse_Tag } from '../models/ApiResponse_Tag';
import type { CherryPickParams } from '../models/CherryPickParams';
import type { CreateBranchBody } from '../models/CreateBranchBody';
import type { CreateCommitParams } from '../models/CreateCommitParams';
import type { CreateTagBody } from '../models/CreateTagBody';
import type { MergeParams } from '../models/MergeParams';
import type { RebaseParams } from '../models/RebaseParams';
import type { RevertParams } from '../models/RevertParams';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class GitService {
	/**
	 * Blame a file
	 * @returns ApiResponse_BlameResponse Blame retrieved successfully
	 * @throws ApiError
	 */
	public static gitBlame({
		workspaceName,
		repoName,
		revision,
		path,
		pageSize,
	}: {
		workspaceName: string,
		repoName: string,
		revision: string,
		path: string,
		pageSize?: number | null,
	}): CancelablePromise<ApiResponse_BlameResponse> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/blame',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			query: {
				'revision': revision,
				'path': path,
				'page_size': pageSize,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Get blob content
	 * @returns ApiResponse_Blob Blob retrieved successfully
	 * @throws ApiError
	 */
	public static gitGetBlob({
		workspaceName,
		repoName,
		revision,
		path,
	}: {
		workspaceName: string,
		repoName: string,
		revision: string,
		path: string,
	}): CancelablePromise<ApiResponse_Blob> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/blobs',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			query: {
				'revision': revision,
				'path': path,
			},
			errors: {
				401: `Unauthorized`,
				404: `Blob not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * List branches
	 * @returns ApiResponse_ListBranchesResponse Branches listed successfully
	 * @throws ApiError
	 */
	public static gitListBranches({
		workspaceName,
		repoName,
		pattern,
		pageSize,
		pageToken,
	}: {
		workspaceName: string,
		repoName: string,
		pattern?: string | null,
		pageSize?: number | null,
		pageToken?: string | null,
	}): CancelablePromise<ApiResponse_ListBranchesResponse> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/branches',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			query: {
				'pattern': pattern,
				'page_size': pageSize,
				'page_token': pageToken,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Create a branch
	 * @returns ApiResponse_Branch Branch created successfully
	 * @throws ApiError
	 */
	public static gitCreateBranch({
		workspaceName,
		repoName,
		requestBody,
	}: {
		workspaceName: string,
		repoName: string,
		/**
		 * Branch creation parameters
		 */
		requestBody: CreateBranchBody,
	}): CancelablePromise<ApiResponse_Branch> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/branches',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Get a branch
	 * @returns ApiResponse_Branch Branch retrieved successfully
	 * @throws ApiError
	 */
	public static gitGetBranch({
		workspaceName,
		repoName,
		branchName,
	}: {
		workspaceName: string,
		repoName: string,
		branchName: string,
	}): CancelablePromise<ApiResponse_Branch> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/branches/{branch_name}',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
				'branch_name': branchName,
			},
			errors: {
				401: `Unauthorized`,
				404: `Branch not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Delete a branch
	 * @returns ApiResponse_String Branch deleted successfully
	 * @throws ApiError
	 */
	public static gitDeleteBranch({
		workspaceName,
		repoName,
		branchName,
	}: {
		workspaceName: string,
		repoName: string,
		branchName: string,
	}): CancelablePromise<ApiResponse_String> {
		return __request(OpenAPI, {
			method: 'DELETE',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/branches/{branch_name}',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
				'branch_name': branchName,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Cherry-pick a commit
	 * @returns ApiResponse_CreateCommitResponse Cherry-pick completed successfully
	 * @throws ApiError
	 */
	public static gitCherryPick({
		workspaceName,
		repoName,
		requestBody,
	}: {
		workspaceName: string,
		repoName: string,
		/**
		 * Cherry-pick parameters
		 */
		requestBody: CherryPickParams,
	}): CancelablePromise<ApiResponse_CreateCommitResponse> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/cherry-pick',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				401: `Unauthorized`,
				409: `Cherry-pick conflict`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * List commits
	 * @returns ApiResponse_ListCommitsResponse Commits listed successfully
	 * @throws ApiError
	 */
	public static gitListCommits({
		workspaceName,
		repoName,
		revision,
		path,
		pageSize,
	}: {
		workspaceName: string,
		repoName: string,
		revision: string,
		path?: string | null,
		pageSize?: number | null,
	}): CancelablePromise<ApiResponse_ListCommitsResponse> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/commits',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			query: {
				'revision': revision,
				'path': path,
				'page_size': pageSize,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Create a commit
	 * @returns ApiResponse_CreateCommitResponse Commit created successfully
	 * @throws ApiError
	 */
	public static gitCreateCommit({
		workspaceName,
		repoName,
		requestBody,
	}: {
		workspaceName: string,
		repoName: string,
		/**
		 * Commit creation parameters
		 */
		requestBody: CreateCommitParams,
	}): CancelablePromise<ApiResponse_CreateCommitResponse> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/commits',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Get a single commit
	 * @returns ApiResponse_Commit Commit retrieved successfully
	 * @throws ApiError
	 */
	public static gitGetCommit({
		workspaceName,
		repoName,
		revision,
	}: {
		workspaceName: string,
		repoName: string,
		revision: string,
	}): CancelablePromise<ApiResponse_Commit> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/commits/{revision}',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
				'revision': revision,
			},
			errors: {
				401: `Unauthorized`,
				404: `Commit not found`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Compare two commits
	 * @returns ApiResponse_CompareCommitsResponse Comparison completed successfully
	 * @throws ApiError
	 */
	public static gitCompare({
		workspaceName,
		repoName,
		base,
		head,
		pageSize,
	}: {
		workspaceName: string,
		repoName: string,
		base: string,
		head: string,
		pageSize?: number | null,
	}): CancelablePromise<ApiResponse_CompareCommitsResponse> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/compare',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			query: {
				'base': base,
				'head': head,
				'page_size': pageSize,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * List merge conflicts
	 * @returns ApiResponse_ListMergeConflictsResponse Conflicts listed successfully
	 * @throws ApiError
	 */
	public static gitListConflicts({
		workspaceName,
		repoName,
		target,
		source,
		pageSize,
	}: {
		workspaceName: string,
		repoName: string,
		target: string,
		source: string,
		pageSize?: number | null,
	}): CancelablePromise<ApiResponse_ListMergeConflictsResponse> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/conflicts',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			query: {
				'target': target,
				'source': source,
				'page_size': pageSize,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Get diff between two revisions
	 * @returns ApiResponse_GetDiffResponse Diff retrieved successfully
	 * @throws ApiError
	 */
	public static gitDiff({
		workspaceName,
		repoName,
		base,
		head,
		pageSize,
	}: {
		workspaceName: string,
		repoName: string,
		base: string,
		head: string,
		pageSize?: number | null,
	}): CancelablePromise<ApiResponse_GetDiffResponse> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/diff',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			query: {
				'base': base,
				'head': head,
				'page_size': pageSize,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Get diff statistics between two revisions
	 * @returns ApiResponse_DiffStats Diff stats retrieved successfully
	 * @throws ApiError
	 */
	public static gitDiffStats({
		workspaceName,
		repoName,
		base,
		head,
	}: {
		workspaceName: string,
		repoName: string,
		base: string,
		head: string,
	}): CancelablePromise<ApiResponse_DiffStats> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/diff-stats',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			query: {
				'base': base,
				'head': head,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Check if repository exists
	 * @returns ApiResponse_bool Repository existence check completed
	 * @throws ApiError
	 */
	public static gitRepoExists({
		workspaceName,
		repoName,
	}: {
		workspaceName: string,
		repoName: string,
	}): CancelablePromise<ApiResponse_bool> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/exists',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Run garbage collection
	 * @returns ApiResponse_RepositoryMaintenanceResponse Garbage collection completed
	 * @throws ApiError
	 */
	public static gitGarbageCollect({
		workspaceName,
		repoName,
	}: {
		workspaceName: string,
		repoName: string,
	}): CancelablePromise<ApiResponse_RepositoryMaintenanceResponse> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/garbage-collect',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Check repository health
	 * @returns ApiResponse_RepositoryHealthResponse Repository health check completed
	 * @throws ApiError
	 */
	public static gitRepoHealth({
		workspaceName,
		repoName,
	}: {
		workspaceName: string,
		repoName: string,
	}): CancelablePromise<ApiResponse_RepositoryHealthResponse> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/health',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Get repository info
	 * @returns ApiResponse_Repository Repository info retrieved successfully
	 * @throws ApiError
	 */
	public static gitRepoInfo({
		workspaceName,
		repoName,
	}: {
		workspaceName: string,
		repoName: string,
	}): CancelablePromise<ApiResponse_Repository> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/info',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Merge branches
	 * @returns ApiResponse_MergeResult Merge completed successfully
	 * @throws ApiError
	 */
	public static gitMerge({
		workspaceName,
		repoName,
		requestBody,
	}: {
		workspaceName: string,
		repoName: string,
		/**
		 * Merge parameters
		 */
		requestBody: MergeParams,
	}): CancelablePromise<ApiResponse_MergeResult> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/merge',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				401: `Unauthorized`,
				409: `Merge conflict`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Check if a merge is possible
	 * @returns ApiResponse_MergeResult Merge check completed successfully
	 * @throws ApiError
	 */
	public static gitMergeCheck({
		workspaceName,
		repoName,
		target,
		source,
	}: {
		workspaceName: string,
		repoName: string,
		target: string,
		source: string,
	}): CancelablePromise<ApiResponse_MergeResult> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/merge-check',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			query: {
				'target': target,
				'source': source,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Rebase a branch
	 * @returns ApiResponse_RebaseResult Rebase completed successfully
	 * @throws ApiError
	 */
	public static gitRebase({
		workspaceName,
		repoName,
		requestBody,
	}: {
		workspaceName: string,
		repoName: string,
		/**
		 * Rebase parameters
		 */
		requestBody: RebaseParams,
	}): CancelablePromise<ApiResponse_RebaseResult> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/rebase',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				401: `Unauthorized`,
				409: `Rebase conflict`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Revert a commit
	 * @returns ApiResponse_CreateCommitResponse Revert completed successfully
	 * @throws ApiError
	 */
	public static gitRevert({
		workspaceName,
		repoName,
		requestBody,
	}: {
		workspaceName: string,
		repoName: string,
		/**
		 * Revert parameters
		 */
		requestBody: RevertParams,
	}): CancelablePromise<ApiResponse_CreateCommitResponse> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/revert',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Get repository statistics
	 * @returns ApiResponse_RepositoryStatistics Repository statistics retrieved successfully
	 * @throws ApiError
	 */
	public static gitRepoStats({
		workspaceName,
		repoName,
	}: {
		workspaceName: string,
		repoName: string,
	}): CancelablePromise<ApiResponse_RepositoryStatistics> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/stats',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * List tags
	 * @returns ApiResponse_ListTagsResponse Tags listed successfully
	 * @throws ApiError
	 */
	public static gitListTags({
		workspaceName,
		repoName,
		pattern,
		pageSize,
	}: {
		workspaceName: string,
		repoName: string,
		pattern?: string | null,
		pageSize?: number | null,
	}): CancelablePromise<ApiResponse_ListTagsResponse> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/tags',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			query: {
				'pattern': pattern,
				'page_size': pageSize,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Create a tag
	 * @returns ApiResponse_Tag Tag created successfully
	 * @throws ApiError
	 */
	public static gitCreateTag({
		workspaceName,
		repoName,
		requestBody,
	}: {
		workspaceName: string,
		repoName: string,
		/**
		 * Tag creation parameters
		 */
		requestBody: CreateTagBody,
	}): CancelablePromise<ApiResponse_Tag> {
		return __request(OpenAPI, {
			method: 'POST',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/tags',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			body: requestBody,
			mediaType: 'application/json',
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * Delete a tag
	 * @returns ApiResponse_String Tag deleted successfully
	 * @throws ApiError
	 */
	public static gitDeleteTag({
		workspaceName,
		repoName,
		tagName,
	}: {
		workspaceName: string,
		repoName: string,
		tagName: string,
	}): CancelablePromise<ApiResponse_String> {
		return __request(OpenAPI, {
			method: 'DELETE',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/tags/{tag_name}',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
				'tag_name': tagName,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
	/**
	 * List tree contents
	 * @returns ApiResponse_ListTreeResponse Tree listed successfully
	 * @throws ApiError
	 */
	public static gitListTree({
		workspaceName,
		repoName,
		revision,
		path,
		recursive,
		pageSize,
	}: {
		workspaceName: string,
		repoName: string,
		revision: string,
		path?: string | null,
		recursive?: boolean | null,
		pageSize?: number | null,
	}): CancelablePromise<ApiResponse_ListTreeResponse> {
		return __request(OpenAPI, {
			method: 'GET',
			url: '/api/v1/workspaces/{workspace_name}/repos/{repo_name}/git/tree',
			path: {
				'workspace_name': workspaceName,
				'repo_name': repoName,
			},
			query: {
				'revision': revision,
				'path': path,
				'recursive': recursive,
				'page_size': pageSize,
			},
			errors: {
				401: `Unauthorized`,
				500: `Internal server error`,
			},
		});
	}
}
