@@ -183,24 +183,45 @@ The following interface is required for a model to properly work with `createApi
183
183
184
184
** ` Model.entity : String ` **
185
185
186
- ** ` Model.fetch(params : any) : Promise ` **
186
+ ** ` Model.fetch( params : any ) : Promise ` **
187
187
188
- ** ` Model.fetchAll(params : any) : Promise ` **
188
+ ** ` Model.fetchAll( params : any ) : Promise ` **
189
189
190
- ** ` Model.save(instance : Object) : Promise ` **
190
+ ** ` Model.save( instance : Object ) : Promise ` **
191
+
192
+ ** ` Model.delete( instance : Object ) : Promise ` **
193
+
194
+
195
+ ## Entity Getters
196
+
197
+ ** ` RestApi.createEntityMapGetter( model ) : Getter ` **
198
+
199
+ Creates a getter for a specific model that references the ` restApiCache ` map of entity id => entity.
200
+
201
+ ** ` RestApi.createByIdGetter( model ) : function ` **
202
+
203
+ Creates a function that returns a getter that references a specific entity by id in the ` restApiCache ` map.
204
+
205
+ ** Usage**
206
+
207
+ ``` js
208
+ Project .actions .fetchAll ()
209
+
210
+ flux .observe (Project .getters .entityMap , projectMap => {
211
+ console .log (' project rest api cache changed' , projectMap .toJS ())
212
+ })
213
+ ```
191
214
192
- ** ` Model.delete(instance : Object) : Promise ` **
193
215
194
216
## TODO
195
217
196
218
### v1
197
219
198
220
- [x] Complete testing the ` createApiActions ` method 100%
199
- - [ ] Implement travis.ci badge for coverage
200
221
- [x] add example entity module
201
222
- [x] Update rest-api-example README with architecture overview
202
223
- [x] Update rest-api-example README example model
203
- - [ ] Update rest-api-example README with getter pattern for rest api modules
224
+ - [x ] Update rest-api-example README with getter pattern for rest api modules
204
225
- [ ] Link to README / example in main NuclearJS README
205
226
- [x] Cleanup components / gulp / webpack configs
206
227
0 commit comments