Merge pull request #335 from jdalrymple/295-release-links

feat: Adding support for ReleaseLinks API
This commit is contained in:
Justin Dalrymple 2019-06-06 14:05:33 -04:00 committed by GitHub
commit 0107db4f2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 0 deletions

View File

@ -74,6 +74,7 @@ export const ProjectsBundle = bundler({
ProtectedBranches: APIServices.ProtectedBranches,
ProtectedTags: APIServices.ProtectedTags,
ProjectVariables: APIServices.ProjectVariables,
ReleaseLinks: APIServices.ReleaseLinks,
Repositories: APIServices.Repositories,
RepositoryFiles: APIServices.RepositoryFiles,
Runners: APIServices.Runners,

View File

@ -0,0 +1,44 @@
import { BaseService, RequestHelper } from '../infrastructure';
class ReleaseLinks extends BaseService {
all(projectId: ProjectId, tagName: string, options?: PaginatedRequestOptions) {
const [pId, tId] = [projectId, tagName].map(encodeURIComponent);
return RequestHelper.get(this, `projects/${pId}/releases/${tId}/assets/links`, options);
}
create(projectId: ProjectId, tagName: string, name: string, url: string, options?: Sudo) {
const [pId, tId] = [projectId, tagName].map(encodeURIComponent);
return RequestHelper.post(this, `projects/${pId}/releases/${tId}/assets/links`, {
name,
url,
...options,
});
}
edit(
projectId: ProjectId,
tagName: string,
linkId: number,
options: Sudo & ({ name: string } | { url: string }),
) {
const [pId, tId, lId] = [projectId, tagName, linkId].map(encodeURIComponent);
return RequestHelper.put(this, `projects/${pId}/releases/${tId}/assets/links/${lId}`, options);
}
remove(projectId: ProjectId, tagName: string, linkId: number, options?: Sudo) {
const [pId, tId, lId] = [projectId, tagName, linkId].map(encodeURIComponent);
return RequestHelper.del(this, `projects/${pId}/releases/${tId}/assets/links/${lId}`, options);
}
show(projectId: ProjectId, tagName: string, linkId: number, options?: Sudo) {
const [pId, tId, lId] = [projectId, tagName, linkId].map(encodeURIComponent);
return RequestHelper.get(this, `projects/${pId}/releases/${tId}/assets/links/${lId}`, options);
}
}
export default ReleaseLinks;

View File

@ -57,6 +57,7 @@ export { default as ProjectSnippetAwardEmojis } from './ProjectSnippetAwardEmoji
export { default as ProtectedBranches } from './ProtectedBranches';
export { default as ProtectedTags } from './ProtectedTags';
export { default as ProjectVariables } from './ProjectVariables';
export { default as ReleaseLinks } from './ReleaseLinks';
export { default as Repositories } from './Repositories';
export { default as RepositoryFiles } from './RepositoryFiles';
export { default as Runners } from './Runners';