1 | /*
|
2 | * Copyright 2012-2013 the original author or authors
|
3 | * @license MIT, see LICENSE.txt for details
|
4 | *
|
5 | * @author Scott Andrews
|
6 | */
|
7 |
|
8 | (function (define) {
|
9 | ;
|
10 |
|
11 | define(function (require) {
|
12 |
|
13 | var SimpleRestStore, queryResults;
|
14 |
|
15 | SimpleRestStore = require('./SimpleRestStore');
|
16 | queryResults = require('dojo/store/util/QueryResults');
|
17 |
|
18 | /**
|
19 | * A REST based object store.
|
20 | *
|
21 | * The base path for requests is commonly provided by the
|
22 | *`rest/interceptor/pathPrefix` interceptor.
|
23 | *
|
24 | * Extends SimpleRestStore, but wraps the query results with Dojo's
|
25 | * QueryResults.
|
26 | *
|
27 | * @param {RestStore} [options] configuration information that will be mixed
|
28 | * into the store
|
29 | */
|
30 | function RestStore(/* options */) {
|
31 | SimpleRestStore.apply(this, arguments);
|
32 | }
|
33 |
|
34 | RestStore.prototype = Object.create(SimpleRestStore.prototype);
|
35 |
|
36 | /**
|
37 | * Queries the store for objects. This will trigger a GET request to the
|
38 | * server, with the query added as a query string.
|
39 | *
|
40 | * @param {Object} query params used for the query string
|
41 | * @param {Object} [options] reserved for future use
|
42 | *
|
43 | * @returns {QueryResult} query results
|
44 | */
|
45 | RestStore.prototype.query = function query(/* query, options */) {
|
46 | return queryResults(SimpleRestStore.prototype.query.apply(this, arguments));
|
47 | };
|
48 |
|
49 | return RestStore;
|
50 |
|
51 | });
|
52 |
|
53 | }(
|
54 | typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }
|
55 | // Boilerplate for AMD and Node
|
56 | ));
|