feat(gitea): add repository branches and tags support: new IGiteaBranch/IGiteaTag interfaces and getRepoBranches/getRepoTags client methods
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-03-02 - 1.3.0 - feat(gitea)
|
||||||
|
add repository branches and tags support: new IGiteaBranch/IGiteaTag interfaces and getRepoBranches/getRepoTags client methods
|
||||||
|
|
||||||
|
- Added IGiteaBranch and IGiteaTag interfaces (ts/gitea.interfaces.ts).
|
||||||
|
- Added getRepoBranches and getRepoTags methods with pagination support to Gitea client (ts/gitea.classes.giteaclient.ts).
|
||||||
|
- Exported the new interfaces from the package index (ts/index.ts).
|
||||||
|
|
||||||
## 2026-02-28 - 1.2.0 - feat(giteaclient)
|
## 2026-02-28 - 1.2.0 - feat(giteaclient)
|
||||||
add deleteRepo method to delete a repository via Gitea API
|
add deleteRepo method to delete a repository via Gitea API
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@apiclient.xyz/gitea',
|
name: '@apiclient.xyz/gitea',
|
||||||
version: '1.2.0',
|
version: '1.3.0',
|
||||||
description: 'A TypeScript client for the Gitea API, providing easy access to repositories, organizations, secrets, and action runs.'
|
description: 'A TypeScript client for the Gitea API, providing easy access to repositories, organizations, secrets, and action runs.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import type {
|
|||||||
IGiteaRepository,
|
IGiteaRepository,
|
||||||
IGiteaOrganization,
|
IGiteaOrganization,
|
||||||
IGiteaSecret,
|
IGiteaSecret,
|
||||||
|
IGiteaBranch,
|
||||||
|
IGiteaTag,
|
||||||
IGiteaActionRun,
|
IGiteaActionRun,
|
||||||
IGiteaActionRunJob,
|
IGiteaActionRunJob,
|
||||||
ITestConnectionResult,
|
ITestConnectionResult,
|
||||||
@@ -199,6 +201,28 @@ export class GiteaClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Repository Branches & Tags
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
public async getRepoBranches(ownerRepo: string, opts?: IListOptions): Promise<IGiteaBranch[]> {
|
||||||
|
const page = opts?.page || 1;
|
||||||
|
const limit = opts?.perPage || 50;
|
||||||
|
return this.request<IGiteaBranch[]>(
|
||||||
|
'GET',
|
||||||
|
`/api/v1/repos/${ownerRepo}/branches?page=${page}&limit=${limit}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getRepoTags(ownerRepo: string, opts?: IListOptions): Promise<IGiteaTag[]> {
|
||||||
|
const page = opts?.page || 1;
|
||||||
|
const limit = opts?.perPage || 50;
|
||||||
|
return this.request<IGiteaTag[]>(
|
||||||
|
'GET',
|
||||||
|
`/api/v1/repos/${ownerRepo}/tags?page=${page}&limit=${limit}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Repository Secrets
|
// Repository Secrets
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -58,6 +58,21 @@ export interface IGiteaActionRunJob {
|
|||||||
run_duration: number;
|
run_duration: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IGiteaBranch {
|
||||||
|
name: string;
|
||||||
|
commit: {
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IGiteaTag {
|
||||||
|
name: string;
|
||||||
|
id: string;
|
||||||
|
commit: {
|
||||||
|
sha: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export interface ITestConnectionResult {
|
export interface ITestConnectionResult {
|
||||||
ok: boolean;
|
ok: boolean;
|
||||||
error?: string;
|
error?: string;
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ export type {
|
|||||||
IGiteaRepository,
|
IGiteaRepository,
|
||||||
IGiteaOrganization,
|
IGiteaOrganization,
|
||||||
IGiteaSecret,
|
IGiteaSecret,
|
||||||
|
IGiteaBranch,
|
||||||
|
IGiteaTag,
|
||||||
IGiteaActionRun,
|
IGiteaActionRun,
|
||||||
IGiteaActionRunJob,
|
IGiteaActionRunJob,
|
||||||
ITestConnectionResult,
|
ITestConnectionResult,
|
||||||
|
|||||||
Reference in New Issue
Block a user