Skip to content

Commit 6e5f249

Browse files
authored
feat: add request argument to model-api getData method (#766)
1 parent 0cfa9c3 commit 6e5f249

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/data/data-source/data-source.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ export const dataSourceMarker = Symbol('Data Source Marker');
66
/**
77
* A model which can be used to retrieve data asynchronously
88
*/
9-
export interface DataSource<T> {
9+
export interface DataSource<T, R = unknown> {
1010
/**
1111
* Retrieves data of type T in the form of an observable
1212
*/
13-
getData(): Observable<T>;
13+
getData(request?: R): Observable<T>;
1414

1515
/**
1616
* A marker property used to determine if the implementing class is

src/model/api/default-model-api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class DefaultModelApi implements ModelApi {
6969
/**
7070
* @inheritdoc
7171
*/
72-
public getData<T>(): Observable<T> {
72+
public getData<T, R>(request?: R): Observable<T> {
7373
const dataSource = this.dataSourceManager.getClosest<T>(this.model);
7474

7575
if (!dataSource) {
@@ -78,7 +78,7 @@ export class DefaultModelApi implements ModelApi {
7878
return EMPTY;
7979
}
8080

81-
return dataSource.getData();
81+
return dataSource.getData(request);
8282
}
8383

8484
/**

src/model/api/model-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface ModelApi {
3232
* attached to)
3333
* - Else, recurse upwards to parent
3434
*/
35-
getData<T>(): Observable<T>;
35+
getData<T, R = unknown>(request?: R): Observable<T>;
3636

3737
/**
3838
* Retrieves the merged theme specified for this model

0 commit comments

Comments
 (0)