Merge pull request #1340 from bjarnef/dev-v7-U4-8608

Document getByQuery
This commit is contained in:
Sebastiaan Janssen
2016-08-08 17:02:53 +02:00
committed by GitHub

View File

@@ -109,16 +109,6 @@ function entityResource($q, $http, umbRequestHelper) {
[{ id: id}, {type: type }])),
'Failed to retrieve entity data for id ' + id);
},
getByQuery: function (query, nodeContextId, type) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"entityApiBaseUrl",
"GetByQuery",
[{query: query},{ nodeContextId: nodeContextId}, {type: type }])),
'Failed to retrieve entity data for query ' + query);
},
/**
* @ngdoc method
@@ -168,7 +158,41 @@ function entityResource($q, $http, umbRequestHelper) {
/**
* @ngdoc method
* @name umbraco.resources.entityResource#getEntityById
* @name umbraco.resources.entityResource#getByQuery
* @methodOf umbraco.resources.entityResource
*
* @description
* Gets an entity from a given xpath
*
* ##usage
* <pre>
* //get content by xpath
* entityResource.getByQuery("$current", -1, "Document")
* .then(function(ent) {
* var myDoc = ent;
* alert('its here!');
* });
* </pre>
*
* @param {string} query xpath to use in query
* @param {Int} nodeContextId id id to start from
* @param {string} type Object type name
* @returns {Promise} resourcePromise object containing the entity.
*
*/
getByQuery: function (query, nodeContextId, type) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"entityApiBaseUrl",
"GetByQuery",
[{ query: query }, { nodeContextId: nodeContextId }, { type: type }])),
'Failed to retrieve entity data for query ' + query);
},
/**
* @ngdoc method
* @name umbraco.resources.entityResource#getAll
* @methodOf umbraco.resources.entityResource
*
* @description
@@ -260,7 +284,7 @@ function entityResource($q, $http, umbRequestHelper) {
/**
* @ngdoc method
* @name umbraco.resources.entityResource#searchMedia
* @name umbraco.resources.entityResource#search
* @methodOf umbraco.resources.entityResource
*
* @description