feat: add project git init api (#16383)

This commit is contained in:
Shoubhit Dash
2026-03-07 01:09:50 +05:30
committed by GitHub
parent 95385eb652
commit d6e0f47361
6 changed files with 280 additions and 21 deletions

View File

@@ -77,6 +77,7 @@ import type {
PermissionRespondResponses,
PermissionRuleset,
ProjectCurrentResponses,
ProjectInitGitResponses,
ProjectListResponses,
ProjectUpdateErrors,
ProjectUpdateResponses,
@@ -425,6 +426,36 @@ export class Project extends HeyApiClient {
})
}
/**
* Initialize git repository
*
* Create a git repository for the current project and return the refreshed project info.
*/
public initGit<ThrowOnError extends boolean = false>(
parameters?: {
directory?: string
workspace?: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "query", key: "directory" },
{ in: "query", key: "workspace" },
],
},
],
)
return (options?.client ?? this.client).post<ProjectInitGitResponses, unknown, ThrowOnError>({
url: "/project/git/init",
...options,
...params,
})
}
/**
* Update project
*

View File

@@ -2087,6 +2087,25 @@ export type ProjectCurrentResponses = {
export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurrentResponses]
export type ProjectInitGitData = {
body?: never
path?: never
query?: {
directory?: string
workspace?: string
}
url: "/project/git/init"
}
export type ProjectInitGitResponses = {
/**
* Project information after git initialization
*/
200: Project
}
export type ProjectInitGitResponse = ProjectInitGitResponses[keyof ProjectInitGitResponses]
export type ProjectUpdateData = {
body?: {
name?: string