Skip to content

Commit

Permalink
feat: Adding support for ReleaseLinks API
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalrymple committed Jun 6, 2019
1 parent b0af54b commit d6a2248
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
44 changes: 44 additions & 0 deletions src/services/ReleaseLinks.ts
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit d6a2248

Please sign in to comment.