diff --git a/Gruntfile.js b/Gruntfile.js index 8bb0eb4..65c6115 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,15 +1,12 @@ module.exports = function(grunt) { - var qPath = { - "q": "../node_modules/q/q" - }, - testPaths = { - "q": "../node_modules/q/q", - "jasmineCAPIMatchers": "../test/jasmine/CAPIMatchers" + var testPaths = { + "jasmineCAPIMatchers": "../test/jasmine/CAPIMatchers", + "libs/q": "../node_modules/q/q" }, coveragePaths = { - "q": "../node_modules/q/q", - "jasmineCAPIMatchers": "../../../test/jasmine/CAPIMatchers" + "jasmineCAPIMatchers": "../../../test/jasmine/CAPIMatchers", + "libs/q": "../../../node_modules/q/q" }; grunt.initConfig({ @@ -17,10 +14,9 @@ module.exports = function(grunt) { dist: { options: { almond: true, - name : 'PromiseCAPI', + name : 'CAPI', optimize: "none", baseUrl: "src/", - paths: qPath, out: "dist/CAPI.js", wrap: { startFile: 'wrap/wrap.start.js', @@ -28,13 +24,12 @@ module.exports = function(grunt) { } } }, - distmin: { + distMin: { options: { almond: true, - name : 'PromiseCAPI', + name : 'CAPI', optimize: "uglify", baseUrl: "src/", - paths: qPath, out: "dist/CAPI-min.js", wrap: { startFile: 'wrap/wrap.start.js', @@ -42,19 +37,57 @@ module.exports = function(grunt) { } } }, - testBundle: { + distPromise: { options: { almond: true, name : 'PromiseCAPI', optimize: "none", baseUrl: "src/", - paths: qPath, + out: "dist/PromiseCAPI.js", + wrap: { + startFile: 'wrap/wrap.start.js', + endFile: 'wrap/wrap.promise.end.js' + } + } + }, + distPromiseMin: { + options: { + almond: true, + name : 'PromiseCAPI', + optimize: "uglify", + baseUrl: "src/", + out: "dist/PromiseCAPI-min.js", + wrap: { + startFile: 'wrap/wrap.start.js', + endFile: 'wrap/wrap.promise.end.js' + } + } + }, + testBundle: { + options: { + almond: true, + name : 'CAPI', + optimize: "none", + baseUrl: "src/", out: "test/manual/jsRestClientBundle/Resources/public/js/CAPI.js", wrap: { startFile: 'wrap/wrap.start.js', endFile: 'wrap/wrap.end.js' } } + }, + testBundlePromise: { + options: { + almond: true, + name : 'PromiseCAPI', + optimize: "none", + baseUrl: "src/", + out: "test/manual/jsRestClientBundle/Resources/public/js/PromiseCAPI.js", + wrap: { + startFile: 'wrap/wrap.start.js', + endFile: 'wrap/wrap.promise.end.js' + } + } } }, jshint: { diff --git a/README.md b/README.md index 04b5d32..7b8353d 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,18 @@ $ bower install --save ezsystems/ez-js-rest-client Then you can include in your project the file `bower\_components/ez-js-rest-client/dist/CAPI-min.js` (or the non minified -version). It's also possible to directly take `dist/CAPI.js` or -`dist/CAPI-min.js` in a clone of this repository. +version). + +There is also an option to use promise-based version of the client (file +`bower\_components/ez-js-rest-client/dist/PromiseCAPI.js` or +`bower\_components/ez-js-rest-client/dist/PromiseCAPI-min.js`). +It provides the same functional but all asynchronous methods are +promise-wrapped which helps to make code more clean and readable. + +Read more about promise-based version in the **Build** section of this manual. + +It's also possible to directly take any of the mentioned files in a clone +of this repository. ## Development @@ -34,7 +44,7 @@ environment with a help of Grunt task runner. ``` * Install the global dependencies (usually you need to be root) ``` - # npm install -g grunt-cli yuidoc + # npm install -g grunt-cli yuidoc bower ``` ### API Documentation @@ -61,7 +71,21 @@ The library can be built with: $ grunt build ``` -This command will (re)generate the files `dist/CAPI.js` and `dist/CAPI-min.js`. +This command will (re)generate the files `dist/CAPI.js`, `dist/CAPI-min.js` +and `dist/PromiseCAPI.js`. +First 2 files are full and minified versions of the regular client library +which doesn't have any dependencies and is intended for general use. + + The `PromiseCAPI.js` is a promise-based version of the library +which has a dependency on the Q library. While using this version a developer +himself is responsible for inclusion of Q library into the project. +It can be done by using preferred dependency management system or by simply +downloading and including Q library file into scripts. +For example see the source file from manual testing bundle: +`test/manual/jsRestClientBundle/Resources/views/promise.test.html.twig`. + +More info on Q and promises: https://github.com/kriskowal/q. + ### Tests @@ -108,10 +132,19 @@ using following instruction: jsRestClientBundle: resource: "@jsRestClientBundle/Resources/config/routing.yml" ``` - +* If you intend to test promise-based version of the CAPI, additionally install +Q library by running the following command **from the bundle directory**: +``` +$ bower install +``` * Clear the Symfony 2 caches with ezpublish/console. -After these steps you may access `/js-rest-client-test/` path where you will find -testing html page. Most of requests can be configured a little bit before +After these steps you may access `/js-rest-client-test/` path where you will +find testing html page. Most of requests can be configured a little bit before executing them by changing input values. See details of tests implementation in -Resources/public/js/cookbook-*.js files. +`Resources/public/js/cookbook-*.js` files. + +To test promise-based version of the CAPI you can use +`/js-rest-client-promise-test/` path. +This setup includes Q library as a bower package. See details of (rather basic) +tests implementation in `Resources/public/js/cookbook-PromiseCAPI.js`. \ No newline at end of file diff --git a/dist/CAPI-min.js b/dist/CAPI-min.js index cf00a97..8dc2e47 100644 --- a/dist/CAPI-min.js +++ b/dist/CAPI-min.js @@ -4,31 +4,4 @@ * see: http://github.com/jrburke/almond for details */ -/*! - * - * Copyright 2009-2012 Kris Kowal under the terms of the MIT - * license found at http://github.com/kriskowal/q/raw/master/LICENSE - * - * With parts by Tyler Close - * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found - * at http://www.opensource.org/licenses/mit-license.html - * Forked at ref_send.js version: 2009-05-11 - * - * With parts by Mark Miller - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -(function(e,t){typeof define=="function"&&define.amd?define(t):e.libGlobalName=t()})(this,function(){var e,t,n;(function(r){function d(e,t){return h.call(e,t)}function v(e,t){var n,r,i,s,o,u,a,f,c,h,p=t&&t.split("/"),d=l.map,v=d&&d["*"]||{};if(e&&e.charAt(0)===".")if(t){p=p.slice(0,p.length-1),e=p.concat(e.split("/"));for(f=0;f0&&(e.splice(f-1,2),f-=2)}}e=e.join("/")}else e.indexOf("./")===0&&(e=e.substring(2));if((p||v)&&d){n=e.split("/");for(f=n.length;f>0;f-=1){r=n.slice(0,f).join("/");if(p)for(c=p.length;c>0;c-=1){i=d[p.slice(0,c).join("/")];if(i){i=i[r];if(i){s=i,o=f;break}}}if(s)break;!u&&v&&v[r]&&(u=v[r],a=f)}!s&&u&&(s=u,o=a),s&&(n.splice(0,o,s),e=n.join("/"))}return e}function m(e,t){return function(){return s.apply(r,p.call(arguments,0).concat([e,t]))}}function g(e){return function(t){return v(t,e)}}function y(e){return function(t){a[e]=t}}function b(e){if(d(f,e)){var t=f[e];delete f[e],c[e]=!0,i.apply(r,t)}if(!d(a,e)&&!d(c,e))throw new Error("No "+e);return a[e]}function w(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function E(e){return function(){return l&&l.config&&l.config[e]||{}}}var i,s,o,u,a={},f={},l={},c={},h=Object.prototype.hasOwnProperty,p=[].slice;o=function(e,t){var n,r=w(e),i=r[0];return e=r[1],i&&(i=v(i,t),n=b(i)),i?n&&n.normalize?e=n.normalize(e,g(t)):e=v(e,t):(e=v(e,t),r=w(e),i=r[0],e=r[1],i&&(n=b(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},u={require:function(e){return m(e)},exports:function(e){var t=a[e];return typeof t!="undefined"?t:a[e]={}},module:function(e){return{id:e,uri:"",exports:a[e],config:E(e)}}},i=function(e,t,n,i){var s,l,h,p,v,g=[],w;i=i||e;if(typeof n=="function"){t=!t.length&&n.length?["require","exports","module"]:t;for(v=0;v=400){r(new t("Connection error : "+i.status+".",{errorCode:i.status,xhr:i}),!1);return}r(!1,new e({status:i.status,headers:i.getAllResponseHeaders(),body:i.responseText}))},n.httpBasicAuth?i.open(n.method,n.url,!0,n.login,n.password):i.open(n.method,n.url,!0);for(s in n.headers)n.headers.hasOwnProperty(s)&&i.setRequestHeader(s,n.headers[s]);i.send(n.body)}};return n.isCompatible=function(){return!!window.XMLHttpRequest},n}),n("connections/MicrosoftXmlHttpRequestConnection",["structures/Response","structures/CAPIError"],function(e,t){var n=function(){this._xhr=new ActiveXObject("Microsoft.XMLHTTP"),this.execute=function(n,r){var i=this._xhr,s;i.onreadystatechange=function(){if(i.readyState!=4)return;if(i.status>=400){r(new t("Connection error : "+i.status+".",{errorCode:i.status,xhr:i}),!1);return}r(!1,new e({status:i.status,headers:i.getAllResponseHeaders(),body:i.responseText}))},n.httpBasicAuth?i.open(n.method,n.url,!0,n.login,n.password):i.open(n.method,n.url,!0);for(s in n.headers)n.headers.hasOwnProperty(s)&&i.setRequestHeader(s,n.headers[s]);i.send(n.body)}};return n.isCompatible=function(){return!!window.ActiveXObject},n}),n("services/DiscoveryService",["structures/CAPIError"],function(e){var t=function(e,t){this.connectionManager=t,this.rootPath=e,this.cacheObject={}};return t.prototype.getUrl=function(e,t){this._getObjectFromCache(e,function(e,n){if(e){t(e,!1);return}t(!1,n._href)})},t.prototype.getMediaType=function(e,t){this._getObjectFromCache(e,function(e,n){if(e){t(e,!1);return}t(!1,n["_media-type"])})},t.prototype.getInfoObject=function(e,t){this._getObjectFromCache(e,function(e,n){if(e){t(e,!1);return}t(!1,n)})},t.prototype._discoverRoot=function(e,t){if(!this.cacheObject.Root){var n=this;this.connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Root+json"},function(e,r){if(e){t(e,!1);return}n._copyToCache(r.document),t(!1,!0)})}else t(!1,!0)},t.prototype._copyToCache=function(e){for(var t in e)e.hasOwnProperty(t)&&e[t]&&(this.cacheObject[t]=e[t])},t.prototype._getObjectFromCache=function(t,n){var r=null,i=this;if(!this.cacheObject.Root){this._discoverRoot(this.rootPath,function(e,r){if(e){n(e,!1);return}i._getObjectFromCache(t,n)});return}this.cacheObject.Root.hasOwnProperty(t)?r=this.cacheObject.Root[t]:this.cacheObject.hasOwnProperty(t)&&(r=this.cacheObject[t]),r?n(!1,r):n(new e("Discover service failed to find cached object with name '"+t+"'.",{name:t}),!1)},t}),n("structures/ContentCreateStruct",[],function(){var e=function(e,t,n){var r=JSON.parse(JSON.stringify(new Date));return this.body={},this.body.ContentCreate={},this.body.ContentCreate.ContentType={_href:e},this.body.ContentCreate.mainLanguageCode=n,this.body.ContentCreate.LocationCreate=t.body.LocationCreate,this.body.ContentCreate.Section=null,this.body.ContentCreate.alwaysAvailable="true",this.body.ContentCreate.remoteId=null,this.body.ContentCreate.modificationDate=r,this.body.ContentCreate.fields={},this.body.ContentCreate.fields.field=[],this.headers={Accept:"application/vnd.ez.api.Content+json","Content-Type":"application/vnd.ez.api.ContentCreate+json"},this};return e}),n("structures/ContentUpdateStruct",[],function(){var e=function(e){var t=JSON.parse(JSON.stringify(new Date));return this.body={},this.body.VersionUpdate={},this.body.VersionUpdate.modificationDate=t,this.body.VersionUpdate.initialLanguageCode=e,this.body.VersionUpdate.fields={field:[]},this.headers={Accept:"application/vnd.ez.api.Version+json","Content-Type":"application/vnd.ez.api.VersionUpdate+json"},this};return e}),n("structures/SectionInputStruct",[],function(){var e=function(e,t){return this.body={},this.body.SectionInput={},this.body.SectionInput.identifier=e,this.body.SectionInput.name=t,this.headers={},this.headers.Accept="application/vnd.ez.api.Section+json",this.headers["Content-Type"]="application/vnd.ez.api.SectionInput+json",this};return e}),n("structures/LocationCreateStruct",[],function(){var e=function(e){return this.body={},this.body.LocationCreate={},this.body.LocationCreate.ParentLocation={_href:e},this.body.LocationCreate.sortField="PATH",this.body.LocationCreate.sortOrder="ASC",this.headers={Accept:"application/vnd.ez.api.Location+json","Content-Type":"application/vnd.ez.api.LocationCreate+json"},this};return e}),n("structures/LocationUpdateStruct",[],function(){var e=function(){return this.body={},this.body.LocationUpdate={},this.body.LocationUpdate.sortField="PATH",this.body.LocationUpdate.sortOrder="ASC",this.headers={Accept:"application/vnd.ez.api.Location+json","Content-Type":"application/vnd.ez.api.LocationUpdate+json"},this};return e}),n("structures/ContentMetadataUpdateStruct",[],function(){var e=function(e){var t=JSON.parse(JSON.stringify(new Date));return this.body={},this.body.ContentUpdate={},this.body.ContentUpdate.MainLanguageCode=e,this.body.ContentUpdate.Section=null,this.body.ContentUpdate.alwaysAvailable="true",this.body.ContentUpdate.remoteId=null,this.body.ContentUpdate.modificationDate=t,this.body.ContentUpdate.publishDate=null,this.headers={Accept:"application/vnd.ez.api.ContentInfo+json","Content-Type":"application/vnd.ez.api.ContentUpdate+json"},this};return e}),n("structures/ObjectStateGroupCreateStruct",[],function(){var e=function(e,t,n){return this.body={},this.body.ObjectStateGroupCreate={},this.body.ObjectStateGroupCreate.identifier=e,this.body.ObjectStateGroupCreate.defaultLanguageCode=t,this.body.ObjectStateGroupCreate.names={},this.body.ObjectStateGroupCreate.names.value=n,this.body.ObjectStateGroupCreate.descriptions={},this.body.ObjectStateGroupCreate.descriptions.value=[],this.headers={},this.headers.Accept="application/vnd.ez.api.ObjectStateGroup+json",this.headers["Content-Type"]="application/vnd.ez.api.ObjectStateGroupCreate+json",this};return e}),n("structures/ObjectStateGroupUpdateStruct",[],function(){var e=function(){return this.body={},this.body.ObjectStateGroupUpdate={},this.headers={},this.headers.Accept="application/vnd.ez.api.ObjectStateGroup+json",this.headers["Content-Type"]="application/vnd.ez.api.ObjectStateGroupUpdate+json",this};return e}),n("structures/ObjectStateCreateStruct",[],function(){var e=function(e,t,n,r,i){return this.body={},this.body.ObjectStateCreate={},this.body.ObjectStateCreate.identifier=e,this.body.ObjectStateCreate.defaultLanguageCode=t,this.body.ObjectStateCreate.priority=n,this.body.ObjectStateCreate.names={},this.body.ObjectStateCreate.names.value=r,this.body.ObjectStateCreate.descriptions={},this.body.ObjectStateCreate.descriptions.value=i,this.headers={},this.headers.Accept="application/vnd.ez.api.ObjectState+json",this.headers["Content-Type"]="application/vnd.ez.api.ObjectStateCreate+json",this};return e}),n("structures/ObjectStateUpdateStruct",[],function(){var e=function(){return this.body={},this.body.ObjectStateUpdate={},this.headers={},this.headers.Accept="application/vnd.ez.api.ObjectState+json",this.headers["Content-Type"]="application/vnd.ez.api.ObjectStateUpdate+json",this};return e}),n("structures/ViewCreateStruct",[],function(){var e=function(e){return this.body={},this.body.ViewInput={},this.body.ViewInput.identifier=e,this.body.ViewInput.public=!1,this.body.ViewInput.Query={},this.body.ViewInput.Query.Criteria={},this.body.ViewInput.Query.offset=0,this.body.ViewInput.Query.FacetBuilders={},this.body.ViewInput.Query.SortClauses={},this.body.ViewInput.Query.spellcheck=!1,this.headers={Accept:"application/vnd.ez.api.View+json","Content-Type":"application/vnd.ez.api.ViewInput+json"},this};return e}),n("structures/UrlAliasCreateStruct",[],function(){var e=function(e,t,n){return this.body={},this.body.UrlAliasCreate={},this.body.UrlAliasCreate._type="RESOURCE",this.body.UrlAliasCreate.resource=t,this.body.UrlAliasCreate.path=n,this.body.UrlAliasCreate.alwaysAvailable="false",this.body.UrlAliasCreate.forward="false",this.body.UrlAliasCreate.languageCode=e,this.headers={},this.headers.Accept="application/vnd.ez.api.UrlAlias+json",this.headers["Content-Type"]="application/vnd.ez.api.UrlAliasCreate+json",this};return e}),n("structures/UrlWildcardCreateStruct",[],function(){var e=function(e,t,n){return this.body={},this.body.UrlWildcardCreate={},this.body.UrlWildcardCreate.sourceUrl=e,this.body.UrlWildcardCreate.destinationUrl=t,this.body.UrlWildcardCreate.forward=n,this.headers={},this.headers.Accept="application/vnd.ez.api.UrlWildcard+json",this.headers["Content-Type"]="application/vnd.ez.api.UrlWildcardCreate+json",this};return e}),n("structures/RelationCreateStruct",[],function(){var e=function(e){return this.body={},this.body.RelationCreate={},this.body.RelationCreate.Destination={_href:e},this.headers={},this.headers.Accept="application/vnd.ez.api.Relation+json",this.headers["Content-Type"]="application/vnd.ez.api.RelationCreate+json",this};return e}),n("services/ContentService",["structures/ContentCreateStruct","structures/ContentUpdateStruct","structures/SectionInputStruct","structures/LocationCreateStruct","structures/LocationUpdateStruct","structures/ContentMetadataUpdateStruct","structures/ObjectStateGroupCreateStruct","structures/ObjectStateGroupUpdateStruct","structures/ObjectStateCreateStruct","structures/ObjectStateUpdateStruct","structures/ViewCreateStruct","structures/UrlAliasCreateStruct","structures/UrlWildcardCreateStruct","structures/RelationCreateStruct"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p){var d=function(e,t){this._connectionManager=e,this._discoveryService=t};return d.prototype.loadRoot=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Root+json"},t)},d.prototype.newContentUpdateStruct=function(e){return new t(e)},d.prototype.newContentMetadataUpdateStruct=function(e){return new s(e)},d.prototype.newContentCreateStruct=function(t,n,r){return new e(t,n,r)},d.prototype.newSectionInputStruct=function(e,t){return new n(e,t)},d.prototype.newLocationCreateStruct=function(e){return new r(e)},d.prototype.newLocationUpdateStruct=function(){return new i},d.prototype.newViewCreateStruct=function(e){return new l(e)},d.prototype.newRelationCreateStruct=function(e){return new p(e)},d.prototype.newObjectStateGroupCreateStruct=function(e,t,n){return new o(e,t,n)},d.prototype.newObjectStateGroupUpdateStruct=function(){return new u},d.prototype.newObjectStateCreateStruct=function(e,t,n,r,i){return new a(e,t,n,r,i)},d.prototype.newObjectStateUpdateStruct=function(){return new f},d.prototype.newUrlAliasCreateStruct=function(e,t,n){return new c(e,t,n)},d.prototype.newUrlWildcardCreateStruct=function(e,t,n){return new h(e,t,n)},d.prototype.createSection=function(e,t){var n=this;this._discoveryService.getInfoObject("sections",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("POST",i._href,JSON.stringify(e.body),e.headers,t)})},d.prototype.updateSection=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.loadSections=function(e){var t=this;this._discoveryService.getInfoObject("sections",function(n,r){if(n){e(n,!1);return}t._connectionManager.request("GET",r._href,"",{Accept:r["_media-type"]},e)})},d.prototype.loadSection=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Section+json"},t)},d.prototype.deleteSection=function(e,t){this._connectionManager.delete(e,t)},d.prototype.createContent=function(e,t){var n=this;this._discoveryService.getInfoObject("content",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("POST",i._href,JSON.stringify(e.body),e.headers,t)})},d.prototype.updateContentMetadata=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.loadContentByRemoteId=function(e,t){var n=this;this._discoveryService.getInfoObject("content",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("GET",i._href+"?remoteId="+e,"",{Accept:i["_media-type"]},t)})},d.prototype.loadContentInfo=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ContentInfo+json"},t)},d.prototype.loadContentInfoAndCurrentVersion=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Content+json"},t)},d.prototype.deleteContent=function(e,t){this._connectionManager.delete(e,t)},d.prototype.copyContent=function(e,t,n){this._connectionManager.request("COPY",e,"",{Destination:t},n)},d.prototype.loadCurrentVersion=function(e,t){var n=this;this.loadContentInfo(e,function(e,r){if(e){t(e,!1);return}var i=r.document.Content.CurrentVersion;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},d.prototype.loadContent=function(e,t,n,r,i){var s="",o="",u="";arguments.length<5&&(typeof t=="function"?(i=t,t=s,n=o,r=u):typeof n=="function"?(i=n,n=o,r=u):(i=r,r=u)),t&&(t="?fields="+t),n&&(n='&responseGroups="'+n+'"'),r&&(r="&languages="+r),this._connectionManager.request("GET",e+t+n+r,"",{Accept:"application/vnd.ez.api.Version+json"},i)},d.prototype.loadVersions=function(e,t){var n=this;this.loadContentInfo(e,function(e,r){if(e){t(e,!1);return}var i=r.document.Content.Versions;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},d.prototype.updateContent=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.createContentDraft=function(e,t,n){var r=this;this.loadContentInfo(e,function(e,i){var s="";if(e){n(e,!1);return}typeof t!="function"?s=i.document.Content.Versions._href+"/"+t:(n=t,s=i.document.Content.CurrentVersion._href),r._connectionManager.request("COPY",s,"",{Accept:"application/vnd.ez.api.Version+json"},n)})},d.prototype.deleteVersion=function(e,t){this._connectionManager.delete(e,t)},d.prototype.publishVersion=function(e,t){this._connectionManager.request("PUBLISH",e,"",{},t)},d.prototype.createLocation=function(e,t,n){var r=this;this.loadContentInfo(e,function(e,i){if(e){n(e,!1);return}var s=i.document.Content.Locations;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},d.prototype.loadLocations=function(e,t){var n=this;this.loadContentInfo(e,function(e,r){if(e){t(e,!1);return}var i=r.document.Content.Locations;n._connectionManager.request("GET",i._href,"",{Accept:"application/vnd.ez.api.LocationList+json"},t)})},d.prototype.loadLocation=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Location+json"},t)},d.prototype.loadLocationByRemoteId=function(e,t,n){this._connectionManager.request("GET",e+"?remoteId="+t,"",{Accept:"application/vnd.ez.api.Location+json"},n)},d.prototype.updateLocation=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.loadLocationChildren=function(e,t,n,r){var i=this,s=-1,o=0;arguments.length<4&&(typeof t=="function"?(r=t,t=s,n=o):(r=n,n=o)),this.loadLocation(e,function(e,s){if(e){r(e,!1);return}var o=s.document.Location;i._connectionManager.request("GET",o.Children._href+"?offset="+n+"&limit="+t,"",{Accept:o.Children["_media-type"]},r)})},d.prototype.copySubtree=function(e,t,n){this._connectionManager.request("COPY",e,"",{Destination:t},n)},d.prototype.moveSubtree=function(e,t,n){this._connectionManager.request("MOVE",e,"",{Destination:t},n)},d.prototype.swapLocation=function(e,t,n){this._connectionManager.request("SWAP",e,"",{Destination:t},n)},d.prototype.deleteLocation=function(e,t){this._connectionManager.delete(e,t)},d.prototype.createView=function(e,t){var n=this;this._discoveryService.getInfoObject("views",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("POST",i._href,JSON.stringify(e.body),e.headers,t)})},d.prototype.loadRelations=function(e,t,n,r){var i=this,s=-1,o=0;arguments.length<4&&(typeof t=="function"?(r=t,t=s,n=o):(r=n,n=o)),this.loadContent(e,{},function(e,s){if(e){r(e,!1);return}var o=s.document.Version;i._connectionManager.request("GET",o.Relations._href+"?offset="+n+"&limit="+t,"",{Accept:o.Relations["_media-type"]},r)})},d.prototype.loadCurrentRelations=function(e,t,n,r){var i=this,s=-1,o=0;arguments.length<4&&(typeof t=="function"?(r=t,t=s,n=o):(r=n,n=o)),this.loadCurrentVersion(e,function(e,s){if(e){r(e,!1);return}var o=s.document.Version;i._connectionManager.request("GET",o.Relations._href+"?offset="+n+"&limit="+t,"",{Accept:o.Relations["_media-type"]},r)})},d.prototype.loadRelation=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Relation+json"},t)},d.prototype.addRelation=function(e,t,n){var r=this;this.loadContent(e,{},function(e,i){if(e){n(e,!1);return}var s=i.document.Version;r._connectionManager.request("POST",s.Relations._href,JSON.stringify(t.body),t.headers,n)})},d.prototype.deleteRelation=function(e,t){this._connectionManager.delete(e,t)},d.prototype.loadTrashItems=function(e,t,n){var r=this,i=-1,s=0;arguments.length<3&&(typeof e=="function"?(n=e,e=i,t=s):(n=t,t=s)),this._discoveryService.getInfoObject("trash",function(i,s){if(i){n(i,!1);return}r._connectionManager.request("GET",s._href+"?offset="+t+"&limit="+e,"",{Accept:s["_media-type"]},n)})},d.prototype.loadTrashItem=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.TrashItem+json"},t)},d.prototype.recover=function(e,t,n){var r={Accept:"application/vnd.ez.api.TrashItem+json"};typeof t!="function"?r.Destination=t:n=t,this._connectionManager.request("MOVE",e,"",r,n)},d.prototype.deleteTrashItem=function(e,t){this._connectionManager.delete(e,t)},d.prototype.emptyThrash=function(e){var t=this;this._discoveryService.getInfoObject("trash",function(n,r){if(n){e(n,!1);return}t._connectionManager.request("DELETE",r._href,"",{},e)})},d.prototype.loadObjectStateGroups=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ObjectStateGroupList+json"},t)},d.prototype.loadObjectStateGroup=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ObjectStateGroup+json"},t)},d.prototype.createObjectStateGroup=function(e,t,n){this._connectionManager.request("POST",e,JSON.stringify(t.body),t.headers,n)},d.prototype.updateObjectStateGroup=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.deleteObjectStateGroup=function(e,t){this._connectionManager.delete(e,t)},d.prototype.createObjectState=function(e,t,n){this._connectionManager.request("POST",e+"/objectstates",JSON.stringify(t.body),t.headers,n)},d.prototype.loadObjectState=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ObjectState+json"},t)},d.prototype.updateObjectState=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.deleteObjectState=function(e,t){this._connectionManager.delete(e,t)},d.prototype.getContentState=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ContentObjectStates+json"},t)},d.prototype.setContentState=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t),{Accept:"application/vnd.ez.api.ContentObjectStates+json","Content-Type":"application/vnd.ez.api.ContentObjectStates+json"},n)},d.prototype.createUrlAlias=function(e,t,n){this._connectionManager.request("POST",e,JSON.stringify(t.body),t.headers,n)},d.prototype.listGlobalAliases=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.UrlAliasRefList+json"},t)},d.prototype.listLocationAliases=function(e,t,n){var r;arguments.length<3&&(n=t,t=!0),r=t===!0?"":"?custom=false",this._connectionManager.request("GET",e+"/urlaliases"+r,"",{Accept:"application/vnd.ez.api.UrlAliasRefList+json"},n)},d.prototype.loadUrlAlias=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.UrlAlias+json"},t)},d.prototype.deleteUrlAlias=function(e,t){this._connectionManager.delete(e,t)},d.prototype.createUrlWildcard=function(e,t,n){this._connectionManager.request("POST",e,JSON.stringify(t.body),t.headers,n)},d.prototype.loadUrlWildcards=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.UrlWildcardList+json"},t)},d.prototype.loadUrlWildcard=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.UrlWildcard+json"},t)},d.prototype.deleteUrlWildcard=function(e,t){this._connectionManager.delete(e,t)},d}),n("structures/ContentTypeGroupInputStruct",[],function(){var e=function(e){return this.body={},this.body.ContentTypeGroupInput={},this.body.ContentTypeGroupInput.identifier=e,this.headers={},this.headers.Accept="application/vnd.ez.api.ContentTypeGroup+json",this.headers["Content-Type"]="application/vnd.ez.api.ContentTypeGroupInput+json",this};return e}),n("structures/ContentTypeCreateStruct",[],function(){var e=function(e,t,n){var r=JSON.parse(JSON.stringify(new Date));return this.body={},this.body.ContentTypeCreate={},this.body.ContentTypeCreate.identifier=e,this.body.ContentTypeCreate.names={},this.body.ContentTypeCreate.names.value=n,this.body.ContentTypeCreate.nameSchema="<title>",this.body.ContentTypeCreate.urlAliasSchema="<title>",this.body.ContentTypeCreate.remoteId=null,this.body.ContentTypeCreate.mainLanguageCode=t,this.body.ContentTypeCreate.isContainer="true",this.body.ContentTypeCreate.modificationDate=r,this.body.ContentTypeCreate.defalutAlwaysAvailable="true",this.body.ContentTypeCreate.defalutSortField="PATH",this.body.ContentTypeCreate.defalutSortOrder="ASC",this.body.ContentTypeCreate.FieldDefinitions={},this.body.ContentTypeCreate.FieldDefinitions.FieldDefinition=[],this.headers={},this.headers.Accept="application/vnd.ez.api.ContentType+json",this.headers["Content-Type"]="application/vnd.ez.api.ContentTypeCreate+json",this};return e}),n("structures/ContentTypeUpdateStruct",[],function(){var e=function(){return this.body={},this.body.ContentTypeUpdate={},this.headers={},this.headers.Accept="application/vnd.ez.api.ContentType+json",this.headers["Content-Type"]="application/vnd.ez.api.ContentTypeUpdate+json",this};return e}),n("structures/FieldDefinitionCreateStruct",[],function(){var e=function(e,t,n,r){return this.body={},this.body.FieldDefinitionCreate={},this.body.FieldDefinitionCreate.identifier=e,this.body.FieldDefinitionCreate.fieldType=t,this.body.FieldDefinitionCreate.fieldGroup=n,this.body.FieldDefinitionCreate.position=1,this.body.FieldDefinitionCreate.isTranslatable="true",this.body.FieldDefinitionCreate.isRequired="false",this.body.FieldDefinitionCreate.isInfoCollector="false",this.body.FieldDefinitionCreate.isSearchable="false",this.body.FieldDefinitionCreate.defaultValue="false",this.body.FieldDefinitionCreate.names={},this.body.FieldDefinitionCreate.names.value=r,this.body.FieldDefinitionCreate.descriptions={},this.body.FieldDefinitionCreate.descriptions.value=[],this.headers={},this.headers.Accept="application/vnd.ez.api.FieldDefinition+json",this.headers["Content-Type"]="application/vnd.ez.api.FieldDefinitionCreate+json",this};return e}),n("structures/FieldDefinitionUpdateStruct",[],function(){var e=function(){return this.body={},this.body.FieldDefinitionUpdate={},this.headers={},this.headers.Accept="application/vnd.ez.api.FieldDefinition+json",this.headers["Content-Type"]="application/vnd.ez.api.FieldDefinitionUpdate+json",this};return e}),n("services/ContentTypeService",["structures/ContentTypeGroupInputStruct","structures/ContentTypeCreateStruct","structures/ContentTypeUpdateStruct","structures/FieldDefinitionCreateStruct","structures/FieldDefinitionUpdateStruct"],function(e,t,n,r,i){var s=function(e,t){this._connectionManager=e,this._discoveryService=t};return s.prototype.newContentTypeGroupInputStruct=function(t){return new e(t)},s.prototype.newContentTypeCreateStruct=function(e,n,r){return new t(e,n,r)},s.prototype.newContentTypeUpdateStruct=function(){return new n},s.prototype.newFieldDefinitionCreateStruct=function(e,t,n,i){return new r(e,t,n,i)},s.prototype.newFieldDefinitionUpdateStruct=function(){return new i},s.prototype.createContentTypeGroup=function(e,t,n){this._connectionManager.request("POST",e,JSON.stringify(t.body),t.headers,n)},s.prototype.loadContentTypeGroups=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ContentTypeGroupList+json"},t)},s.prototype.loadContentTypeGroup=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ContentTypeGroup+json"},t)},s.prototype.updateContentTypeGroup=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},s.prototype.deleteContentTypeGroup=function(e,t){this._connectionManager.delete(e,t)},s.prototype.loadContentTypes=function(e,t){var n=this;this.loadContentTypeGroup(e,function(e,r){if(e){t(e,!1);return}var i=r.document.ContentTypeGroup;n._connectionManager.request("GET",i.ContentTypes._href,"",{Accept:i.ContentTypes["_media-type"]},t)})},s.prototype.loadContentTypeGroupByIdentifier=function(e,t,n){this._connectionManager.request("GET",e+"?identifier="+t,"",{Accept:"application/vnd.ez.api.ContentTypeGroup+json"},n)},s.prototype.createContentType=function(e,t,n,r){var i=this;this.loadContentTypeGroup(e,function(e,s){if(e){r(e,!1);return}var o=s.document.ContentTypeGroup,u=n===!0?"?publish=true":"";i._connectionManager.request("POST",o.ContentTypes._href+u,JSON.stringify(t.body),t.headers,r)})},s.prototype.copyContentType=function(e,t){this._connectionManager.request("COPY",e,"",{},t)},s.prototype.loadContentType=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ContentType+json"},t)},s.prototype.loadContentTypeByIdentifier=function(e,t){var n=this;this._discoveryService.getInfoObject("contentTypes",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("GET",i._href+"?identifier="+e,"",{Accept:i["_media-type"]},t)})},s.prototype.deleteContentType=function(e,t){this._connectionManager.delete(e,t)},s.prototype.loadGroupsOfContentType=function(e,t){this._connectionManager.request("GET",e+"/groups","",{Accept:"application/vnd.ez.api.ContentTypeGroupRefList+json"},t)},s.prototype.assignContentTypeGroup=function(e,t,n){this._connectionManager.request("POST",e+"/groups"+"?group="+t,"",{},n)},s.prototype.unassignContentTypeGroup=function(e,t){this._connectionManager.delete(e,t)},s.prototype.createContentTypeDraft=function(e,t,n){this._connectionManager.request("POST",e,JSON.stringify(t.body),t.headers,n)},s.prototype.loadContentTypeDraft=function(e,t){this._connectionManager.request("GET",e+"/draft","",{Accept:"application/vnd.ez.api.ContentType+json"},t)},s.prototype.updateContentTypeDraftMetadata=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},s.prototype.publishContentTypeDraft=function(e,t){this._connectionManager.request("PUBLISH",e,"",{},t)},s.prototype.deleteContentTypeDraft=function(e,t){this._connectionManager.delete(e,t)},s.prototype.addFieldDefinition=function(e,t,n){var r=this;this.loadContentTypeDraft(e,function(e,i){if(e){n(e,!1);return}var s=i.document.ContentType.FieldDefinitions;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},s.prototype.loadFieldDefinition=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.FieldDefinition+json"},t)},s.prototype.updateFieldDefinition=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},s.prototype.deleteFieldDefinition=function(e,t){this._connectionManager.delete(e,t)},s}),n("structures/SessionCreateStruct",[],function(){var e=function(e,t){return this.body={},this.body.SessionInput={},this.body.SessionInput.login=e,this.body.SessionInput.password=t,this.headers={Accept:"application/vnd.ez.api.Session+json","Content-Type":"application/vnd.ez.api.SessionInput+json"},this};return e}),n("structures/UserCreateStruct",[],function(){var e=function(e,t,n,r,i){return this.body={},this.body.UserCreate={},this.body.UserCreate.mainLanguageCode=e,this.body.UserCreate.login=t,this.body.UserCreate.email=n,this.body.UserCreate.password=r,this.body.UserCreate.fields={},this.body.UserCreate.fields.field=i,this.headers={},this.headers.Accept="application/vnd.ez.api.User+json",this.headers["Content-Type"]="application/vnd.ez.api.UserCreate+json",this};return e}),n("structures/UserUpdateStruct",[],function(){var e=function(){return this.body={},this.body.UserUpdate={},this.body.UserUpdate.fields={},this.body.UserUpdate.fields.field=[],this.headers={},this.headers.Accept="application/vnd.ez.api.User+json",this.headers["Content-Type"]="application/vnd.ez.api.UserUpdate+json",this};return e}),n("structures/UserGroupCreateStruct",[],function(){var e=function(e,t){return this.body={},this.body.UserGroupCreate={},this.body.UserGroupCreate.mainLanguageCode=e,this.body.UserGroupCreate.fields={},this.body.UserGroupCreate.fields.field=t,this.headers={},this.headers.Accept="application/vnd.ez.api.UserGroup+json",this.headers["Content-Type"]="application/vnd.ez.api.UserGroupCreate+json",this};return e}),n("structures/UserGroupUpdateStruct",[],function(){var e=function(e,t){return this.body={},this.body.UserGroupUpdate={},this.body.UserGroupUpdate.fields={},this.body.UserGroupUpdate.fields.field=[],this.headers={},this.headers.Accept="application/vnd.ez.api.UserGroup+json",this.headers["Content-Type"]="application/vnd.ez.api.UserGroupUpdate+json",this};return e}),n("structures/PolicyCreateStruct",[],function(){var e=function(e,t,n){return this.body={},this.body.PolicyCreate={},this.body.PolicyCreate.module=e,this.body.PolicyCreate.function=t,this.body.PolicyCreate.limitations={},this.body.PolicyCreate.limitations.limitation=n,this.headers={},this.headers.Accept="application/vnd.ez.api.Policy+json",this.headers["Content-Type"]="application/vnd.ez.api.PolicyCreate+json",this};return e}),n("structures/PolicyUpdateStruct",[],function(){var e=function(e){return this.body={},this.body.PolicyUpdate={},this.body.PolicyUpdate.limitations={},this.body.PolicyUpdate.limitations.limitation=e,this.headers={},this.headers.Accept="application/vnd.ez.api.Policy+json",this.headers["Content-Type"]="application/vnd.ez.api.PolicyUpdate+json",this};return e}),n("structures/RoleInputStruct",[],function(){var e=function(e){return this.body={},this.body.RoleInput={},this.body.RoleInput.identifier=e,this.headers={},this.headers.Accept="application/vnd.ez.api.Role+json",this.headers["Content-Type"]="application/vnd.ez.api.RoleInput+json",this};return e}),n("structures/RoleAssignInputStruct",[],function(){var e=function(e,t){return this.body={},this.body.RoleAssignInput={},this.body.RoleAssignInput.Role=e,this.body.RoleAssignInput.limitation=t,this.headers={},this.headers.Accept="application/vnd.ez.api.RoleAssignmentList+json",this.headers["Content-Type"]="application/vnd.ez.api.RoleAssignInput+json",this};return e}),n("services/UserService",["structures/SessionCreateStruct","structures/UserCreateStruct","structures/UserUpdateStruct","structures/UserGroupCreateStruct","structures/UserGroupUpdateStruct","structures/PolicyCreateStruct","structures/PolicyUpdateStruct","structures/RoleInputStruct","structures/RoleAssignInputStruct"],function(e,t,n,r,i,s,o,u,a){var f=function(e,t){this._connectionManager=e,this._discoveryService=t};return f.prototype.newSessionCreateStruct=function(t,n){return new e(t,n)},f.prototype.newUserGroupCreateStruct=function(e,t){return new r(e,t)},f.prototype.newUserGroupUpdateStruct=function(){return new i},f.prototype.newUserCreateStruct=function(e,n,r,i,s){return new t(e,n,r,i,s)},f.prototype.newUserUpdateStruct=function(){return new n},f.prototype.newRoleInputStruct=function(e){return new u(e)},f.prototype.newRoleAssignInputStruct=function(e,t){return new a(e,t)},f.prototype.newPolicyCreateStruct=function(e,t,n){return new s(e,t,n)},f.prototype.newPolicyUpdateStruct=function(e){return new o(e)},f.prototype.loadRootUserGroup=function(e){var t=this;this._discoveryService.getInfoObject("rootUserGroup",function(n,r){if(n){e(n,!1);return}t._connectionManager.request("GET",r._href,"",{Accept:r["_media-type"]},e)})},f.prototype.loadUserGroup=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.UserGroup+json"},t)},f.prototype.loadUserGroupByRemoteId=function(e,t,n){this._connectionManager.request("GET",e+"?remoteId="+t,"",{Accept:"application/vnd.ez.api.UserGroupList+json"},n)},f.prototype.deleteUserGroup=function(e,t){this._connectionManager.delete(e,t)},f.prototype.moveUserGroup=function(e,t,n){this._connectionManager.request("MOVE",e,"",{Destination:t},n)},f.prototype.createUserGroup=function(e,t,n){var r=this;this.loadUserGroup(e,function(e,i){if(e){n(e,!1);return}var s=i.document.UserGroup.Subgroups;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},f.prototype.updateUserGroup=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},f.prototype.loadSubUserGroups=function(e,t){var n=this;this.loadUserGroup(e,function(e,r){if(e){t(e,!1);return}var i=r.document.UserGroup.Subgroups;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},f.prototype.loadUsersOfUserGroup=function(e,t){var n=this;this.loadUserGroup(e,function(e,r){if(e){t(e,!1);return}var i=r.document.UserGroup.Users;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},f.prototype.loadUserGroupsOfUser=function(e,t){this._connectionManager.request("GET",e+"/groups","",{Accept:"application/vnd.ez.api.UserGroupRefList+json"},t)},f.prototype.createUser=function(e,t,n){var r=this;this.loadUserGroup(e,function(e,i){if(e){n(e,!1);return}var s=i.document.UserGroup.Users;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},f.prototype.getRoleAssignments=function(e,t,n){this._connectionManager.request("GET",e+"?roleId="+t,"",{Accept:"application/vnd.ez.api.UserList+json"},n)},f.prototype.loadUser=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.User+json"},t)},f.prototype.updateUser=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},f.prototype.deleteUser=function(e,t){this._connectionManager.delete(e,t)},f.prototype.assignUserToUserGroup=function(e,t,n){var r=this;this.loadUser(e,function(e,i){if(e){n(e,!1);return}var s=i.document.User.UserGroups;r._connectionManager.request("POST",s._href+"?group="+t,"",{Accept:s["_media-type"]},n)})},f.prototype.unassignUserFromUserGroup=function(e,t){this._connectionManager.delete(e,t)},f.prototype.createRole=function(e,t){var n=this;this._discoveryService.getInfoObject("roles",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("POST",i._href,JSON.stringify(e.body),e.headers,t)})},f.prototype.loadRole=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Role+json"},t)},f.prototype.loadRoles=function(e,t,n,r){var i=this,s,o="",u=-1,a=0;arguments.length<4&&(typeof e=="function"?(r=e,e=o,t=u,n=a):typeof t=="function"?(r=t,t=u,n=a):(r=n,n=a)),s=e===""?"":"&identifier="+e,this._discoveryService.getInfoObject("roles",function(e,o){if(e){r(e,!1);return}i._connectionManager.request("GET",o._href+"?offset="+n+"&limit="+t+s,"",{Accept:o["_media-type"]},r)})},f.prototype.updateRole=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},f.prototype.deleteRole=function(e,t){this._connectionManager.delete(e,t)},f.prototype.getRoleAssignmentsForUser=function(e,t){var n=this;this.loadUser(e,function(e,r){if(e){t(e,!1);return}var i=r.document.User.Roles;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},f.prototype.getRoleAssignmentsForUserGroup=function(e,t){var n=this;this.loadUserGroup(e,function(e,r){if(e){t(e,!1);return}var i=r.document.UserGroup.Roles;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},f.prototype.getUserAssignmentObject=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.RoleAssignment+json"},t)},f.prototype.getUserGroupAssignmentObject=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.RoleAssignment+json"},t)},f.prototype.assignRoleToUser=function(e,t,n){var r=this;this.loadUser(e,function(e,i){if(e){n(e,!1);return}var s=i.document.User.Roles;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},f.prototype.assignRoleToUserGroup=function(e,t,n){var r=this;this.loadUserGroup(e,function(e,i){if(e){n(e,!1);return}var s=i.document.UserGroup.Roles;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},f.prototype.unassignRoleFromUser=function(e,t){this._connectionManager.delete(e,t)},f.prototype.unassignRoleFromUserGroup=function(e,t){this._connectionManager.delete(e,t)},f.prototype.addPolicy=function(e,t,n){var r=this;this.loadRole(e,function(e,i){if(e){n(e,!1);return}var s=i.document.Role.Policies;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},f.prototype.loadPolicies=function(e,t){var n=this;this.loadRole(e,function(e,r){if(e){t(e,!1);return}var i=r.document.Role.Policies;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},f.prototype.loadPolicy=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Policy+json"},t)},f.prototype.updatePolicy=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},f.prototype.deletePolicy=function(e,t){this._connectionManager.delete(e,t)},f.prototype.loadPoliciesByUserId=function(e,t,n){this._connectionManager.request("GET",e+"?userId="+t,"",{Accept:"application/vnd.ez.api.PolicyList+json"},n)},f.prototype.createSession=function(e,t,n){this._connectionManager.notAuthorizedRequest("POST",e,JSON.stringify(t.body),t.headers,n)},f.prototype.deleteSession=function(e,t){this._connectionManager.delete(e,t)},f.prototype.logOut=function(e){this._connectionManager.logOut(e)},f}),n("CAPI",["authAgents/SessionAuthAgent","authAgents/HttpBasicAuthAgent","ConnectionManager","ConnectionFeatureFactory","connections/XmlHttpRequestConnection","connections/MicrosoftXmlHttpRequestConnection","services/DiscoveryService","services/ContentService","services/ContentTypeService","services/UserService"],function(e,t,n,r,i,s,o,u,a,f){var l=function(e,t,l){var c={logRequests:!1,rootPath:"/api/ezp/v2/",connectionStack:[{connection:i},{connection:s}]},h=c,p,d,v,m;this._contentService=null,this._contentTypeService=null,this._userService=null,t.setCAPI(this);if(typeof l=="object")for(p in l)l.hasOwnProperty(p)&&(h[p]=l[p]);d=new r(h.connectionStack),v=new n(e,t,d),v.logRequests=h.logRequests,m=new o(h.rootPath,v),this.getContentService=function(){return this._contentService||(this._contentService=new u(v,m)),this._contentService},this.getContentTypeService=function(){return this._contentTypeService||(this._contentTypeService=new a(v,m)),this._contentTypeService},this.getUserService=function(){return this._userService||(this._userService=new f(v,m)),this._userService}};return l}),function(e){if(typeof bootstrap=="function")bootstrap("promise",e);else if(typeof exports=="object")module.exports=e();else if(typeof n=="function"&&n.amd)n("services/../../node_modules/q/q",e);else if(typeof ses!="undefined"){if(!ses.ok())return;ses.makeQ=e}else Q=e()}(function(){function u(e){return function(){return o.apply(e,arguments)}}function m(e){return e===Object(e)}function g(e){return v(e)==="[object StopIteration]"||e instanceof y}function E(t,n){if(e&&n.stack&&typeof t=="object"&&t!==null&&t.stack&&t.stack.indexOf(w)===-1){var r=[];for(var i=n;!!i;i=i.source)i.stack&&r.unshift(i.stack);r.unshift(t.stack);var s=r.join("\n"+w+"\n");t.stack=S(s)}}function S(e){var t=e.split("\n"),n=[];for(var r=0;r=n&&s<=lt}function C(){if(!e)return;try{throw new Error}catch(t){var n=t.stack.split("\n"),i=n[0].indexOf("@")>0?n[1]:n[2],s=T(i);if(!s)return;return r=s[0],s[1]}}function k(e,t,n){return function(){return typeof console!="undefined"&&typeof console.warn=="function"&&console.warn(t+" is deprecated, use "+n+" instead.",(new Error("")).stack),e.apply(e,arguments)}}function L(e){return H(e)?e:B(e)?G(e):Q(e)}function A(){function l(e){r=e,o.source=e,f(t,function(t,n){s(function(){e.promiseDispatch.apply(e,n)})},void 0),t=void 0,n=void 0}var t=[],n=[],r,i=h(A.prototype),o=h(_.prototype);o.promiseDispatch=function(e,i,o){var u=a(arguments);t?(t.push(u),i==="when"&&o[1]&&n.push(o[1])):s(function(){r.promiseDispatch.apply(r,u)})},o.valueOf=k(function(){if(t)return o;var e=P(r);return H(e)&&(r=e),e},"valueOf","inspect"),o.inspect=function(){return r?r.inspect():{state:"pending"}};if(L.longStackSupport&&e)try{throw new Error}catch(u){o.stack=u.stack.substring(u.stack.indexOf("\n")+1)}return i.promise=o,i.resolve=function(e){if(r)return;l(L(e))},i.fulfill=function(e){if(r)return;l(Q(e))},i.reject=function(e){if(r)return;l(K(e))},i.notify=function(e){if(r)return;f(n,function(t,n){s(function(){n(e)})},void 0)},i}function O(e){if(typeof e!="function")throw new TypeError("resolver must be a function.");var t=A();try{e(t.resolve,t.reject,t.notify)}catch(n){t.reject(n)}return t.promise}function M(e){return O(function(t,n){for(var r=0,i=e.length;r=r)throw new TypeError}while(1);for(;n2?e.resolve(a(arguments,1)):e.resolve(n)}},L.promise=O,L.passByCopy=function(e){return e},_.prototype.passByCopy=function(){return this},L.join=function(e,t){return L(e).join(t)},_.prototype.join=function(e){return L([this,e]).spread(function(e,t){if(e===t)return e;throw new Error("Can't join: not the same: "+e+" "+t)})},L.race=M,_.prototype.race=function(){return this.then(L.race)},L.makePromise=_,_.prototype.toString=function(){return"[object Promise]"},_.prototype.then=function(e,t,n){function u(t){try{return typeof e=="function"?e(t):t}catch(n){return K(n)}}function a(e){if(typeof t=="function"){E(e,r);try{return t(e)}catch(n){return K(n)}}return K(e)}function f(e){return typeof n=="function"?n(e):e}var r=this,i=A(),o=!1;return s(function(){r.promiseDispatch(function(e){if(o)return;o=!0,i.resolve(u(e))},"when",[function(e){if(o)return;o=!0,i.resolve(a(e))}])}),r.promiseDispatch(void 0,"when",[void 0,function(e){var t,n=!1;try{t=f(e)}catch(r){n=!0;if(!L.onerror)throw r;L.onerror(r)}n||i.notify(t)}]),i.promise},L.when=D,_.prototype.thenResolve=function(e){return this.then(function(){return e})},L.thenResolve=function(e,t){return L(e).thenResolve(t)},_.prototype.thenReject=function(e){return this.then(function(){throw e})},L.thenReject=function(e,t){return L(e).thenReject(t)},L.nearer=P,L.isPromise=H,L.isPromiseAlike=B,L.isPending=j,_.prototype.isPending=function(){return this.inspect().state==="pending"},L.isFulfilled=F,_.prototype.isFulfilled=function(){return this.inspect().state==="fulfilled"},L.isRejected=I,_.prototype.isRejected=function(){return this.inspect().state==="rejected"};var q=[],R=[],U=!1,z=!0;L.resetUnhandledRejections=V,L.getUnhandledReasons=function(){return q.slice()},L.stopUnhandledRejectionTracking=function(){V(),typeof process!="undefined"&&process.on&&process.removeListener("exit",X),z=!1},V(),L.reject=K,L.fulfill=Q,L.master=Y,L.spread=Z,_.prototype.spread=function(e,t){return this.all().then(function(t){return e.apply(void 0,t)},t)},L.async=et,L.spawn=tt,L["return"]=nt,L.promised=rt,L.dispatch=it,_.prototype.dispatch=function(e,t){var n=this,r=A();return s(function(){n.promiseDispatch(r.resolve,e,t)}),r.promise},L.get=function(e,t){return L(e).dispatch("get",[t])},_.prototype.get=function(e){return this.dispatch("get",[e])},L.set=function(e,t,n){return L(e).dispatch("set",[t,n])},_.prototype.set=function(e,t){return this.dispatch("set",[e,t])},L.del=L["delete"]=function(e,t){return L(e).dispatch("delete",[t])},_.prototype.del=_.prototype["delete"]=function(e){return this.dispatch("delete",[e])},L.mapply=L.post=function(e,t,n){return L(e).dispatch("post",[t,n])},_.prototype.mapply=_.prototype.post=function(e,t){return this.dispatch("post",[e,t])},L.send=L.mcall=L.invoke=function(e,t){return L(e).dispatch("post",[t,a(arguments,2)])},_.prototype.send=_.prototype.mcall=_.prototype.invoke=function(e){return this.dispatch("post",[e,a(arguments,1)])},L.fapply=function(e,t){return L(e).dispatch("apply",[void 0,t])},_.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},L["try"]=L.fcall=function(e){return L(e).dispatch("apply",[void 0,a(arguments,1)])},_.prototype.fcall=function(){return this.dispatch("apply",[void 0,a(arguments)])},L.fbind=function(e){var t=L(e),n=a(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(a(arguments))])}},_.prototype.fbind=function(){var e=this,t=a(arguments);return function(){return e.dispatch("apply",[this,t.concat(a(arguments))])}},L.keys=function(e){return L(e).dispatch("keys",[])},_.prototype.keys=function(){return this.dispatch("keys",[])},L.all=st,_.prototype.all=function(){return st(this)},L.allResolved=k(ot,"allResolved","allSettled"),_.prototype.allResolved=function(){return ot(this)},L.allSettled=ut,_.prototype.allSettled=function(){return this.then(function(e){return st(c(e,function(e){function t(){return e.inspect()}return e=L(e),e.then(t,t)}))})},L.fail=L["catch"]=function(e,t){return L(e).then(void 0,t)},_.prototype.fail=_.prototype["catch"]=function(e){return this.then(void 0,e)},L.progress=at,_.prototype.progress=function(e){return this.then(void 0,void 0,e)},L.fin=L["finally"]=function(e,t){return L(e)["finally"](t)},_.prototype.fin=_.prototype["finally"]=function(e){return e=L(e),this.then(function(t){return e.fcall().then(function(){return t})},function(t){return e.fcall().then(function(){throw t})})},L.done=function(e,t,n,r){return L(e).done(t,n,r)},_.prototype.done=function(e,t,n){var r=function(e){s(function(){E(e,i);if(!L.onerror)throw e;L.onerror(e)})},i=e||t||n?this.then(e,t,n):this;typeof process=="object"&&process&&process.domain&&(r=process.domain.bind(r)),i.then(void 0,r)},L.timeout=function(e,t,n){return L(e).timeout(t,n)},_.prototype.timeout=function(e,t){var n=A(),r=setTimeout(function(){n.reject(new Error(t||"Timed out after "+e+" ms"))},e);return this.then(function(e){clearTimeout(r),n.resolve(e)},function(e){clearTimeout(r),n.reject(e)},n.notify),n.promise},L.delay=function(e,t){return t===void 0&&(t=e,e=void 0),L(e).delay(t)},_.prototype.delay=function(e){return this.then(function(t){var n=A();return setTimeout(function(){n.resolve(t)},e),n.promise})},L.nfapply=function(e,t){return L(e).nfapply(t)},_.prototype.nfapply=function(e){var t=A(),n=a(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise},L.nfcall=function(e){var t=a(arguments,1);return L(e).nfapply(t)},_.prototype.nfcall=function(){var e=a(arguments),t=A();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},L.nfbind=L.denodeify=function(e){var t=a(arguments,1);return function(){var n=t.concat(a(arguments)),r=A();return n.push(r.makeNodeResolver()),L(e).fapply(n).fail(r.reject),r.promise}},_.prototype.nfbind=_.prototype.denodeify=function(){var e=a(arguments);return e.unshift(this),L.denodeify.apply(void 0,e)},L.nbind=function(e,t){var n=a(arguments,2);return function(){function s(){return e.apply(t,arguments)}var r=n.concat(a(arguments)),i=A();return r.push(i.makeNodeResolver()),L(s).fapply(r).fail(i.reject),i.promise}},_.prototype.nbind=function(){var e=a(arguments,0);return e.unshift(this),L.nbind.apply(void 0,e)},L.nmapply=L.npost=function(e,t,n){return L(e).npost(t,n)},_.prototype.nmapply=_.prototype.npost=function(e,t){var n=a(t||[]),r=A();return n.push(r.makeNodeResolver()),this.dispatch("post",[e,n]).fail(r.reject),r.promise},L.nsend=L.nmcall=L.ninvoke=function(e,t){var n=a(arguments,2),r=A();return n.push(r.makeNodeResolver()),L(e).dispatch("post",[t,n]).fail(r.reject),r.promise},_.prototype.nsend=_.prototype.nmcall=_.prototype.ninvoke=function(e){var t=a(arguments,1),n=A();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},L.nodeify=ft,_.prototype.nodeify=function(e){if(!e)return this;this.then(function(t){s(function(){e(null,t)})},function(t){s(function(){e(t)})})};var lt=C();return L}),n("services/PromiseService",["../../node_modules/q/q","structures/CAPIError"],function(e,t){var n=function(n){var r;this._generatePromiseFunction=function(r){return function(){var i=Array.prototype.slice.call(arguments),s=e.defer();if(r.length-1!==arguments.length)throw new t("Wrong number of arguments provided for promise-based function.");return i.push(function(e,t){e?s.reject(e):s.resolve(t)}),r.apply(n,i),s.promise}};for(r in n)typeof n[r]=="function"&&!/^(new[^\s(]+Struct)/.test(r)&&(this[r]=this._generatePromiseFunction(n[r]))};return n}),n("PromiseCAPI",["CAPI","services/PromiseService"],function(e,t){var n=function(e){var n;this._services=[],this._getPromiseService=function(n){return function(){return this._services[n]||(this._services[n]=new t(e[n].call(e))),this._services[n]}};for(n in e)typeof e[n]=="function"&&/^(get[^\s(]+Service)/.test(n)&&(this[n]=this._getPromiseService(n))};return n}),window.eZ=window.eZ||{},window.eZ.HttpBasicAuthAgent=t("authAgents/HttpBasicAuthAgent"),window.eZ.SessionAuthAgent=t("authAgents/SessionAuthAgent"),window.eZ.CAPI=t("CAPI"),window.eZ.PromiseCAPI=t("PromiseCAPI")}); \ No newline at end of file +(function(e,t){typeof define=="function"&&define.amd?define(t):e.libGlobalName=t()})(this,function(){var e,t,n;(function(r){function d(e,t){return h.call(e,t)}function v(e,t){var n,r,i,s,o,u,a,f,c,h,p=t&&t.split("/"),d=l.map,v=d&&d["*"]||{};if(e&&e.charAt(0)===".")if(t){p=p.slice(0,p.length-1),e=p.concat(e.split("/"));for(f=0;f0&&(e.splice(f-1,2),f-=2)}}e=e.join("/")}else e.indexOf("./")===0&&(e=e.substring(2));if((p||v)&&d){n=e.split("/");for(f=n.length;f>0;f-=1){r=n.slice(0,f).join("/");if(p)for(c=p.length;c>0;c-=1){i=d[p.slice(0,c).join("/")];if(i){i=i[r];if(i){s=i,o=f;break}}}if(s)break;!u&&v&&v[r]&&(u=v[r],a=f)}!s&&u&&(s=u,o=a),s&&(n.splice(0,o,s),e=n.join("/"))}return e}function m(e,t){return function(){return s.apply(r,p.call(arguments,0).concat([e,t]))}}function g(e){return function(t){return v(t,e)}}function y(e){return function(t){a[e]=t}}function b(e){if(d(f,e)){var t=f[e];delete f[e],c[e]=!0,i.apply(r,t)}if(!d(a,e)&&!d(c,e))throw new Error("No "+e);return a[e]}function w(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function E(e){return function(){return l&&l.config&&l.config[e]||{}}}var i,s,o,u,a={},f={},l={},c={},h=Object.prototype.hasOwnProperty,p=[].slice;o=function(e,t){var n,r=w(e),i=r[0];return e=r[1],i&&(i=v(i,t),n=b(i)),i?n&&n.normalize?e=n.normalize(e,g(t)):e=v(e,t):(e=v(e,t),r=w(e),i=r[0],e=r[1],i&&(n=b(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},u={require:function(e){return m(e)},exports:function(e){var t=a[e];return typeof t!="undefined"?t:a[e]={}},module:function(e){return{id:e,uri:"",exports:a[e],config:E(e)}}},i=function(e,t,n,i){var s,l,h,p,v,g=[],w;i=i||e;if(typeof n=="function"){t=!t.length&&n.length?["require","exports","module"]:t;for(v=0;v=400){r(new t("Connection error : "+i.status+".",{errorCode:i.status,xhr:i}),!1);return}r(!1,new e({status:i.status,headers:i.getAllResponseHeaders(),body:i.responseText}))},n.httpBasicAuth?i.open(n.method,n.url,!0,n.login,n.password):i.open(n.method,n.url,!0);for(s in n.headers)n.headers.hasOwnProperty(s)&&i.setRequestHeader(s,n.headers[s]);i.send(n.body)}};return n.isCompatible=function(){return!!window.XMLHttpRequest},n}),n("connections/MicrosoftXmlHttpRequestConnection",["structures/Response","structures/CAPIError"],function(e,t){var n=function(){this._xhr=new ActiveXObject("Microsoft.XMLHTTP"),this.execute=function(n,r){var i=this._xhr,s;i.onreadystatechange=function(){if(i.readyState!=4)return;if(i.status>=400){r(new t("Connection error : "+i.status+".",{errorCode:i.status,xhr:i}),!1);return}r(!1,new e({status:i.status,headers:i.getAllResponseHeaders(),body:i.responseText}))},n.httpBasicAuth?i.open(n.method,n.url,!0,n.login,n.password):i.open(n.method,n.url,!0);for(s in n.headers)n.headers.hasOwnProperty(s)&&i.setRequestHeader(s,n.headers[s]);i.send(n.body)}};return n.isCompatible=function(){return!!window.ActiveXObject},n}),n("services/DiscoveryService",["structures/CAPIError"],function(e){var t=function(e,t){this.connectionManager=t,this.rootPath=e,this.cacheObject={}};return t.prototype.getUrl=function(e,t){this._getObjectFromCache(e,function(e,n){if(e){t(e,!1);return}t(!1,n._href)})},t.prototype.getMediaType=function(e,t){this._getObjectFromCache(e,function(e,n){if(e){t(e,!1);return}t(!1,n["_media-type"])})},t.prototype.getInfoObject=function(e,t){this._getObjectFromCache(e,function(e,n){if(e){t(e,!1);return}t(!1,n)})},t.prototype._discoverRoot=function(e,t){if(!this.cacheObject.Root){var n=this;this.connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Root+json"},function(e,r){if(e){t(e,!1);return}n._copyToCache(r.document),t(!1,!0)})}else t(!1,!0)},t.prototype._copyToCache=function(e){for(var t in e)e.hasOwnProperty(t)&&e[t]&&(this.cacheObject[t]=e[t])},t.prototype._getObjectFromCache=function(t,n){var r=null,i=this;if(!this.cacheObject.Root){this._discoverRoot(this.rootPath,function(e,r){if(e){n(e,!1);return}i._getObjectFromCache(t,n)});return}this.cacheObject.Root.hasOwnProperty(t)?r=this.cacheObject.Root[t]:this.cacheObject.hasOwnProperty(t)&&(r=this.cacheObject[t]),r?n(!1,r):n(new e("Discover service failed to find cached object with name '"+t+"'.",{name:t}),!1)},t}),n("structures/ContentCreateStruct",[],function(){var e=function(e,t,n){var r=JSON.parse(JSON.stringify(new Date));return this.body={},this.body.ContentCreate={},this.body.ContentCreate.ContentType={_href:e},this.body.ContentCreate.mainLanguageCode=n,this.body.ContentCreate.LocationCreate=t.body.LocationCreate,this.body.ContentCreate.Section=null,this.body.ContentCreate.alwaysAvailable="true",this.body.ContentCreate.remoteId=null,this.body.ContentCreate.modificationDate=r,this.body.ContentCreate.fields={},this.body.ContentCreate.fields.field=[],this.headers={Accept:"application/vnd.ez.api.Content+json","Content-Type":"application/vnd.ez.api.ContentCreate+json"},this};return e}),n("structures/ContentUpdateStruct",[],function(){var e=function(e){var t=JSON.parse(JSON.stringify(new Date));return this.body={},this.body.VersionUpdate={},this.body.VersionUpdate.modificationDate=t,this.body.VersionUpdate.initialLanguageCode=e,this.body.VersionUpdate.fields={field:[]},this.headers={Accept:"application/vnd.ez.api.Version+json","Content-Type":"application/vnd.ez.api.VersionUpdate+json"},this};return e}),n("structures/SectionInputStruct",[],function(){var e=function(e,t){return this.body={},this.body.SectionInput={},this.body.SectionInput.identifier=e,this.body.SectionInput.name=t,this.headers={},this.headers.Accept="application/vnd.ez.api.Section+json",this.headers["Content-Type"]="application/vnd.ez.api.SectionInput+json",this};return e}),n("structures/LocationCreateStruct",[],function(){var e=function(e){return this.body={},this.body.LocationCreate={},this.body.LocationCreate.ParentLocation={_href:e},this.body.LocationCreate.sortField="PATH",this.body.LocationCreate.sortOrder="ASC",this.headers={Accept:"application/vnd.ez.api.Location+json","Content-Type":"application/vnd.ez.api.LocationCreate+json"},this};return e}),n("structures/LocationUpdateStruct",[],function(){var e=function(){return this.body={},this.body.LocationUpdate={},this.body.LocationUpdate.sortField="PATH",this.body.LocationUpdate.sortOrder="ASC",this.headers={Accept:"application/vnd.ez.api.Location+json","Content-Type":"application/vnd.ez.api.LocationUpdate+json"},this};return e}),n("structures/ContentMetadataUpdateStruct",[],function(){var e=function(e){var t=JSON.parse(JSON.stringify(new Date));return this.body={},this.body.ContentUpdate={},this.body.ContentUpdate.MainLanguageCode=e,this.body.ContentUpdate.Section=null,this.body.ContentUpdate.alwaysAvailable="true",this.body.ContentUpdate.remoteId=null,this.body.ContentUpdate.modificationDate=t,this.body.ContentUpdate.publishDate=null,this.headers={Accept:"application/vnd.ez.api.ContentInfo+json","Content-Type":"application/vnd.ez.api.ContentUpdate+json"},this};return e}),n("structures/ObjectStateGroupCreateStruct",[],function(){var e=function(e,t,n){return this.body={},this.body.ObjectStateGroupCreate={},this.body.ObjectStateGroupCreate.identifier=e,this.body.ObjectStateGroupCreate.defaultLanguageCode=t,this.body.ObjectStateGroupCreate.names={},this.body.ObjectStateGroupCreate.names.value=n,this.body.ObjectStateGroupCreate.descriptions={},this.body.ObjectStateGroupCreate.descriptions.value=[],this.headers={},this.headers.Accept="application/vnd.ez.api.ObjectStateGroup+json",this.headers["Content-Type"]="application/vnd.ez.api.ObjectStateGroupCreate+json",this};return e}),n("structures/ObjectStateGroupUpdateStruct",[],function(){var e=function(){return this.body={},this.body.ObjectStateGroupUpdate={},this.headers={},this.headers.Accept="application/vnd.ez.api.ObjectStateGroup+json",this.headers["Content-Type"]="application/vnd.ez.api.ObjectStateGroupUpdate+json",this};return e}),n("structures/ObjectStateCreateStruct",[],function(){var e=function(e,t,n,r,i){return this.body={},this.body.ObjectStateCreate={},this.body.ObjectStateCreate.identifier=e,this.body.ObjectStateCreate.defaultLanguageCode=t,this.body.ObjectStateCreate.priority=n,this.body.ObjectStateCreate.names={},this.body.ObjectStateCreate.names.value=r,this.body.ObjectStateCreate.descriptions={},this.body.ObjectStateCreate.descriptions.value=i,this.headers={},this.headers.Accept="application/vnd.ez.api.ObjectState+json",this.headers["Content-Type"]="application/vnd.ez.api.ObjectStateCreate+json",this};return e}),n("structures/ObjectStateUpdateStruct",[],function(){var e=function(){return this.body={},this.body.ObjectStateUpdate={},this.headers={},this.headers.Accept="application/vnd.ez.api.ObjectState+json",this.headers["Content-Type"]="application/vnd.ez.api.ObjectStateUpdate+json",this};return e}),n("structures/ViewCreateStruct",[],function(){var e=function(e){return this.body={},this.body.ViewInput={},this.body.ViewInput.identifier=e,this.body.ViewInput.public=!1,this.body.ViewInput.Query={},this.body.ViewInput.Query.Criteria={},this.body.ViewInput.Query.offset=0,this.body.ViewInput.Query.FacetBuilders={},this.body.ViewInput.Query.SortClauses={},this.body.ViewInput.Query.spellcheck=!1,this.headers={Accept:"application/vnd.ez.api.View+json","Content-Type":"application/vnd.ez.api.ViewInput+json"},this};return e}),n("structures/UrlAliasCreateStruct",[],function(){var e=function(e,t,n){return this.body={},this.body.UrlAliasCreate={},this.body.UrlAliasCreate._type="RESOURCE",this.body.UrlAliasCreate.resource=t,this.body.UrlAliasCreate.path=n,this.body.UrlAliasCreate.alwaysAvailable="false",this.body.UrlAliasCreate.forward="false",this.body.UrlAliasCreate.languageCode=e,this.headers={},this.headers.Accept="application/vnd.ez.api.UrlAlias+json",this.headers["Content-Type"]="application/vnd.ez.api.UrlAliasCreate+json",this};return e}),n("structures/UrlWildcardCreateStruct",[],function(){var e=function(e,t,n){return this.body={},this.body.UrlWildcardCreate={},this.body.UrlWildcardCreate.sourceUrl=e,this.body.UrlWildcardCreate.destinationUrl=t,this.body.UrlWildcardCreate.forward=n,this.headers={},this.headers.Accept="application/vnd.ez.api.UrlWildcard+json",this.headers["Content-Type"]="application/vnd.ez.api.UrlWildcardCreate+json",this};return e}),n("structures/RelationCreateStruct",[],function(){var e=function(e){return this.body={},this.body.RelationCreate={},this.body.RelationCreate.Destination={_href:e},this.headers={},this.headers.Accept="application/vnd.ez.api.Relation+json",this.headers["Content-Type"]="application/vnd.ez.api.RelationCreate+json",this};return e}),n("services/ContentService",["structures/ContentCreateStruct","structures/ContentUpdateStruct","structures/SectionInputStruct","structures/LocationCreateStruct","structures/LocationUpdateStruct","structures/ContentMetadataUpdateStruct","structures/ObjectStateGroupCreateStruct","structures/ObjectStateGroupUpdateStruct","structures/ObjectStateCreateStruct","structures/ObjectStateUpdateStruct","structures/ViewCreateStruct","structures/UrlAliasCreateStruct","structures/UrlWildcardCreateStruct","structures/RelationCreateStruct"],function(e,t,n,r,i,s,o,u,a,f,l,c,h,p){var d=function(e,t){this._connectionManager=e,this._discoveryService=t};return d.prototype.loadRoot=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Root+json"},t)},d.prototype.newContentUpdateStruct=function(e){return new t(e)},d.prototype.newContentMetadataUpdateStruct=function(e){return new s(e)},d.prototype.newContentCreateStruct=function(t,n,r){return new e(t,n,r)},d.prototype.newSectionInputStruct=function(e,t){return new n(e,t)},d.prototype.newLocationCreateStruct=function(e){return new r(e)},d.prototype.newLocationUpdateStruct=function(){return new i},d.prototype.newViewCreateStruct=function(e){return new l(e)},d.prototype.newRelationCreateStruct=function(e){return new p(e)},d.prototype.newObjectStateGroupCreateStruct=function(e,t,n){return new o(e,t,n)},d.prototype.newObjectStateGroupUpdateStruct=function(){return new u},d.prototype.newObjectStateCreateStruct=function(e,t,n,r,i){return new a(e,t,n,r,i)},d.prototype.newObjectStateUpdateStruct=function(){return new f},d.prototype.newUrlAliasCreateStruct=function(e,t,n){return new c(e,t,n)},d.prototype.newUrlWildcardCreateStruct=function(e,t,n){return new h(e,t,n)},d.prototype.createSection=function(e,t){var n=this;this._discoveryService.getInfoObject("sections",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("POST",i._href,JSON.stringify(e.body),e.headers,t)})},d.prototype.updateSection=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.loadSections=function(e){var t=this;this._discoveryService.getInfoObject("sections",function(n,r){if(n){e(n,!1);return}t._connectionManager.request("GET",r._href,"",{Accept:r["_media-type"]},e)})},d.prototype.loadSection=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Section+json"},t)},d.prototype.deleteSection=function(e,t){this._connectionManager.delete(e,t)},d.prototype.createContent=function(e,t){var n=this;this._discoveryService.getInfoObject("content",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("POST",i._href,JSON.stringify(e.body),e.headers,t)})},d.prototype.updateContentMetadata=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.loadContentByRemoteId=function(e,t){var n=this;this._discoveryService.getInfoObject("content",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("GET",i._href+"?remoteId="+e,"",{Accept:i["_media-type"]},t)})},d.prototype.loadContentInfo=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ContentInfo+json"},t)},d.prototype.loadContentInfoAndCurrentVersion=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Content+json"},t)},d.prototype.deleteContent=function(e,t){this._connectionManager.delete(e,t)},d.prototype.copyContent=function(e,t,n){this._connectionManager.request("COPY",e,"",{Destination:t},n)},d.prototype.loadCurrentVersion=function(e,t){var n=this;this.loadContentInfo(e,function(e,r){if(e){t(e,!1);return}var i=r.document.Content.CurrentVersion;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},d.prototype.loadContent=function(e,t,n,r,i){var s="",o="",u="";arguments.length<5&&(typeof t=="function"?(i=t,t=s,n=o,r=u):typeof n=="function"?(i=n,n=o,r=u):(i=r,r=u)),t&&(t="?fields="+t),n&&(n='&responseGroups="'+n+'"'),r&&(r="&languages="+r),this._connectionManager.request("GET",e+t+n+r,"",{Accept:"application/vnd.ez.api.Version+json"},i)},d.prototype.loadVersions=function(e,t){var n=this;this.loadContentInfo(e,function(e,r){if(e){t(e,!1);return}var i=r.document.Content.Versions;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},d.prototype.updateContent=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.createContentDraft=function(e,t,n){var r=this;this.loadContentInfo(e,function(e,i){var s="";if(e){n(e,!1);return}typeof t!="function"?s=i.document.Content.Versions._href+"/"+t:(n=t,s=i.document.Content.CurrentVersion._href),r._connectionManager.request("COPY",s,"",{Accept:"application/vnd.ez.api.Version+json"},n)})},d.prototype.deleteVersion=function(e,t){this._connectionManager.delete(e,t)},d.prototype.publishVersion=function(e,t){this._connectionManager.request("PUBLISH",e,"",{},t)},d.prototype.createLocation=function(e,t,n){var r=this;this.loadContentInfo(e,function(e,i){if(e){n(e,!1);return}var s=i.document.Content.Locations;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},d.prototype.loadLocations=function(e,t){var n=this;this.loadContentInfo(e,function(e,r){if(e){t(e,!1);return}var i=r.document.Content.Locations;n._connectionManager.request("GET",i._href,"",{Accept:"application/vnd.ez.api.LocationList+json"},t)})},d.prototype.loadLocation=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Location+json"},t)},d.prototype.loadLocationByRemoteId=function(e,t,n){this._connectionManager.request("GET",e+"?remoteId="+t,"",{Accept:"application/vnd.ez.api.Location+json"},n)},d.prototype.updateLocation=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.loadLocationChildren=function(e,t,n,r){var i=this,s=-1,o=0;arguments.length<4&&(typeof t=="function"?(r=t,t=s,n=o):(r=n,n=o)),this.loadLocation(e,function(e,s){if(e){r(e,!1);return}var o=s.document.Location;i._connectionManager.request("GET",o.Children._href+"?offset="+n+"&limit="+t,"",{Accept:o.Children["_media-type"]},r)})},d.prototype.copySubtree=function(e,t,n){this._connectionManager.request("COPY",e,"",{Destination:t},n)},d.prototype.moveSubtree=function(e,t,n){this._connectionManager.request("MOVE",e,"",{Destination:t},n)},d.prototype.swapLocation=function(e,t,n){this._connectionManager.request("SWAP",e,"",{Destination:t},n)},d.prototype.deleteLocation=function(e,t){this._connectionManager.delete(e,t)},d.prototype.createView=function(e,t){var n=this;this._discoveryService.getInfoObject("views",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("POST",i._href,JSON.stringify(e.body),e.headers,t)})},d.prototype.loadRelations=function(e,t,n,r){var i=this,s=-1,o=0;arguments.length<4&&(typeof t=="function"?(r=t,t=s,n=o):(r=n,n=o)),this.loadContent(e,{},function(e,s){if(e){r(e,!1);return}var o=s.document.Version;i._connectionManager.request("GET",o.Relations._href+"?offset="+n+"&limit="+t,"",{Accept:o.Relations["_media-type"]},r)})},d.prototype.loadCurrentRelations=function(e,t,n,r){var i=this,s=-1,o=0;arguments.length<4&&(typeof t=="function"?(r=t,t=s,n=o):(r=n,n=o)),this.loadCurrentVersion(e,function(e,s){if(e){r(e,!1);return}var o=s.document.Version;i._connectionManager.request("GET",o.Relations._href+"?offset="+n+"&limit="+t,"",{Accept:o.Relations["_media-type"]},r)})},d.prototype.loadRelation=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Relation+json"},t)},d.prototype.addRelation=function(e,t,n){var r=this;this.loadContent(e,{},function(e,i){if(e){n(e,!1);return}var s=i.document.Version;r._connectionManager.request("POST",s.Relations._href,JSON.stringify(t.body),t.headers,n)})},d.prototype.deleteRelation=function(e,t){this._connectionManager.delete(e,t)},d.prototype.loadTrashItems=function(e,t,n){var r=this,i=-1,s=0;arguments.length<3&&(typeof e=="function"?(n=e,e=i,t=s):(n=t,t=s)),this._discoveryService.getInfoObject("trash",function(i,s){if(i){n(i,!1);return}r._connectionManager.request("GET",s._href+"?offset="+t+"&limit="+e,"",{Accept:s["_media-type"]},n)})},d.prototype.loadTrashItem=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.TrashItem+json"},t)},d.prototype.recover=function(e,t,n){var r={Accept:"application/vnd.ez.api.TrashItem+json"};typeof t!="function"?r.Destination=t:n=t,this._connectionManager.request("MOVE",e,"",r,n)},d.prototype.deleteTrashItem=function(e,t){this._connectionManager.delete(e,t)},d.prototype.emptyThrash=function(e){var t=this;this._discoveryService.getInfoObject("trash",function(n,r){if(n){e(n,!1);return}t._connectionManager.request("DELETE",r._href,"",{},e)})},d.prototype.loadObjectStateGroups=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ObjectStateGroupList+json"},t)},d.prototype.loadObjectStateGroup=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ObjectStateGroup+json"},t)},d.prototype.createObjectStateGroup=function(e,t,n){this._connectionManager.request("POST",e,JSON.stringify(t.body),t.headers,n)},d.prototype.updateObjectStateGroup=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.deleteObjectStateGroup=function(e,t){this._connectionManager.delete(e,t)},d.prototype.createObjectState=function(e,t,n){this._connectionManager.request("POST",e+"/objectstates",JSON.stringify(t.body),t.headers,n)},d.prototype.loadObjectState=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ObjectState+json"},t)},d.prototype.updateObjectState=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},d.prototype.deleteObjectState=function(e,t){this._connectionManager.delete(e,t)},d.prototype.getContentState=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ContentObjectStates+json"},t)},d.prototype.setContentState=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t),{Accept:"application/vnd.ez.api.ContentObjectStates+json","Content-Type":"application/vnd.ez.api.ContentObjectStates+json"},n)},d.prototype.createUrlAlias=function(e,t,n){this._connectionManager.request("POST",e,JSON.stringify(t.body),t.headers,n)},d.prototype.listGlobalAliases=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.UrlAliasRefList+json"},t)},d.prototype.listLocationAliases=function(e,t,n){var r;arguments.length<3&&(n=t,t=!0),r=t===!0?"":"?custom=false",this._connectionManager.request("GET",e+"/urlaliases"+r,"",{Accept:"application/vnd.ez.api.UrlAliasRefList+json"},n)},d.prototype.loadUrlAlias=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.UrlAlias+json"},t)},d.prototype.deleteUrlAlias=function(e,t){this._connectionManager.delete(e,t)},d.prototype.createUrlWildcard=function(e,t,n){this._connectionManager.request("POST",e,JSON.stringify(t.body),t.headers,n)},d.prototype.loadUrlWildcards=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.UrlWildcardList+json"},t)},d.prototype.loadUrlWildcard=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.UrlWildcard+json"},t)},d.prototype.deleteUrlWildcard=function(e,t){this._connectionManager.delete(e,t)},d}),n("structures/ContentTypeGroupInputStruct",[],function(){var e=function(e){return this.body={},this.body.ContentTypeGroupInput={},this.body.ContentTypeGroupInput.identifier=e,this.headers={},this.headers.Accept="application/vnd.ez.api.ContentTypeGroup+json",this.headers["Content-Type"]="application/vnd.ez.api.ContentTypeGroupInput+json",this};return e}),n("structures/ContentTypeCreateStruct",[],function(){var e=function(e,t,n){var r=JSON.parse(JSON.stringify(new Date));return this.body={},this.body.ContentTypeCreate={},this.body.ContentTypeCreate.identifier=e,this.body.ContentTypeCreate.names={},this.body.ContentTypeCreate.names.value=n,this.body.ContentTypeCreate.nameSchema="<title>",this.body.ContentTypeCreate.urlAliasSchema="<title>",this.body.ContentTypeCreate.remoteId=null,this.body.ContentTypeCreate.mainLanguageCode=t,this.body.ContentTypeCreate.isContainer="true",this.body.ContentTypeCreate.modificationDate=r,this.body.ContentTypeCreate.defalutAlwaysAvailable="true",this.body.ContentTypeCreate.defalutSortField="PATH",this.body.ContentTypeCreate.defalutSortOrder="ASC",this.body.ContentTypeCreate.FieldDefinitions={},this.body.ContentTypeCreate.FieldDefinitions.FieldDefinition=[],this.headers={},this.headers.Accept="application/vnd.ez.api.ContentType+json",this.headers["Content-Type"]="application/vnd.ez.api.ContentTypeCreate+json",this};return e}),n("structures/ContentTypeUpdateStruct",[],function(){var e=function(){return this.body={},this.body.ContentTypeUpdate={},this.headers={},this.headers.Accept="application/vnd.ez.api.ContentType+json",this.headers["Content-Type"]="application/vnd.ez.api.ContentTypeUpdate+json",this};return e}),n("structures/FieldDefinitionCreateStruct",[],function(){var e=function(e,t,n,r){return this.body={},this.body.FieldDefinitionCreate={},this.body.FieldDefinitionCreate.identifier=e,this.body.FieldDefinitionCreate.fieldType=t,this.body.FieldDefinitionCreate.fieldGroup=n,this.body.FieldDefinitionCreate.position=1,this.body.FieldDefinitionCreate.isTranslatable="true",this.body.FieldDefinitionCreate.isRequired="false",this.body.FieldDefinitionCreate.isInfoCollector="false",this.body.FieldDefinitionCreate.isSearchable="false",this.body.FieldDefinitionCreate.defaultValue="false",this.body.FieldDefinitionCreate.names={},this.body.FieldDefinitionCreate.names.value=r,this.body.FieldDefinitionCreate.descriptions={},this.body.FieldDefinitionCreate.descriptions.value=[],this.headers={},this.headers.Accept="application/vnd.ez.api.FieldDefinition+json",this.headers["Content-Type"]="application/vnd.ez.api.FieldDefinitionCreate+json",this};return e}),n("structures/FieldDefinitionUpdateStruct",[],function(){var e=function(){return this.body={},this.body.FieldDefinitionUpdate={},this.headers={},this.headers.Accept="application/vnd.ez.api.FieldDefinition+json",this.headers["Content-Type"]="application/vnd.ez.api.FieldDefinitionUpdate+json",this};return e}),n("services/ContentTypeService",["structures/ContentTypeGroupInputStruct","structures/ContentTypeCreateStruct","structures/ContentTypeUpdateStruct","structures/FieldDefinitionCreateStruct","structures/FieldDefinitionUpdateStruct"],function(e,t,n,r,i){var s=function(e,t){this._connectionManager=e,this._discoveryService=t};return s.prototype.newContentTypeGroupInputStruct=function(t){return new e(t)},s.prototype.newContentTypeCreateStruct=function(e,n,r){return new t(e,n,r)},s.prototype.newContentTypeUpdateStruct=function(){return new n},s.prototype.newFieldDefinitionCreateStruct=function(e,t,n,i){return new r(e,t,n,i)},s.prototype.newFieldDefinitionUpdateStruct=function(){return new i},s.prototype.createContentTypeGroup=function(e,t,n){this._connectionManager.request("POST",e,JSON.stringify(t.body),t.headers,n)},s.prototype.loadContentTypeGroups=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ContentTypeGroupList+json"},t)},s.prototype.loadContentTypeGroup=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ContentTypeGroup+json"},t)},s.prototype.updateContentTypeGroup=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},s.prototype.deleteContentTypeGroup=function(e,t){this._connectionManager.delete(e,t)},s.prototype.loadContentTypes=function(e,t){var n=this;this.loadContentTypeGroup(e,function(e,r){if(e){t(e,!1);return}var i=r.document.ContentTypeGroup;n._connectionManager.request("GET",i.ContentTypes._href,"",{Accept:i.ContentTypes["_media-type"]},t)})},s.prototype.loadContentTypeGroupByIdentifier=function(e,t,n){this._connectionManager.request("GET",e+"?identifier="+t,"",{Accept:"application/vnd.ez.api.ContentTypeGroup+json"},n)},s.prototype.createContentType=function(e,t,n,r){var i=this;this.loadContentTypeGroup(e,function(e,s){if(e){r(e,!1);return}var o=s.document.ContentTypeGroup,u=n===!0?"?publish=true":"";i._connectionManager.request("POST",o.ContentTypes._href+u,JSON.stringify(t.body),t.headers,r)})},s.prototype.copyContentType=function(e,t){this._connectionManager.request("COPY",e,"",{},t)},s.prototype.loadContentType=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.ContentType+json"},t)},s.prototype.loadContentTypeByIdentifier=function(e,t){var n=this;this._discoveryService.getInfoObject("contentTypes",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("GET",i._href+"?identifier="+e,"",{Accept:i["_media-type"]},t)})},s.prototype.deleteContentType=function(e,t){this._connectionManager.delete(e,t)},s.prototype.loadGroupsOfContentType=function(e,t){this._connectionManager.request("GET",e+"/groups","",{Accept:"application/vnd.ez.api.ContentTypeGroupRefList+json"},t)},s.prototype.assignContentTypeGroup=function(e,t,n){this._connectionManager.request("POST",e+"/groups"+"?group="+t,"",{},n)},s.prototype.unassignContentTypeGroup=function(e,t){this._connectionManager.delete(e,t)},s.prototype.createContentTypeDraft=function(e,t,n){this._connectionManager.request("POST",e,JSON.stringify(t.body),t.headers,n)},s.prototype.loadContentTypeDraft=function(e,t){this._connectionManager.request("GET",e+"/draft","",{Accept:"application/vnd.ez.api.ContentType+json"},t)},s.prototype.updateContentTypeDraftMetadata=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},s.prototype.publishContentTypeDraft=function(e,t){this._connectionManager.request("PUBLISH",e,"",{},t)},s.prototype.deleteContentTypeDraft=function(e,t){this._connectionManager.delete(e,t)},s.prototype.addFieldDefinition=function(e,t,n){var r=this;this.loadContentTypeDraft(e,function(e,i){if(e){n(e,!1);return}var s=i.document.ContentType.FieldDefinitions;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},s.prototype.loadFieldDefinition=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.FieldDefinition+json"},t)},s.prototype.updateFieldDefinition=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},s.prototype.deleteFieldDefinition=function(e,t){this._connectionManager.delete(e,t)},s}),n("structures/SessionCreateStruct",[],function(){var e=function(e,t){return this.body={},this.body.SessionInput={},this.body.SessionInput.login=e,this.body.SessionInput.password=t,this.headers={Accept:"application/vnd.ez.api.Session+json","Content-Type":"application/vnd.ez.api.SessionInput+json"},this};return e}),n("structures/UserCreateStruct",[],function(){var e=function(e,t,n,r,i){return this.body={},this.body.UserCreate={},this.body.UserCreate.mainLanguageCode=e,this.body.UserCreate.login=t,this.body.UserCreate.email=n,this.body.UserCreate.password=r,this.body.UserCreate.fields={},this.body.UserCreate.fields.field=i,this.headers={},this.headers.Accept="application/vnd.ez.api.User+json",this.headers["Content-Type"]="application/vnd.ez.api.UserCreate+json",this};return e}),n("structures/UserUpdateStruct",[],function(){var e=function(){return this.body={},this.body.UserUpdate={},this.body.UserUpdate.fields={},this.body.UserUpdate.fields.field=[],this.headers={},this.headers.Accept="application/vnd.ez.api.User+json",this.headers["Content-Type"]="application/vnd.ez.api.UserUpdate+json",this};return e}),n("structures/UserGroupCreateStruct",[],function(){var e=function(e,t){return this.body={},this.body.UserGroupCreate={},this.body.UserGroupCreate.mainLanguageCode=e,this.body.UserGroupCreate.fields={},this.body.UserGroupCreate.fields.field=t,this.headers={},this.headers.Accept="application/vnd.ez.api.UserGroup+json",this.headers["Content-Type"]="application/vnd.ez.api.UserGroupCreate+json",this};return e}),n("structures/UserGroupUpdateStruct",[],function(){var e=function(e,t){return this.body={},this.body.UserGroupUpdate={},this.body.UserGroupUpdate.fields={},this.body.UserGroupUpdate.fields.field=[],this.headers={},this.headers.Accept="application/vnd.ez.api.UserGroup+json",this.headers["Content-Type"]="application/vnd.ez.api.UserGroupUpdate+json",this};return e}),n("structures/PolicyCreateStruct",[],function(){var e=function(e,t,n){return this.body={},this.body.PolicyCreate={},this.body.PolicyCreate.module=e,this.body.PolicyCreate.function=t,this.body.PolicyCreate.limitations={},this.body.PolicyCreate.limitations.limitation=n,this.headers={},this.headers.Accept="application/vnd.ez.api.Policy+json",this.headers["Content-Type"]="application/vnd.ez.api.PolicyCreate+json",this};return e}),n("structures/PolicyUpdateStruct",[],function(){var e=function(e){return this.body={},this.body.PolicyUpdate={},this.body.PolicyUpdate.limitations={},this.body.PolicyUpdate.limitations.limitation=e,this.headers={},this.headers.Accept="application/vnd.ez.api.Policy+json",this.headers["Content-Type"]="application/vnd.ez.api.PolicyUpdate+json",this};return e}),n("structures/RoleInputStruct",[],function(){var e=function(e){return this.body={},this.body.RoleInput={},this.body.RoleInput.identifier=e,this.headers={},this.headers.Accept="application/vnd.ez.api.Role+json",this.headers["Content-Type"]="application/vnd.ez.api.RoleInput+json",this};return e}),n("structures/RoleAssignInputStruct",[],function(){var e=function(e,t){return this.body={},this.body.RoleAssignInput={},this.body.RoleAssignInput.Role=e,this.body.RoleAssignInput.limitation=t,this.headers={},this.headers.Accept="application/vnd.ez.api.RoleAssignmentList+json",this.headers["Content-Type"]="application/vnd.ez.api.RoleAssignInput+json",this};return e}),n("services/UserService",["structures/SessionCreateStruct","structures/UserCreateStruct","structures/UserUpdateStruct","structures/UserGroupCreateStruct","structures/UserGroupUpdateStruct","structures/PolicyCreateStruct","structures/PolicyUpdateStruct","structures/RoleInputStruct","structures/RoleAssignInputStruct"],function(e,t,n,r,i,s,o,u,a){var f=function(e,t){this._connectionManager=e,this._discoveryService=t};return f.prototype.newSessionCreateStruct=function(t,n){return new e(t,n)},f.prototype.newUserGroupCreateStruct=function(e,t){return new r(e,t)},f.prototype.newUserGroupUpdateStruct=function(){return new i},f.prototype.newUserCreateStruct=function(e,n,r,i,s){return new t(e,n,r,i,s)},f.prototype.newUserUpdateStruct=function(){return new n},f.prototype.newRoleInputStruct=function(e){return new u(e)},f.prototype.newRoleAssignInputStruct=function(e,t){return new a(e,t)},f.prototype.newPolicyCreateStruct=function(e,t,n){return new s(e,t,n)},f.prototype.newPolicyUpdateStruct=function(e){return new o(e)},f.prototype.loadRootUserGroup=function(e){var t=this;this._discoveryService.getInfoObject("rootUserGroup",function(n,r){if(n){e(n,!1);return}t._connectionManager.request("GET",r._href,"",{Accept:r["_media-type"]},e)})},f.prototype.loadUserGroup=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.UserGroup+json"},t)},f.prototype.loadUserGroupByRemoteId=function(e,t,n){this._connectionManager.request("GET",e+"?remoteId="+t,"",{Accept:"application/vnd.ez.api.UserGroupList+json"},n)},f.prototype.deleteUserGroup=function(e,t){this._connectionManager.delete(e,t)},f.prototype.moveUserGroup=function(e,t,n){this._connectionManager.request("MOVE",e,"",{Destination:t},n)},f.prototype.createUserGroup=function(e,t,n){var r=this;this.loadUserGroup(e,function(e,i){if(e){n(e,!1);return}var s=i.document.UserGroup.Subgroups;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},f.prototype.updateUserGroup=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},f.prototype.loadSubUserGroups=function(e,t){var n=this;this.loadUserGroup(e,function(e,r){if(e){t(e,!1);return}var i=r.document.UserGroup.Subgroups;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},f.prototype.loadUsersOfUserGroup=function(e,t){var n=this;this.loadUserGroup(e,function(e,r){if(e){t(e,!1);return}var i=r.document.UserGroup.Users;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},f.prototype.loadUserGroupsOfUser=function(e,t){this._connectionManager.request("GET",e+"/groups","",{Accept:"application/vnd.ez.api.UserGroupRefList+json"},t)},f.prototype.createUser=function(e,t,n){var r=this;this.loadUserGroup(e,function(e,i){if(e){n(e,!1);return}var s=i.document.UserGroup.Users;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},f.prototype.getRoleAssignments=function(e,t,n){this._connectionManager.request("GET",e+"?roleId="+t,"",{Accept:"application/vnd.ez.api.UserList+json"},n)},f.prototype.loadUser=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.User+json"},t)},f.prototype.updateUser=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},f.prototype.deleteUser=function(e,t){this._connectionManager.delete(e,t)},f.prototype.assignUserToUserGroup=function(e,t,n){var r=this;this.loadUser(e,function(e,i){if(e){n(e,!1);return}var s=i.document.User.UserGroups;r._connectionManager.request("POST",s._href+"?group="+t,"",{Accept:s["_media-type"]},n)})},f.prototype.unassignUserFromUserGroup=function(e,t){this._connectionManager.delete(e,t)},f.prototype.createRole=function(e,t){var n=this;this._discoveryService.getInfoObject("roles",function(r,i){if(r){t(r,!1);return}n._connectionManager.request("POST",i._href,JSON.stringify(e.body),e.headers,t)})},f.prototype.loadRole=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Role+json"},t)},f.prototype.loadRoles=function(e,t,n,r){var i=this,s,o="",u=-1,a=0;arguments.length<4&&(typeof e=="function"?(r=e,e=o,t=u,n=a):typeof t=="function"?(r=t,t=u,n=a):(r=n,n=a)),s=e===""?"":"&identifier="+e,this._discoveryService.getInfoObject("roles",function(e,o){if(e){r(e,!1);return}i._connectionManager.request("GET",o._href+"?offset="+n+"&limit="+t+s,"",{Accept:o["_media-type"]},r)})},f.prototype.updateRole=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},f.prototype.deleteRole=function(e,t){this._connectionManager.delete(e,t)},f.prototype.getRoleAssignmentsForUser=function(e,t){var n=this;this.loadUser(e,function(e,r){if(e){t(e,!1);return}var i=r.document.User.Roles;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},f.prototype.getRoleAssignmentsForUserGroup=function(e,t){var n=this;this.loadUserGroup(e,function(e,r){if(e){t(e,!1);return}var i=r.document.UserGroup.Roles;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},f.prototype.getUserAssignmentObject=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.RoleAssignment+json"},t)},f.prototype.getUserGroupAssignmentObject=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.RoleAssignment+json"},t)},f.prototype.assignRoleToUser=function(e,t,n){var r=this;this.loadUser(e,function(e,i){if(e){n(e,!1);return}var s=i.document.User.Roles;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},f.prototype.assignRoleToUserGroup=function(e,t,n){var r=this;this.loadUserGroup(e,function(e,i){if(e){n(e,!1);return}var s=i.document.UserGroup.Roles;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},f.prototype.unassignRoleFromUser=function(e,t){this._connectionManager.delete(e,t)},f.prototype.unassignRoleFromUserGroup=function(e,t){this._connectionManager.delete(e,t)},f.prototype.addPolicy=function(e,t,n){var r=this;this.loadRole(e,function(e,i){if(e){n(e,!1);return}var s=i.document.Role.Policies;r._connectionManager.request("POST",s._href,JSON.stringify(t.body),t.headers,n)})},f.prototype.loadPolicies=function(e,t){var n=this;this.loadRole(e,function(e,r){if(e){t(e,!1);return}var i=r.document.Role.Policies;n._connectionManager.request("GET",i._href,"",{Accept:i["_media-type"]},t)})},f.prototype.loadPolicy=function(e,t){this._connectionManager.request("GET",e,"",{Accept:"application/vnd.ez.api.Policy+json"},t)},f.prototype.updatePolicy=function(e,t,n){this._connectionManager.request("PATCH",e,JSON.stringify(t.body),t.headers,n)},f.prototype.deletePolicy=function(e,t){this._connectionManager.delete(e,t)},f.prototype.loadPoliciesByUserId=function(e,t,n){this._connectionManager.request("GET",e+"?userId="+t,"",{Accept:"application/vnd.ez.api.PolicyList+json"},n)},f.prototype.createSession=function(e,t,n){this._connectionManager.notAuthorizedRequest("POST",e,JSON.stringify(t.body),t.headers,n)},f.prototype.deleteSession=function(e,t){this._connectionManager.delete(e,t)},f.prototype.logOut=function(e){this._connectionManager.logOut(e)},f}),n("CAPI",["authAgents/SessionAuthAgent","authAgents/HttpBasicAuthAgent","ConnectionManager","ConnectionFeatureFactory","connections/XmlHttpRequestConnection","connections/MicrosoftXmlHttpRequestConnection","services/DiscoveryService","services/ContentService","services/ContentTypeService","services/UserService"],function(e,t,n,r,i,s,o,u,a,f){var l=function(e,t,l){var c={logRequests:!1,rootPath:"/api/ezp/v2/",connectionStack:[{connection:i},{connection:s}]},h=c,p,d,v,m;this._contentService=null,this._contentTypeService=null,this._userService=null,t.setCAPI(this);if(typeof l=="object")for(p in l)l.hasOwnProperty(p)&&(h[p]=l[p]);d=new r(h.connectionStack),v=new n(e,t,d),v.logRequests=h.logRequests,m=new o(h.rootPath,v),this.getContentService=function(){return this._contentService||(this._contentService=new u(v,m)),this._contentService},this.getContentTypeService=function(){return this._contentTypeService||(this._contentTypeService=new a(v,m)),this._contentTypeService},this.getUserService=function(){return this._userService||(this._userService=new f(v,m)),this._userService}};return l}),window.eZ=window.eZ||{},window.eZ.HttpBasicAuthAgent=t("authAgents/HttpBasicAuthAgent"),window.eZ.SessionAuthAgent=t("authAgents/SessionAuthAgent"),window.eZ.CAPI=t("CAPI")}); \ No newline at end of file diff --git a/dist/CAPI.js b/dist/CAPI.js index 601450c..f5a36a0 100644 --- a/dist/CAPI.js +++ b/dist/CAPI.js @@ -1359,7 +1359,8 @@ define('structures/ContentCreateStruct',[],function () { /** - * Returns a structure used to create a new Content object. See ContentService.createContent() call + * Returns a structure used to create a new Content object. See + * {{#crossLink "ContentService/createContent"}}ContentService.createContent{{/crossLink}} * * @class ContentCreateStruct * @constructor @@ -1404,7 +1405,8 @@ define('structures/ContentUpdateStruct',[],function () { /** - * Returns a structure used to update a Content object. See ContentService.updateContent() call + * Returns a structure used to update a Content object. See + * {{#crossLink "ContentService/updateContent"}}ContentService.updateContent{{/crossLink}} * * @class ContentUpdateStruct * @constructor @@ -1439,7 +1441,8 @@ define('structures/SectionInputStruct',[],function () { /** - * Returns a structure used to create and update a Section. See for ex. ContentService.createSection() call + * Returns a structure used to create and update a Section. See for ex. + * {{#crossLink "ContentService/createSection"}}ContentService.createSection{{/crossLink}} * * @class SectionInputStruct * @constructor @@ -1469,7 +1472,8 @@ define('structures/LocationCreateStruct',[],function () { /** - * Returns a structure used to create a new Location. See ContentService.createLocation() call + * Returns a structure used to create a new Location. See + * {{#crossLink "ContentService/createLocation"}}ContentService.createLocation{{/crossLink}} * * @class LocationCreateStruct * @constructor @@ -1503,7 +1507,8 @@ define('structures/LocationUpdateStruct',[],function () { /** - * Returns a structure used to update a Location. See ContentService.updateLocation() call + * Returns a structure used to update a Location. See + * {{#crossLink "ContentService/updateLocation"}}ContentService.updateLocation{{/crossLink}} * * @class LocationUpdateStruct * @constructor @@ -1531,7 +1536,8 @@ define('structures/ContentMetadataUpdateStruct',[],function () { /** - * Returns a structure used to update a Content's metadata. See ContentService.updateContentMetadata() call + * Returns a structure used to update a Content's metadata. See + * {{#crossLink "ContentService/updateContentMetadata"}}ContentService.updateContentMetadata{{/crossLink}} * * @class ContentMetadataUpdateStruct * @constructor @@ -1567,13 +1573,14 @@ define('structures/ObjectStateGroupCreateStruct',[],function () { /** - * Returns a structure used to create a new Object State group. See ContentService.createObjectStateGroup() call + * Returns a structure used to create a new Object State group. See + * {{#crossLink "ContentService/createObjectStateGroup"}}ContentService.createObjectStateGroup{{/crossLink}} * * @class ObjectStateGroupCreateStruct * @constructor * @param identifier {String} unique ObjectStateGroup identifier * @param languageCode {String} The language code (eng-GB, fre-FR, ...) - * @param names {Array} multiLanguageValuesType in JSON format + * @param names {Array} Multi language value (see the example) * @example * var objectStateGroupCreateStruct = contentService.newObjectStateGroupCreateStruct( * "some-id", @@ -1614,7 +1621,8 @@ define('structures/ObjectStateGroupUpdateStruct',[],function () { /** - * Returns a structure used to update an Object State group. See ContentService.updateObjectStateGroup() call + * Returns a structure used to update an Object State group. See + * {{#crossLink "ContentService/updateObjectStateGroup"}}ContentService.updateObjectStateGroup{{/crossLink}} * * @class ObjectStateGroupUpdateStruct * @constructor @@ -1638,7 +1646,8 @@ define('structures/ObjectStateCreateStruct',[],function () { /** - * Returns a structure used to create a new Object State. See ContentService.createObjectState() call + * Returns a structure used to create a new Object State. See + * {{#crossLink "ContentService/createObjectState"}}ContentService.createObjectState{{/crossLink}} * * @class ObjectStateCreateStruct * @constructor @@ -1693,7 +1702,8 @@ define('structures/ObjectStateUpdateStruct',[],function () { /** - * Returns a structure used to update an Object State. See ContentService.updateObjectState() call + * Returns a structure used to update an Object State. See + * {{#crossLink "ContentService/updateObjectState"}}ContentService.updateObjectState{{/crossLink}} * * @class ObjectStateUpdateStruct * @constructor @@ -1717,7 +1727,8 @@ define('structures/ViewCreateStruct',[],function () { /** - * Returns a structure used to create a new View. See ContentService.createView() call + * Returns a structure used to create a new View. See + * {{#crossLink "ContentService/createView"}}ContentService.createView{{/crossLink}} * * @class ViewCreateStruct * @constructor @@ -1753,7 +1764,8 @@ define('structures/UrlAliasCreateStruct',[],function () { /** - * Returns a structure used to create a new UrlAlias object. See ContentService.createUrlAlias() call + * Returns a structure used to create a new UrlAlias object. See + * {{#crossLink "ContentService/createUrlAlias"}}ContentService.createUrlAlias{{/crossLink}} * * @class UrlAliasCreateStruct * @constructor @@ -1795,7 +1807,8 @@ define('structures/UrlWildcardCreateStruct',[],function () { /** - * Returns a structure used to create a new Url Wildcard object. See ContentService.createUrlWildcard() call + * Returns a structure used to create a new Url Wildcard object. See + * {{#crossLink "ContentService/createUrlWildcard"}}ContentService.createUrlWildcard{{/crossLink}} * * @class UrlWildcardCreateStruct * @constructor @@ -1826,7 +1839,8 @@ define('structures/RelationCreateStruct',[],function () { /** - * Returns a structure used to create a new Content object. See ContentService.createRelation() call + * Returns a structure used to create a new Content object. See + * {{#crossLink "ContentService/addRelation"}}ContentService.addRelation{{/crossLink}} * * @class RelationCreateStruct * @constructor @@ -2894,12 +2908,21 @@ define('services/ContentService',["structures/ContentCreateStruct", "structures/ // ****************************** /** - * Creates a new view + * Creates a new view. Views are used to perform content queries by certain criteria. * * @method createView * @param viewCreateStruct {ViewCreateStruct} object describing new view to be created * @param callback {Function} callback executed after performing the request (see * {{#crossLink "ContentService"}}Note on the callbacks usage{{/crossLink}} for more info) + * @example + * var viewCreateStruct = contentService.newViewCreateStruct('some-test-id'); + * viewCreateStruct.body.ViewInput.Query.Criteria = { + * FullTextCriterion : "title" + * }; + * contentService.createView( + * viewCreateStruct, + * callback + * ); */ ContentService.prototype.createView = function (viewCreateStruct, callback) { var that = this; @@ -3662,7 +3685,8 @@ define('structures/ContentTypeGroupInputStruct',[],function () { /** - * Returns a structure used to create and update a Content Type group. See ContentTypeService.createContentTypeGroup() call + * Returns a structure used to create and update a Content Type group. See + * {{#crossLink "ContentTypeService/createContentTypeGroup"}}ContentTypeService.createContentTypeGroup{{/crossLink}} * * @class ContentTypeGroupInputStruct * @constructor @@ -3689,13 +3713,15 @@ define('structures/ContentTypeCreateStruct',[],function () { /** - * Returns a structure used to create a new Content Type object. See ContentTypeService.createContentType() call + * Returns a structure used to create a new Content Type object. See + * {{#crossLink "ContentTypeService/createContentType"}}ContentTypeService.createContentType{{/crossLink}} * * @class ContentTypeCreateStruct * @constructor * @param identifier {String} Unique identifier for the target Content Type (e.g. "my_new_content_type") * @param languageCode {String} The language code (e.g. "eng-GB") - * @param names {Array} Multi language value (see example in ContentTypeService.newContentTypeCreateStruct() doc) + * @param names {Array} Multi language value (see example in + * {{#crossLink "ContentTypeService/newContentTypeCreateStruct"}}ContentTypeService:newContentTypeCreateStruct{{/crossLink}}) */ var ContentTypeCreateStruct = function (identifier, languageCode, names) { var now = JSON.parse(JSON.stringify(new Date())); @@ -3738,7 +3764,8 @@ define('structures/ContentTypeUpdateStruct',[],function () { /** - * Returns a structure used to update a Content Type object. See ContentTypeService.updateContentType() call + * Returns a structure used to update a Content Type object. See for ex. + * {{#crossLink "ContentTypeService/createContentTypeDraft"}}ContentTypeService.createContentTypeDraft{{/crossLink}} * * @class ContentTypeUpdateStruct * @constructor @@ -3762,14 +3789,16 @@ define('structures/FieldDefinitionCreateStruct',[],function () { /** - * Returns a structure used to create a new Field Definition. See ContentTypeService.addFieldDefinition() call + * Returns a structure used to create a new Field Definition. See + * {{#crossLink "ContentTypeService/addFieldDefinition"}}ContentTypeService.addFieldDefinition{{/crossLink}} * * @class FieldDefinitionCreateStruct * @constructor * @param identifier {String} unique field definiton identifer (e.g. "my-field") * @param fieldType {String} identifier of existing field type (e.g. "ezstring", "ezdate") * @param fieldGroup {String} identifier of existing field group (e.g. "content", "meta") - * @param names {Array} Multi language value (see example in ContentTypeService.newFieldDefintionCreateStruct() doc) + * @param names {Array} Multi language value (see example in + * {{#crossLink "ContentTypeService/newFieldDefinitionCreateStruct"}}ContentTypeService.newFieldDefintionCreateStruct{{/crossLink}}) */ var FieldDefinitionCreateStruct = function (identifier, fieldType, fieldGroup, names) { this.body = {}; @@ -3809,7 +3838,8 @@ define('structures/FieldDefinitionUpdateStruct',[],function () { /** - * Returns a structure used to update a Field Definition. See ContentTypeService.updateFieldDefinition() call + * Returns a structure used to update a Field Definition. See + * {{#crossLink "ContentTypeService/updateFieldDefinition"}}ContentTypeService.updateFieldDefinition{{/crossLink}} * * @class FieldDefinitionUpdateStruct * @constructor @@ -4500,7 +4530,8 @@ define('structures/SessionCreateStruct',[],function () { /** - * Returns a structure used to create a new Session. See UserService.createSession() call + * Returns a structure used to create a new Session. See + * {{#crossLink "UserService/createSession"}}UserService.createSession{{/crossLink}} * * @class SessionCreateStruct * @constructor @@ -4530,7 +4561,8 @@ define('structures/UserCreateStruct',[],function () { /** - * Returns a structure used to create a new User. See UserService.createUser() call + * Returns a structure used to create a new User. See + * {{#crossLink "UserService/createUser"}}UserService.createUser{{/crossLink}} * * @class UserCreateStruct * @constructor @@ -4538,7 +4570,8 @@ define('structures/UserCreateStruct',[],function () { * @param login {String} login for a new user * @param email {String} email for a new user * @param password {String} password for a new user - * @param fields {Array} fields array (see example for "newUserGroupCreateStruct") + * @param fields {Array} fields array (see example in + * {{#crossLink "UserService/newUserGroupCreateStruct"}}UserService.newUserGroupCreateStruct{{/crossLink}}) */ var UserCreateStruct = function (languageCode, login, email, password, fields) { this.body = {}; @@ -4567,7 +4600,8 @@ define('structures/UserUpdateStruct',[],function () { /** - * Returns a structure used to update a User. See UserService.updateUser() call + * Returns a structure used to update a User. See + * {{#crossLink "UserService/updateUser"}}UserService.updateUser{{/crossLink}} * * @class UserUpdateStruct * @constructor @@ -4594,12 +4628,14 @@ define('structures/UserGroupCreateStruct',[],function () { /** - * Returns a structure used to create a new User group. See UserService.createUserGroup() call + * Returns a structure used to create a new User group. See + * {{#crossLink "UserService/createUserGroup"}}UserService.createUserGroup{{/crossLink}} * * @class UserGroupCreateStruct * @constructor * @param languageCode {String} The language code (eng-GB, fre-FR, ...) - * @param fields {Array} fields array (see example in UserService.newUserGroupCreateStruct() doc) + * @param fields {Array} fields array (see example in + * {{#crossLink "UserService/newUserGroupCreateStruct"}}UserService.newUserGroupCreateStruct{{/crossLink}}) */ var UserGroupCreateStruct = function (languageCode, fields) { this.body = {}; @@ -4625,12 +4661,14 @@ define('structures/UserGroupUpdateStruct',[],function () { /** - * Returns a structure used to update a User group. See UserService.updateUserGroup() call + * Returns a structure used to update a User group. See + * {{#crossLink "UserService/updateUserGroup"}}UserService.updateUserGroup{{/crossLink}} * * @class UserGroupUpdateStruct * @constructor * @param languageCode {String} The language code (eng-GB, fre-FR, ...) - * @param fields {Array} fields array (see example in UserService.newUserGroupCreateStruct() doc) + * @param fields {Array} fields array (see example in + * {{#crossLink "UserService/newUserGroupCreateStruct"}}UserService.newUserGroupCreateStruct{{/crossLink}}) */ var UserGroupUpdateStruct = function (languageCode, fields) { this.body = {}; @@ -4654,7 +4692,8 @@ define('structures/PolicyCreateStruct',[],function () { /** - * Returns a structure used to create a new Policy. See UserService.createPolicy() call + * Returns a structure used to create a new Policy. See + * {{#crossLink "UserService/addPolicy"}}UserService.addPolicy{{/crossLink}} * * @class PolicyCreateStruct * @constructor @@ -4687,7 +4726,8 @@ define('structures/PolicyUpdateStruct',[],function () { /** - * Returns a structure used to update a Policy. See UserService.updatePolicy() call + * Returns a structure used to update a Policy. See + * {{#crossLink "UserService/updatePolicy"}}UserService.updatePolicy{{/crossLink}} * * @class PolicyUpdateStruct * @constructor @@ -4715,7 +4755,8 @@ define('structures/RoleInputStruct',[],function () { /** - * Returns a structure used to create and update a Role. See UserService.createRole() call + * Returns a structure used to create and update a Role. See + * {{#crossLink "UserService/createRole"}}UserService.createRole{{/crossLink}} * * @class RoleInputStruct * @constructor @@ -4742,12 +4783,14 @@ define('structures/RoleAssignInputStruct',[],function () { /** - * Returns a structure used to create and update a Role Assign object. See for ex. UserService.assignRoleToUser() call + * Returns a structure used to create and update a Role Assign object. See for ex. + * {{#crossLink "UserService/assignRoleToUser"}}UserService.assignRoleToUser{{/crossLink}} * * @class RoleAssignInputStruct * @constructor - * @param role {Object} object representing the target role (see example) - * @param limitation {Object} object representing limitations for assignment (see example in UserService.newRoleAssignInputStruct() doc) + * @param role {Object} object representing the target role + * @param limitation {Object} object representing limitations for assignment (see example in + * {{#crossLink "UserService/newRoleAssignInputStruct"}}UserService.newRoleAssignInputStruct{{/crossLink}}) */ var RoleAssignInputStruct = function (role, limitation) { this.body = {}; @@ -4867,7 +4910,8 @@ define('services/UserService',['structures/SessionCreateStruct', 'structures/Use * @param login {String} login for a new user * @param email {String} email for a new user * @param password {String} password for a new user - * @param fields {Array} fields array (see example for "newUserGroupCreateStruct") + * @param fields {Array} fields array (see example for + * {{#crossLink "UserService/newUserGroupCreateStruct"}}UserService.newUserGroupCreateStruct{{/crossLink}}) * @return {UserCreateStruct} */ UserService.prototype.newUserCreateStruct = function (languageCode, login, email, password, fields) { @@ -6063,2056 +6107,12 @@ define('CAPI',['authAgents/SessionAuthAgent', 'authAgents/HttpBasicAuthAgent', ' return CAPI; }); - -// vim:ts=4:sts=4:sw=4: -/*! - * - * Copyright 2009-2012 Kris Kowal under the terms of the MIT - * license found at http://github.com/kriskowal/q/raw/master/LICENSE - * - * With parts by Tyler Close - * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found - * at http://www.opensource.org/licenses/mit-license.html - * Forked at ref_send.js version: 2009-05-11 - * - * With parts by Mark Miller - * Copyright (C) 2011 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -(function (definition) { - // Turn off strict mode for this function so we can assign to global.Q - /* jshint strict: false */ - - // This file will function properly as a