var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/// <reference path="proxy/PublicEndpointProxy.ts" />
/// <reference path="Request.ts" />
var econda;
(function (econda) {
    var profileaccess;
    (function (profileaccess) {
        /**
         * A public profile endpoint request without authentication.
         *
         * @class econda.profileaccess.PublicEndpointRequest
         * @extends econda.profileaccess.Request
         *
         * <h2>Examples</h2>
         *
         * <h3> Send a public request to econda profileaccess service with all available ids: </h3>
         * <pre><code>
         * // The endpoint has to be configured in the profile access management interface.
         *
         * // The endpointKey is the unique identifier for this endpoint.
         *
         * // The ids have to be set beforehand. (see {@link econda.recengine#VisitorProfile} for details).
         *
         * // check, if any id id available and send request
         * if (econda.data.visitor.hasIds()) {
         *      var request = new econda.profileaccess.PublicEndpointRequest({
         *          accountId: '00000cec-d98025a8-912b-46a4-a57d-7a691ba7a376',
         *          endpointKey: 'noauth',
         *          context: {
         *              // all available ids un client profile will be appended to request
         *              appendVisitorData: true
         *          },
         *          success: function(profile) {
         *              // Profile is an object containing all returned properties as key value pairs.
         *              //
         *              // Example:
         *              //      profile = {
         *              //          gender: 'male'
         *              //      }
         *              //
         *              showProfileData(profile);
         *          },
         *          error: function(error) {
         *              // Error object
         *              handleError(error);
         *          }
         *      });
         *      request.send();
         * }
         * </code></pre>
         *
         * <h3> Send a public request to econda profileaccess service with a specfic userId: </h3>
         * <pre><code>
         * // The endpoint has to be configured in the profile access management interface.
         *
         * // The endpointKey is the unique identifer for this endpoint.
         *
         * // The userId has to be set beforehand. (see {@link econda.recengine#VisitorProfile} for details).
         * var userId = econda.data.visitor.getUserId();
         *
         * // check, if userId is available and send request
         * if (userId) {
         *   var request = new econda.profileaccess.PublicEndpointRequest({
         *       accountId: '00000cec-d98025a8-912b-46a4-a57d-7a691ba7a376',
         *       endpointKey: 'noauth',
         *       context: {
         *           userId: userId
         *       },
         *       success: function(profile) {
         *           // Profile is an object containing all returned properties as key value pairs.
         *           //
         *           // Example:
         *           //      profile = {
         *           //          gender: 'male'
         *           //      }
         *           //
         *           showProfileData(profile);
         *       },
         *       error: function(error) {
         *           // Error object
         *           handleError(error);
         *       }
         *   });
         *   request.send();
         * }
         * </code></pre>
         *
         */
        var PublicEndpointRequest = (function (_super) {
            __extends(PublicEndpointRequest, _super);
            function PublicEndpointRequest(cfg) {
                if (cfg === void 0) { cfg = null; }
                _super.call(this);
                if (cfg instanceof PublicEndpointRequest) {
                    return cfg;
                }
                this.initConfig(cfg);
                if (!this.getProxy()) {
                    this.setProxy(new econda.profileaccess.proxy.PublicEndpointProxy());
                }
            }
            return PublicEndpointRequest;
        }(profileaccess.Request));
        profileaccess.PublicEndpointRequest = PublicEndpointRequest;
    })(profileaccess = econda.profileaccess || (econda.profileaccess = {}));
})(econda || (econda = {}));