Addressing PR comments.

This commit is contained in:
Zack Urben 2019-10-03 19:13:06 +00:00
parent 1f93315724
commit 1289c2bac0
6 changed files with 21 additions and 15 deletions

View File

@ -148,6 +148,7 @@ GroupMembers
GroupMilestones
GroupProjects
GroupVariables
GroupLabels
Epics
EpicIssues
EpicNotes
@ -302,6 +303,7 @@ GroupMembers
GroupMilestones
GroupProjects
GroupVariables
GroupLabels
Epics
EpicIssues
EpicNotes

View File

@ -20,6 +20,7 @@ export const GroupsBundle = bundler({
GroupMilestones: APIServices.GroupMilestones,
GroupProjects: APIServices.GroupProjects,
GroupVariables: APIServices.GroupVariables,
GroupLabels: APIServices.GroupLabels,
Epics: APIServices.Epics,
EpicIssues: APIServices.EpicIssues,
EpicNotes: APIServices.EpicNotes,

View File

@ -0,0 +1,12 @@
import { BaseService, PaginatedRequestOptions, RequestHelper } from '../infrastructure';
import { GroupProjectId } from './index';
class GroupLabels extends BaseService {
all(groupId: GroupProjectId, options?: PaginatedRequestOptions) {
const gId = encodeURIComponent(groupId);
return RequestHelper.get(this, `groups/${gId}/labels`, options);
}
}
export default GroupLabels;

View File

@ -5,24 +5,13 @@ import {
RequestHelper,
Sudo,
} from '../infrastructure';
import { GroupId, ProjectId, LabelId } from '.';
import { ProjectId, LabelId } from '.';
class Labels extends BaseService {
all({
projectId,
groupId,
...options
}: ({ projectId: ProjectId } | { groupId: GroupId } | {}) & PaginatedRequestOptions) {
let url;
if (projectId) {
url = `projects/${encodeURIComponent(projectId)}/labels`;
}
else if (groupId) {
url = `groups/${encodeURIComponent(groupId)}/labels`;
}
all(projectId: ProjectId, options?: PaginatedRequestOptions) {
const pId = encodeURIComponent(projectId);
return RequestHelper.get(this, url, options);
return RequestHelper.get(this, `projects/${pId}/labels`, options);
}
create(projectId: ProjectId, labelName: string, color: string, options?: BaseRequestOptions) {

View File

@ -8,6 +8,7 @@ export { default as GroupMembers } from './GroupMembers';
export { default as GroupMilestones } from './GroupMilestones';
export { default as GroupProjects } from './GroupProjects';
export { default as GroupVariables } from './GroupVariables';
export { default as GroupLabels } from './GroupLabels';
export { default as Epics } from './Epics';
export { default as EpicIssues } from './EpicIssues';
export { default as EpicNotes } from './EpicNotes';

View File

@ -13,6 +13,7 @@ test('All the correct service keys are included in the groups bundle', async ()
'GroupMilestones',
'GroupProjects',
'GroupVariables',
'GroupLabels',
'Epics',
'EpicIssues',
'EpicNotes',