Skip to content

Commit 3756f53

Browse files
committed
feat(peopleadapter): create an interface
1 parent 3530d99 commit 3756f53

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/adapters/PeopleAdapter.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {throwError} from 'rxjs';
2+
3+
/**
4+
* This is a base class that defines the interface that maps people data.
5+
* Developers that want to extend `PeopleAdapter` must implement all of its methods,
6+
* adhering to the exact parameters and structure of the returned objects
7+
*/
8+
export default class PeopleAdapter {
9+
/**
10+
* Returns an observable that emits person data
11+
*
12+
* @param {String} id - ID of person to get
13+
* @returns {Observable<PersonObject>}
14+
* @memberof PeopleAdapter
15+
*/
16+
// eslint-disable-next-line no-unused-vars
17+
getPerson(id) {
18+
return throwError(new Error('getPerson(id) must be defined in PeopleAdapter'));
19+
}
20+
}

0 commit comments

Comments
 (0)