|
| 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; |
0 commit comments