Skip to content

Commit 59f9286

Browse files
committed
feat: Adding support for Container Registry API #274
1 parent 25e1683 commit 59f9286

File tree

4 files changed

+66
-3
lines changed

4 files changed

+66
-3
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,20 @@ EpicDiscussions
9090
// Projects
9191
Branches
9292
Commits
93-
Deployments
93+
CommitDiscussions
94+
ContainerRegistry
9495
DeployKeys
96+
Deployments
9597
Environments
9698
Issues
99+
IssueAwardEmojis
97100
IssueNotes
98101
IssueDiscussions
99-
IssueAwardEmojis
100102
Jobs
101103
Labels
102104
MergeRequests
103105
MergeRequestAwardEmojis
106+
MergeRequestDiscussions
104107
MergeRequestNotes
105108
Pipelines
106109
PipelineSchedules
@@ -121,12 +124,13 @@ ProjectSnippetAwardEmojis
121124
ProtectedBranches
122125
ProtectedTags
123126
ProjectVariables
127+
Releases
128+
ReleaseLinks
124129
Repositories
125130
RepositoryFiles
126131
Runners
127132
Services
128133
Tags
129-
Todos
130134
Triggers
131135
132136
// Users

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const ProjectsBundle = bundler({
4242
Branches: APIServices.Branches,
4343
Commits: APIServices.Commits,
4444
CommitDiscussions: APIServices.CommitDiscussions,
45+
ContainerRegistry: APIServices.ContainerRegistry,
4546
DeployKeys: APIServices.DeployKeys,
4647
Deployments: APIServices.Deployments,
4748
Environments: APIServices.Environments,

src/services/ContainerRegistry.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { BaseService, RequestHelper } from '../infrastructure';
2+
3+
class ContainerRegistry extends BaseService {
4+
repositories(projectId: ProjectId, options?: PaginatedRequestOptions) {
5+
const pId = encodeURIComponent(projectId);
6+
7+
return RequestHelper.get(this, `projects/${pId}/registry/repositories`, options);
8+
}
9+
10+
tags(projectId: ProjectId, repositoryId: number, options?: PaginatedRequestOptions) {
11+
const [pId, rId] = [projectId, repositoryId].map(encodeURIComponent);
12+
13+
return RequestHelper.get(this, `projects/${pId}/registry/repositories/${rId}/tags`, options);
14+
}
15+
16+
removeRepository(projectId: ProjectId, repositoryId: number, options?: Sudo) {
17+
const [pId, rId] = [projectId, repositoryId].map(encodeURIComponent);
18+
19+
return RequestHelper.del(this, `projects/${pId}/registry/repositories/${rId}`, options);
20+
}
21+
22+
removeTag(projectId: ProjectId, repositoryId: number, tagName: string, options?: Sudo) {
23+
const [pId, rId, tId] = [projectId, repositoryId, tagName].map(encodeURIComponent);
24+
25+
return RequestHelper.del(
26+
this,
27+
`projects/${pId}/registry/repositories/${rId}/tags/${tId}`,
28+
options,
29+
);
30+
}
31+
32+
removeTags(
33+
projectId: ProjectId,
34+
repositoryId: number,
35+
tagNameRegex: string,
36+
options?: Sudo & { keepN: string; olderThan: string },
37+
) {
38+
const [pId, rId] = [projectId, repositoryId].map(encodeURIComponent);
39+
40+
return RequestHelper.del(this, `projects/${pId}/registry/repositories/${rId}/tags`, {
41+
tagNameRegex,
42+
...options,
43+
});
44+
}
45+
46+
showTag(projectId: ProjectId, repositoryId: number, tagName: string, options?: Sudo) {
47+
const [pId, rId, tId] = [projectId, repositoryId, tagName].map(encodeURIComponent);
48+
49+
return RequestHelper.get(
50+
this,
51+
`projects/${pId}/registry/repositories/${rId}/tags/${tId}`,
52+
options,
53+
);
54+
}
55+
}
56+
57+
export default ContainerRegistry;

src/services/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export { default as UserGPGKeys } from './UserGPGKeys';
2525
export { default as Branches } from './Branches';
2626
export { default as Commits } from './Commits';
2727
export { default as CommitDiscussions } from './CommitDiscussions';
28+
export { default as ContainerRegistry } from './ContainerRegistry';
2829
export { default as Deployments } from './Deployments';
2930
export { default as DeployKeys } from './DeployKeys';
3031
export { default as Environments } from './Environments';

0 commit comments

Comments
 (0)