UNPKG

para-client-js

Version:

JavaScript Client for Para

202 lines (201 loc) 5.23 kB
export default class ParaObject { constructor(id: any, type: any); id: any; type: any; name: string; stored: boolean; indexed: boolean; cached: boolean; version: number; /** * The id of an object. Usually an autogenerated unique string of numbers. * * @return the id */ getId(): any; /** * Sets a new id. Must not be null or empty. * * @param {String} id the new id */ setId(id: string): void; /** * The name of the object. Can be anything. * * @return {String} the name. default: [type id] */ getName(): string; /** * Sets a new name. Must not be null or empty. * * @param {String} name the new name */ setName(name: string): void; /** * The application name. Added to support multiple separate apps. * Every object must belong to an app. * * @return {String} the app id (name). default: para */ getAppid(): string; /** * Sets a new app name. Must not be null or empty. * * @param {String} appid the new app id (name) */ setAppid(appid: string): void; appid: string; /** * The id of the parent object. * * @return {String} the id of the parent or null */ getParentid(): string; /** * Sets a new parent id. Must not be null or empty. * * @param {String} parentid a new id */ setParentid(parentid: string): void; parentid: string; /** * The name of the object's class. This is equivalent to {@link Class#getSimpleName()}.toLowerCase(). * * @return {String} the simple name of the class */ getType(): string; /** * Sets a new object type. Must not be null or empty. * * @param {String} type a new type */ setType(type: string): void; /** * The id of the user who created this. Should point to a {@link User} id. * * @return {String} the id or null */ getCreatorid(): string; /** * Sets a new creator id. Must not be null or empty. * * @param {String} creatorid a new id */ setCreatorid(creatorid: string): void; creatorid: string; /** * The URI of this object. For example: /user/123. * * @return {String} the URI */ getObjectURI(): string; /** * The time when the object was created, in milliseconds. * * @return {Number} the timestamp of creation */ getTimestamp(): number; /** * Sets the timestamp. * * @param {Number} timestamp a new timestamp in milliseconds. */ setTimestamp(timestamp: number): void; timestamp: number; /** * The last time this object was updated. Timestamp in ms. * * @return {Number} timestamp in milliseconds */ getUpdated(): number; /** * Sets the last updated timestamp. * * @param {Number} updated a new timestamp */ setUpdated(updated: number): void; updated: number; /** * The tags associated with this object. Tags must not be null or empty. * * @return {Array} a set of tags, or an empty set */ getTags(): any[]; /** * Merges the given tags with existing tags. * * @param {Array} tags the additional tags, or clears all tags if set to null */ setTags(tags: any[]): void; tags: any[]; /** * The votes associated with this object. * * @return {Number} votes or 0 */ getVotes(): number; /** * Sets the votes. * * @param {Number} votes */ setVotes(votes: number): void; votes: number; /** * The version of this object. * * @return {Number} version */ getVersion(): number; /** * Sets the version. * * @param {Number} version */ setVersion(version: number): void; /** * Boolean flag which controls whether this object is stored * in the database or not. Default is true. * * @return {Boolean} true if this object is stored in DB. */ getStored(): boolean; /** * Sets the "isStored" flag. * * @param {Boolean} isStored when set to true, object is stored in DB. */ setStored(isStored: boolean): void; /** * Boolean flat which controls whether this object is indexed * by the search engine. Default is true. * * @return {Boolean} true if this object is indexed */ getIndexed(): boolean; /** * Sets the "isIndexed" flag. * * @param {Boolean} isIndexed when set to true, object is indexed. */ setIndexed(isIndexed: boolean): void; /** * Boolean flat which controls whether this object is cached. * Default is true. * * @return {Boolean} true if this object is cached on update() and create(). */ getCached(): boolean; /** * Sets the "isCached" flag. * * @param {Boolean} isCached when set to true, object is cached. */ setCached(isCached: boolean): void; /** * Populates this object with data from a map. * @param {Object} map * @return {ParaObject} this */ setFields(map: any): ParaObject; }