@awhere/api
Version:
The awesome aWhere API for JavaScript.
143 lines • 4.91 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OAuthClientCredential = void 0;
var randomstring_1 = __importDefault(require("randomstring"));
var PrototypeBase_1 = __importDefault(require("../PrototypeBase"));
var OAuthClientCredential = /** @class */ (function (_super) {
__extends(OAuthClientCredential, _super);
function OAuthClientCredential(props) {
if (props === void 0) { props = {}; }
var _this = _super.call(this, props) || this;
_this._id = props._id || OAuthClientCredential.generateId();
if (props.secret !== undefined) {
_this.secret = props.secret;
}
else {
_this.secret = OAuthClientCredential.generateSecret();
}
if (props.name !== undefined) {
_this.name = props.name;
}
if (props.description !== undefined) {
_this.description = props.description;
}
if (props.type !== undefined) {
_this.type = props.type;
}
if (props.logo !== undefined) {
_this.logo = props.logo;
}
if (props.owner !== undefined) {
_this.owner = props.owner;
}
if (props.scope !== undefined) {
_this.scope = props.scope;
}
return _this;
}
OAuthClientCredential.generateId = function () {
return randomstring_1.default.generate(32);
};
OAuthClientCredential.generateSecret = function () {
return randomstring_1.default.generate(16);
};
Object.defineProperty(OAuthClientCredential.prototype, "name", {
get: function () {
return this._name;
},
set: function (value) {
this._name = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(OAuthClientCredential.prototype, "secret", {
get: function () {
return this._secret;
},
set: function (value) {
this._secret = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(OAuthClientCredential.prototype, "description", {
get: function () {
return this._description;
},
set: function (value) {
this._description = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(OAuthClientCredential.prototype, "logo", {
get: function () {
return this._logo;
},
set: function (value) {
this._logo = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(OAuthClientCredential.prototype, "owner", {
get: function () {
return this._owner;
},
set: function (value) {
this._owner = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(OAuthClientCredential.prototype, "scope", {
get: function () {
return this._scope;
},
set: function (value) {
this._scope = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(OAuthClientCredential.prototype, "type", {
get: function () {
return this._type;
},
set: function (value) {
this._type = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(OAuthClientCredential.prototype, "logoUrl", {
get: function () {
return this._logo ? "".concat(this.baseUrl, "image/client/").concat(this._logo) : undefined;
},
enumerable: false,
configurable: true
});
return OAuthClientCredential;
}(PrototypeBase_1.default));
exports.OAuthClientCredential = OAuthClientCredential;
exports.default = OAuthClientCredential;
//# sourceMappingURL=OAuthClientCredential.js.map