fabric8-planner
Version:
A planner front-end for Fabric8.
227 lines (226 loc) • 7.88 kB
TypeScript
import { Observable } from 'rxjs';
import { Logger } from 'ngx-base';
import { Spaces } from 'ngx-fabric8-wit';
import { User, UserService } from 'ngx-login-client';
import { Comment } from '../models/comment';
import { AreaModel } from '../models/area.model';
import { LinkTypeService } from '../models/link-type';
import { WorkItem } from '../models/work-item';
import { WorkItemType } from './../models/work-item-type';
import { HttpBackendClient, HttpClientService } from './../shared/http-module/http.service';
import { AreaService } from './area.service';
export declare class WorkItemService {
private httpClientService;
private httpBackendClient;
private logger;
private areaService;
private userService;
private spaces;
private baseApiUrl;
private workItemUrl;
private renderUrl;
workItemTypes: WorkItemType[];
_currentSpace: any;
constructor(httpClientService: HttpClientService, httpBackendClient: HttpBackendClient, logger: Logger, areaService: AreaService, userService: UserService, spaces: Spaces, baseApiUrl: string);
private notifyError;
private handleError;
/**
* Takes a URL to the list of child
* work items of a particular work item
* and performs a get operation for all the child items
* @param url url to the child work items
*/
getChildren(url: string): Observable<WorkItem[]>;
/**
* Usage: Performs a get operation on work items
*
* @param pageSize number of work items to be fetched
* @param filters filters to the work items
*/
getWorkItems(pageSize: number, filters: object): Observable<{
workItems: WorkItem[];
nextLink: string;
totalCount?: number | null;
included?: WorkItem[] | null;
ancestorIDs?: Array<string>;
}>;
/**
* This function is called from next page onwards in the scroll
* It does pretty much same as the getWorkItems function
*/
getMoreWorkItems(url: any): Observable<{
workItems: WorkItem[];
nextLink: string | null;
included?: WorkItem[] | null;
ancestorIDs?: Array<string>;
}>;
/**
* Usage: This method gives a single work item by display number.
*
* @param id : string - number
* @param owner : string
* @param space : string
*/
getWorkItemByNumber(id: string | number, owner?: string, space?: string): Observable<WorkItem>;
/**
* Usage: This method is to get the events for a work item
* This method is only called when a single item is fetched for the
* details page.
*
* @param: WorkItem - wItem
*/
getEvents(url: string): Observable<any>;
/**
* Usage: This method is to resolve the comments for a work item
* This method is only called when a single item is fetched for the
* details page.
*
* @param: WorkItem - wItem
*/
resolveComments(url: string): Observable<any>;
/**
* Usage: This method is to resolve the linked items for a work item
* This method is only called when a single item is fetched for the
* details page.
*
* @param: WorkItem - wItem
*/
resolveLinks(url: string): Observable<any>;
/**
* Usage: fetch all the work item types
*
* @param workItemTypeUrl : string
*/
getWorkItemTypes(workItemTypeUrl: string): Observable<any[]>;
/**
* Usage: This method deletes an work item
* @param workItem WorkItem
*/
delete(workItem: WorkItem): Observable<any>;
/**
* Usage: This method create a new item
*
* @param: url
* @param: WorkItem - workItem (Item to be created)
*/
create(url: string, workItem: WorkItem): Observable<WorkItem>;
/**
* Usage: This method update an existing item
* updates the item in the big list
* resolve the users for the item
*
* @param: WorkItem - workItem (Item to be created)
*/
update(workItem: WorkItem): Observable<WorkItem>;
/**
* Usage: This method create a comment for a workItem
*
* @param: string - id (Work Item ID)
* @param: Comment
*/
createComment(url: string, comment: Comment): Observable<Comment>;
/**
* Usage: to update comment pass in with the ID
*
* @param comment Comment type
*/
updateComment(comment: Comment): Observable<Comment>;
/**
* Usage: To delete a comment
* @param comment Comment
*/
deleteComment(comment: Comment): Observable<any>;
/**
* Usage: This function fetches all the work item link types
* Store it in an instance variable
*
* @return Promise of LinkType[]
*/
getAllLinkTypes(url: string): Observable<LinkTypeService[]>;
/**
* Usage: Makes an API call to create a link
* Recieves the new link response
* Resolves and add the new link to the workItem
*
* @param link: Link - The new link object for request params
* @returns Promise<Link>
*/
createLink(url: string, link: Object): Observable<any>;
/**
* Usage: Makes an API call to delete a link
* Removes the new link to the workItem
*
* @param link: Link
* @returns Promise<void>
*/
deleteLink(url: string): Observable<void>;
searchLinkWorkItem(term: string, spaceId: string): Observable<WorkItem[]>;
/**
* Usage: Make a API call to save
* the order of work item.
*
* @param spaceLink: string
* @param workItemId: string
* @param prevWiId: string
* @param direction: string
*/
reOrderWorkItem(spaceLink: string, workItem: WorkItem, prevWiId: string | null, direction: string): Observable<WorkItem>;
/**
* Usage: This function is used to render markdown text in html
* @param markDownText string
*/
renderMarkDown(markDownText: string): Observable<any>;
/**
* All the soon to be deprecated method stays behind this line
*/
/**
* @deprecated Planner :: this property will be deprecated soon
*/
private userIdMap;
/**
* @deprecated Planner :: this function will be deprecated soon
* @function buildUserIdMap builds a ID-User map to dynamically access list of users
* This method takes the locally saved list of users from User Service
* Before coming to this method we fetch the list of users using router resolver
* in detail and list component.
*/
buildUserIdMap(): void;
/**
* @deprecated Planner :: we save all the types in the store in a key - value pair.
* Therefore, this function is not needed anymore.
*
* Usage: This method is to fetch the work item types by ID
*/
getWorkItemTypesById(id: string): Observable<WorkItemType>;
/**
* @deprecated Planner :: this method will be deprecated soon
* Resolving relations is moved to querries
*
* Usage: Resolve the wi type for a WorkItem
*/
resolveType(workItem: WorkItem): void;
/**
* @deprecated Planner :: this method will be deprecated soon
* Usage: Fetch an area by it's ID from the areas list
*/
getAreaById(areaId: string): Observable<AreaModel>;
/**
* @deprecated Planner :: this method will be deprecated soon
* Resolving relations is moved to querries
*
* Usage: To resolve the areas in eact WorkItem
* For now it resolves assignne and creator
*/
resolveAreaForWorkItem(workItem: WorkItem): void;
/**
* @deprecated Planner ::
* Usage: Fetch an use by it's ID from the User-ID map
*/
getUserById(userId: string): User;
/**
* @deprecated Planner :: this method will be deprecated soon
* Resolving relations is moved to querries
* Usage: Resolve the creator for a WorkItem
*/
resolveCreator(workItem: WorkItem): void;
}