[ADF-2905] Updated JSDocs for core (#3271)

This commit is contained in:
Andy Stark
2018-05-04 19:03:13 +01:00
committed by Eugenio Romano
parent fe0ac0e474
commit c824e646de
18 changed files with 256 additions and 119 deletions

View File

@@ -31,6 +31,12 @@ export class CommentContentService {
private logService: LogService) {
}
/**
* Adds a comment to a node.
* @param nodeId ID of the target node
* @param message Text for the comment
* @returns Details of the comment added
*/
addNodeComment(nodeId: string, message: string): Observable<CommentModel> {
return Observable.fromPromise(this.apiService.getInstance().core.commentsApi.addComment(nodeId, {content: message}))
.map((response: any) => {
@@ -43,6 +49,11 @@ export class CommentContentService {
}).catch(err => this.handleError(err));
}
/**
* Gets all comments that have been added to a node.
* @param nodeId ID of the target node
* @returns Details for each comment
*/
getNodeComments(nodeId: string): Observable<CommentModel[]> {
return Observable.fromPromise(this.apiService.getInstance().core.commentsApi.getComments(nodeId))
.map((response: any) => {

View File

@@ -79,11 +79,8 @@ export class ContentService {
/**
* Invokes content download for a Blob with a file name.
*
* @param blob Content to download.
* @param fileName Name of the resulting file.
*
* @memberOf ContentService
*/
downloadBlob(blob: Blob, fileName: string): void {
this.saveData(blob, 'blob', fileName);
@@ -91,11 +88,8 @@ export class ContentService {
/**
* Invokes content download for a data array with a file name.
*
* @param data Data to download.
* @param fileName Name of the resulting file.
*
* @memberOf ContentService
*/
downloadData(data: any, fileName: string): void {
this.saveData(data, 'data', fileName);
@@ -103,11 +97,8 @@ export class ContentService {
/**
* Invokes content download for a JSON object with a file name.
*
* @param json JSON object to download.
* @param fileName Name of the resulting file.
*
* @memberOf ContentService
*/
downloadJSON(json: any, fileName: string): void {
this.saveData(json, 'json', fileName);
@@ -117,8 +108,7 @@ export class ContentService {
* Creates a trusted object URL from the Blob.
* WARNING: calling this method with untrusted user data exposes your application to XSS security risks!
* @param blob Data to wrap into object URL
*
* @memberOf ContentService
* @returns URL string
*/
createTrustedUrl(blob: Blob): string {
let url = window.URL.createObjectURL(blob);
@@ -130,11 +120,11 @@ export class ContentService {
}
/**
* Get thumbnail URL for the given document node.
*
* Gets a thumbnail URL for the given document node.
* @param node Node to get URL for.
* @param [attachment] Retrieve content as an attachment for download
* @param [ticket] Custom ticket to use for authentication
* @param attachment Toggles whether to retrieve content as an attachment for download
* @param ticket Custom ticket to use for authentication
* @returns URL string
*/
getDocumentThumbnailUrl(node: any, attachment?: boolean, ticket?: string): string {
@@ -146,11 +136,11 @@ export class ContentService {
}
/**
* Get content URL for the given node.
*
* @param nodeId or node to get URL for.
* @param [attachment] Retrieve content as an attachment for download
* @param [ticket] Custom ticket to use for authentication
* Gets a content URL for the given node.
* @param node Node to get URL for.
* @param attachment Toggles whether to retrieve content as an attachment for download
* @param ticket Custom ticket to use for authentication
* @returns URL string
*/
getContentUrl(node: any, attachment?: boolean, ticket?: string): string {
@@ -162,9 +152,9 @@ export class ContentService {
}
/**
* Get content for the given node.
* Gets content for the given node.
* @param nodeId ID of the target node
*
* @returns Content data
*/
getNodeContent(nodeId: string): Observable<any> {
return Observable.fromPromise(this.apiService.getInstance().core.nodesApi.getFileContent(nodeId).then((dataContent) => {
@@ -173,10 +163,11 @@ export class ContentService {
}
/**
* Create a folder
* Creates a folder.
* @param relativePath Location to create the folder
* @param name Folder name
* @param parentId Node ID of parent folder
* @returns Information about the new folder
*/
createFolder(relativePath: string, name: string, parentId?: string): Observable<FolderCreatedEvent> {
return Observable.fromPromise(this.apiService.getInstance().nodes.createFolder(name, relativePath, parentId))
@@ -193,8 +184,8 @@ export class ContentService {
/**
* Gets a Node via its node ID.
* @param nodeId
* @param opts
* @param nodeId ID of the target node
* @param opts Options supported by JSAPI
* @returns Details of the folder
*/
getNode(nodeId: string, opts?: any): Observable<NodeEntry> {
@@ -202,10 +193,10 @@ export class ContentService {
}
/**
* Check if the user has permissions on that node
* Checks if the user has permissions on that node
* @param node Node to check allowableOperations
* @param permission Create, delete, update, updatePermissions, !create, !delete, !update, !updatePermissions
*
* @returns True if the user has the required permissions, false otherwise
*/
hasPermission(node: Node, permission: PermissionsEnum | string): boolean {
let hasPermission = false;
@@ -239,9 +230,9 @@ export class ContentService {
}
/**
* Check if the node has the properties allowableOperations
* Checks if the node has the properties allowableOperations
* @param node Node to check allowableOperations
*
* @returns True if the node has the property, false otherwise
*/
hasAllowableOperations(node: any): boolean {
return node && node.allowableOperations ? true : false;

View File

@@ -35,6 +35,7 @@ export abstract class DynamicComponentMapper {
* Gets the currently active ComponentTypeResolver function for a field type.
* @param type The type whose resolver you want
* @param defaultValue Default type returned for types that are not yet mapped
* @returns Resolver function
*/
getComponentTypeResolver(type: string, defaultValue: Type<{}> = this.defaultValue): DynamicComponentResolveFunction {
if (type) {
@@ -70,6 +71,7 @@ export abstract class DynamicComponentMapper {
* Finds the component type that is needed to render a form field.
* @param model [Form field model](form-field.model.md) for the field to render
* @param defaultValue Default type returned for field types that are not yet mapped.
* @returns Component type
*/
resolveComponentType(model: DynamicComponentModel, defaultValue: Type<{}> = this.defaultValue): Type<{}> {
if (model) {

View File

@@ -62,6 +62,12 @@ export class FavoritesApiService {
return this.apiService.getInstance().core.favoritesApi;
}
/**
* Gets the favorites for a user.
* @param personId ID of the user
* @param options Options supported by JSAPI
* @returns List of favorites
*/
getFavorites(personId: string, options?: any): Observable<NodePaging> {
const { favoritesApi, handleError } = this;
const defaultOptions = {