Skip to content
Snippets Groups Projects
Commit aed4db62 authored by Kristof De Langhe's avatar Kristof De Langhe Committed by Marie Verdonck
Browse files

64387: HAL endpoint refactoring

parent ee140e62
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@ import { ObjectCacheService } from '../cache/object-cache.service';
import { CommunityDataService } from './community-data.service';
import { DataService } from './data.service';
import { PaginatedList } from './paginated-list';
import { RemoteData } from './remote-data';
import { FindListOptions, FindByIDRequest } from './request.models';
import { HALEndpointService } from '../shared/hal-endpoint.service';
import { getResponseFromEntry } from '../shared/operators';
......@@ -57,4 +59,8 @@ export abstract class ComColDataService<T extends CacheableObject> extends DataS
return observableMerge(errorResponses, successResponses).pipe(distinctUntilChanged(), share());
}
}
public findByParentCommunity(parentUUID: string): Observable<RemoteData<PaginatedList<T>>> {
this.halService.getEndpoint(`communities/${parentUUID}/collections`)
}
}
......@@ -247,4 +247,14 @@ export class ItemDataService extends DataService<Item> {
map((request: RequestEntry) => request.response)
);
}
/**
* Get the endpoint for an item's bitstreams
* @param itemId
*/
public getBitstreamsEndpoint(itemId: string): Observable<string> {
return this.halService.getEndpoint(this.linkPath).pipe(
switchMap((url: string) => this.halService.getEndpoint('bitstreams', `${url}/${itemId}`))
);
}
}
......@@ -43,8 +43,8 @@ export class HALEndpointService {
);
}
public getEndpoint(linkPath: string): Observable<string> {
return this.getEndpointAt(this.getRootHref(), ...linkPath.split('/'));
public getEndpoint(linkPath: string, startHref?: string): Observable<string> {
return this.getEndpointAt(startHref || this.getRootHref(), ...linkPath.split('/'));
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment