mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 04:53:06 +00:00
tests and documentation
This commit is contained in:
@@ -1,12 +1,42 @@
|
||||
import { FindListOptions } from '../../core/data/request.models';
|
||||
import { HALResource } from '../../core/shared/hal-resource.model';
|
||||
|
||||
/**
|
||||
* A class to configure the retrieval of a HALLink
|
||||
*/
|
||||
export class FollowLinkConfig<R extends HALResource> {
|
||||
/**
|
||||
* The name of the link to fetch.
|
||||
* Can only be a HALLink of the object you're working with
|
||||
*/
|
||||
name: keyof R['_links'];
|
||||
|
||||
/**
|
||||
* {@link FindListOptions} for the query,
|
||||
* allows you to resolve the link using a certain page, or sorted
|
||||
* in a certain way
|
||||
*/
|
||||
findListOptions?: FindListOptions;
|
||||
|
||||
/**
|
||||
* A list of {@link FollowLinkConfig}s to
|
||||
* use on the retrieved object.
|
||||
*/
|
||||
linksToFollow?: Array<FollowLinkConfig<any>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A factory function for {@link FollowLinkConfig}s,
|
||||
* in order to create them in a less verbose way.
|
||||
*
|
||||
* @param linkName: the name of the link to fetch.
|
||||
* Can only be a HALLink of the object you're working with
|
||||
* @param findListOptions: {@link FindListOptions} for the query,
|
||||
* allows you to resolve the link using a certain page, or sorted
|
||||
* in a certain way
|
||||
* @param linksToFollow: a list of {@link FollowLinkConfig}s to
|
||||
* use on the retrieved object.
|
||||
*/
|
||||
export const followLink = <R extends HALResource>(
|
||||
linkName: keyof R['_links'],
|
||||
findListOptions?: FindListOptions,
|
||||
|
Reference in New Issue
Block a user