@@ -472,17 +472,33 @@ export abstract class BaseItemDataService extends IdentifiableDataService<Item>
472472 * {@link HALLink}s should be automatically resolved
473473 */
474474 public findById ( id : string , useCachedVersionIfAvailable = true , reRequestOnStale = true , ...linksToFollow : FollowLinkConfig < Item > [ ] ) : Observable < RemoteData < Item > > {
475+ const href$ = this . getIDHrefObs ( encodeURIComponent ( id ) , ...linksToFollow ) ;
476+ return this . findByHref ( href$ , useCachedVersionIfAvailable , reRequestOnStale , ...linksToFollow ) ;
477+ }
475478
479+ /**
480+ * Returns an observable of {@link RemoteData} of an object, based on its ID or custom URL if the parameter is not a valid id/uuid, with a list of
481+ * {@link FollowLinkConfig}, to automatically resolve {@link HALLink}s of the object
482+ * @param id ID of object we want to retrieve
483+ * @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
484+ * no valid cached version. Defaults to true
485+ * @param reRequestOnStale Whether or not the request should automatically be re-
486+ * requested after the response becomes stale
487+ * @param linksToFollow List of {@link FollowLinkConfig} that indicate which
488+ * {@link HALLink}s should be automatically resolved
489+ */
490+ public findByIdOrCustomUrl ( id : string , useCachedVersionIfAvailable = true , reRequestOnStale = true , ...linksToFollow : FollowLinkConfig < Item > [ ] ) : Observable < RemoteData < Item > > {
476491 if ( uuidValidate ( id ) ) {
477- const href$ = this . getIDHrefObs ( encodeURIComponent ( id ) , ...linksToFollow ) ;
478- return this . findByHref ( href$ , useCachedVersionIfAvailable , reRequestOnStale , ...linksToFollow ) ;
492+ return this . findById ( id , useCachedVersionIfAvailable , reRequestOnStale , ...linksToFollow ) ;
479493 } else {
480494 return this . findByCustomUrl ( id , useCachedVersionIfAvailable , reRequestOnStale , linksToFollow ) ;
481495 }
482496 }
483497
484498}
485499
500+
501+
486502/**
487503 * A service for CRUD operations on Items
488504 */
0 commit comments