Skip to content

Commit

Permalink
feat: Adding support for Releases API #295
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalrymple committed Jun 6, 2019
1 parent b0af54b commit 7191e81
Show file tree
Hide file tree
Showing 3 changed files with 37 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,
Releases: APIServices.Releases,
Repositories: APIServices.Repositories,
RepositoryFiles: APIServices.RepositoryFiles,
Runners: APIServices.Runners,
Expand Down
35 changes: 35 additions & 0 deletions src/services/Releases.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { BaseService, RequestHelper } from '../infrastructure';

class Releases extends BaseService {
all(projectId: ProjectId, options?: PaginatedRequestOptions) {
const pId = encodeURIComponent(projectId);

return RequestHelper.get(this, `projects/${pId}/releases`, options);
}

create(projectId: ProjectId, options?: BaseRequestOptions) {
const pId = encodeURIComponent(projectId);

return RequestHelper.post(this, `projects/${pId}/releases`, options);
}

edit(projectId: ProjectId, tagName: string, options?: BaseRequestOptions) {
const [pId, tId] = [projectId, tagName].map(encodeURIComponent);

return RequestHelper.put(this, `projects/${pId}/releases/${tId}`, options);
}

remove(projectId: ProjectId, tagName: string, options?: Sudo) {
const [pId, tId] = [projectId, tagName].map(encodeURIComponent);

return RequestHelper.del(this, `projects/${pId}/releases/${tId}`, options);
}

show(projectId: ProjectId, tagName: string, options?: Sudo) {
const [pId, tId] = [projectId, tagName].map(encodeURIComponent);

return RequestHelper.get(this, `projects/${pId}/releases/${tId}`, options);
}
}

export default Releases;
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 Releases } from './Releases';
export { default as Repositories } from './Repositories';
export { default as RepositoryFiles } from './RepositoryFiles';
export { default as Runners } from './Runners';
Expand Down

0 comments on commit 7191e81

Please sign in to comment.