feat(giteaclient): add deleteRepo method to delete a repository via Gitea API

This commit is contained in:
2026-02-28 11:13:36 +00:00
parent a34b05c55c
commit 5423039f89
3 changed files with 18 additions and 1 deletions

View File

@@ -1,5 +1,11 @@
# Changelog
## 2026-02-28 - 1.2.0 - feat(giteaclient)
add deleteRepo method to delete a repository via Gitea API
- Implements deleteRepo(owner: string, repo: string): Promise<void>
- Uses DELETE /api/v1/repos/{owner}/{repo} and encodes owner and repo with encodeURIComponent
## 2026-02-28 - 1.1.0 - feat(orgs)
add organization and organization-repository APIs: getOrg, getOrgRepos, createOrg, createOrgRepo

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@apiclient.xyz/gitea',
version: '1.1.0',
version: '1.2.0',
description: 'A TypeScript client for the Gitea API, providing easy access to repositories, organizations, secrets, and action runs.'
}

View File

@@ -258,4 +258,15 @@ export class GiteaClient {
public async cancelAction(ownerRepo: string, runId: number): Promise<void> {
await this.request('POST', `/api/v1/repos/${ownerRepo}/actions/runs/${runId}/cancel`);
}
// ---------------------------------------------------------------------------
// Repository Deletion
// ---------------------------------------------------------------------------
public async deleteRepo(owner: string, repo: string): Promise<void> {
await this.request(
'DELETE',
`/api/v1/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`,
);
}
}