Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @constructor
- * Keymetrics
- *
- * @param {object} opts The options are passed to the children instances
- * @param {string} opts.refresh_token [Required] Refresh token (retrieved from Keymetrics dashboard)
- * @param {string} opts.token_type [Required] Type: 'refresh_token' or 'access_token'
- * @param {string} opts.access_token [Optional] Access token
- * @param {string} opts.public_key [Optional] Bucket public key
- * @param {string} opts.realtime [Optional] When true, attempts realtime connection on .init()
- * @param {string} opts.public_key [Optional] Bucket id
- * @param {string} opts.host [Optional] Base url used (default 'http://app.keymetrics.io:3000')
- * @param {string} opts.basePath [Optional] Base API path (default '/api')
- * @param {function} opts.bus [Optional] EventEmitter2 instance
- */
- declare class Keymetrics {
- user: User;
- bucket: Bucket;
- realtime: Realtime;
- auth: Authenticate;
- bus: any;
- /**
- * @constructor
- * Keymetrics
- *
- * @param {object} opts The options are passed to the children instances
- * @param {string} opts.refresh_token [Required] Refresh token (retrieved from Keymetrics dashboard)
- * @param {string} opts.token_type [Required] Type: 'refresh_token' or 'access_token'
- * @param {string} opts.access_token [Optional] Access token
- * @param {string} opts.public_key [Optional] Bucket public key
- * @param {string} opts.realtime [Optional] When true, attempts realtime connection on .init()
- * @param {string} opts.public_key [Optional] Bucket id
- * @param {string} opts.host [Optional] Base url used (default 'http://app.keymetrics.io:3000')
- * @param {string} opts.basePath [Optional] Base API path (default '/api')
- * @param {function} opts.bus [Optional] EventEmitter2 instance
- */
- constructor(opts: { refresh_token: string,
- token_type: string,
- access_token: string,
- public_key: string,
- realtime: string,
- host: string,
- basePath: string,
- bus: (() => any)
- });
- /**
- * Start the Keymetrics connection
- *
- * @param {function} callback Runs once connection is complete
- *
- */
- init(callback: (() => any)): void;
- }
- /**
- * Recursive cloning array.
- */
- declare function deepCloneArray(): void;
- /**
- * Extening object that entered in first argument.
- *
- * Returns extended object or false if have no target object or incorrect type.
- *
- * If you wish to clone source object (without modify it), just use empty new
- * object as first argument, like this:
- * deepExtend({}, yourObj_1, [yourObj_N]);
- */
- declare var deepExtend: any;
- /**
- * Bucket
- * @constructor
- * @memberof Keymetrics
- * @alias bucket
- *
- * @param {object} opts Options
- * @property {object} _id ID of currently selected bucket
- * @property {object} current_raw Raw data from current selected Bucket
- * @property {object} servers (Realtime) List of connected Bucket servers
- * @property {object} apps (Realtime) List of connected Bucket applications
- * @property {object} apps_server (Realtime) List of connected apps per server
- * @property {object} mini_metrics (Realtime) List of metrics per app per server
- */
- declare class Bucket {
- Alert: AlertMethods;
- User: UserMethods;
- Data: DataMethods;
- Action: ActionMethods;
- /**
- * Bucket
- * @constructor
- * @memberof Keymetrics
- * @alias bucket
- *
- * @param {object} opts Options
- * @property {object} _id ID of currently selected bucket
- * @property {object} current_raw Raw data from current selected Bucket
- * @property {object} servers (Realtime) List of connected Bucket servers
- * @property {object} apps (Realtime) List of connected Bucket applications
- * @property {object} apps_server (Realtime) List of connected apps per server
- * @property {object} mini_metrics (Realtime) List of metrics per app per server
- */
- constructor(opts: Object);
- /**
- * Retrieve Bucket from public key
- *
- * @param {string} public_id Bucket public key
- * @param {callback} cb description
- */
- retrieve(public_id: string, cb: Function): void;
- /**
- * Connect to bucket from public key
- *
- * @param {string} public_id Public key
- */
- connect(public_id: string): void;
- /**
- * Retrieve Bucket from ID
- *
- * @param {string} raw_id Bucket ID
- * @param {callback} cb Callback
- */
- retrieveFromID(raw_id: string, cb: Function): void;
- /**
- * Connect to bucket from id
- *
- * @param {string} raw_id Bucket Id
- */
- connectFromID(raw_id: string): void;
- /**
- * Populate all bucket information
- *
- * @param {function} cb Callback
- */
- init(cb: (() => any)): void;
- /**
- * Retrieve all bucket information
- *
- * @param {function} cb Callback
- */
- all(cb: (() => any)): void;
- /**
- * Find current user role
- *
- * @param {function} cb Callback
- */
- fetchUserRole(cb: (() => any)): void;
- /**
- * Retrieve current bucket information
- *
- * @param {function} cb Callback
- */
- get(cb: (() => any)): void;
- /**
- * Retrieve avalaible Keymetrics plans
- *
- * @param {function} cb Callback
- */
- getPlans(cb: (() => any)): void;
- /**
- * Retrieve probe data history
- *
- * @param {object} opts Options
- * @param {object} opts.app_name Application name
- * @param {object} opts.server_name Server name
- * @param {object} opts.minutes Minutes
- * @param {object} opts.interval interval
- * @param {function} cb Callback
- */
- getProbesHistory(opts: { app_name: Object, server_name: Object, minutes: Object, interval: Object }, cb: (() => any)): void;
- /**
- * Retrieve probe meta history
- *
- * @param {object} opts Options
- * @param {object} opts.app_name Application name
- * @param {object} opts.server_name Server name
- * @param {object} opts.minutes Minutes
- * @param {function} cb Callback
- */
- getProbesMeta(opts: { app_name: Object, server_name: Object, minutes: Object }, cb: (() => any)): void;
- /**
- * Retrieve servers metadata
- *
- * @param {function} cb Callback
- */
- getMetaServers(cb: (() => any)): void;
- /**
- * Save server metadata
- *
- * @param {object} server Server
- * @param {function} cb Callback
- */
- saveMetaServer(server: Object, cb: (() => any)): void;
- /**
- * Update server metadata
- *
- * @param {object} server Server
- * @param {function} cb Callback
- */
- update(server: Object, cb: (() => any)): void;
- }
- /**
- * Action
- * @memberof Keymetrics.bucket
- * @constructor
- *
- * @param {object} opts Options
- */
- declare class ActionMethods {
- /**
- * Action
- * @memberof Keymetrics.bucket
- * @constructor
- *
- * @param {object} opts Options
- */
- constructor(opts: Object);
- /**
- * Trigger action
- *
- * @param {object} opts Options
- * @param {object} opts.server_name Server Name
- * @param {object} opts.process_id Process id
- * @param {object} opts.action_name Action name
- * @param {function} cb callback
- */
- trigger(opts: { server_name: Object, process_id: Object, action_name: Object }, cb: (() => any)): void;
- /**
- * Trigger pm2 action
- *
- * @param {type} opts options
- * @param {type} opts.server_name Server name
- * @param {type} opts.method_name Method name
- * @param {type} cb callback
- */
- triggerPM2action(opts: Object, cb: Function): void;
- /**
- * Trigger scoped action
- *
- * @param {object} opts Options
- * @param {object} opts.server_name Server Name
- * @param {object} opts.action_name Action name
- * @param {object} opts.app_name App name
- * @param {object} opts.pm_id Process id
- * @param {function} cb callback
- */
- triggerScopedAction(opts: { server_name: Object, action_name: Object, app_name: Object, pm_id: Object }, cb: (() => any)): void;
- /**
- * Trigger pm2 scoped action
- *
- * @param {type} opts options
- * @param {type} cb callback
- */
- triggerPm2ScopedAction(opts: Object, cb: Function): void;
- /**
- * List scoped actions
- *
- * @param {type} opts options
- * @param {type} cb callback
- */
- listScopedActions(opts: Object, cb: Function): void;
- /**
- * Delete scoped actions
- *
- * @param {type} opts options
- * @param {type} cb callback
- */
- deleteScopedAction(opts: Object, cb: Function): void;
- }
- /**
- * Alert
- * @memberof Keymetrics.bucket
- * @constructor
- *
- * @param {object} opts Options
- */
- declare class AlertMethods {
- /**
- * Alert
- * @memberof Keymetrics.bucket
- * @constructor
- *
- * @param {object} opts Options
- */
- constructor(opts: Object);
- /**
- * Update alerts
- *
- * @param {type} cb callback
- */
- update(cb: Function): void;
- /**
- * Update Slack alerts
- *
- * @param {type} cb callback
- */
- updateSlack(cb: Function): void;
- /**
- * Update webhook alerts
- *
- * @param {type} cb callback
- */
- updateWebhook(cb: Function): void;
- /**
- * Remove event
- *
- * @param {type} cb callback
- */
- removeEvent(cb: Function): void;
- /**
- * Send report
- *
- * @param {type} cb callback
- */
- sendReport(cb: Function): void;
- }
- /**
- * Data
- * @memberof Keymetrics.bucket
- * @constructor
- *
- * @param {object} opts Options
- */
- declare class DataMethods {
- /**
- * Data
- * @memberof Keymetrics.bucket
- * @constructor
- *
- * @param {object} opts Options
- */
- constructor(opts: Object);
- /**
- * Retrieve latest pm2 version
- *
- * @param {function} cb Callback
- */
- pm2Version(cb: (() => any)): void;
- /**
- * Retrieves metadata
- *
- * @param {function} cb Callback
- */
- meta(cb: (() => any)): void;
- /**
- * Retrieves status
- *
- * @param {function} cb Callback
- */
- status(cb: (() => any)): void;
- /**
- * Retrieves logged events
- *
- * @param {object} opts Events
- * @param {function} cb Callback
- */
- events(opts: Object, cb: (() => any)): void;
- /**
- * Retrieves logged events statistics
- *
- * @param {function} cb Callback
- */
- eventsStats(cb: (() => any)): void;
- /**
- * Retrieves events
- *
- * @param {object} opts Application
- * @param {function} cb Callback
- */
- eventsSummary(opts: Object, cb: (() => any)): void;
- /**
- * Send events
- *
- * @param {function} cb Callback
- */
- processEvents(cb: (() => any)): void;
- /**
- * Retrieves monitoring values
- *
- * @param {object} opts Options
- * @param {function} cb Callback
- */
- monitoring(opts: Object, cb: (() => any)): void;
- /**
- * Retrieves exceptions
- *
- * @param {object} opts Exceptions
- * @param {function} cb Callback
- */
- exceptions(opts: Object, cb: (() => any)): void;
- /**
- * Retrieves list of deployments
- *
- * @param {object} opts Exceptions
- * @param {function} cb Callback
- */
- deploymentsListing(opts: Object, cb: (() => any)): void;
- /**
- * Retrieves summary of exceptions
- *
- * @param {object} opts Exceptions
- * @param {function} cb Callback
- */
- exceptionsSummary(opts: Object, cb: (() => any)): void;
- /**
- * Delete all logged exceptions
- *
- * @param {object} opts Exceptions
- * @param {function} cb Callback
- */
- deleteAllExceptions(opts: Object, cb: (() => any)): void;
- /**
- * Delete selected exceptions
- *
- * @param {object} opts Exceptions
- * @param {function} cb Callback
- */
- deleteExceptions(opts: Object, cb: (() => any)): void;
- /**
- * Delete selected server
- *
- * @param {object} opts Server
- * @param {function} cb Callback
- */
- deleteServer(opts: Object, cb: (() => any)): void;
- /**
- * Retrieve httpTransactionsSummary
- *
- * @param {object} opts Server
- * @param {function} cb Callback
- */
- httpTransactionsSummary(opts: Object, cb: (() => any)): void;
- /**
- * Reset httpTransactionsSummary
- *
- * @param {object} opts Server
- * @param {function} cb Callback
- */
- resethttpTransactions(opts: Object, cb: (() => any)): void;
- /**
- * Retrieve Transactions Average
- *
- * @param {function} cb Callback
- */
- getTransactionAVG(cb: (() => any)): void;
- /**
- * Retrieve Transactions Histogram
- *
- * @param {object} opts Server
- * @param {function} cb Callback
- */
- getTransactionHisto(opts: Object, cb: (() => any)): void;
- /**
- * Retrieve Data Logs
- *
- * @param {object} opts Server
- * @param {function} cb Callback
- */
- logs(opts: Object, cb: (() => any)): void;
- /**
- * Flush Data Logs
- *
- * @param {object} opts Server
- * @param {function} cb Callback
- */
- flushLogs(opts: Object, cb: (() => any)): void;
- }
- /**
- * User
- * @memberof Keymetrics.bucket
- * @constructor
- *
- * @param {object} opts Options
- */
- declare class UserMethods {
- /**
- * User
- * @memberof Keymetrics.bucket
- * @constructor
- *
- * @param {object} opts Options
- */
- constructor(opts: Object);
- /**
- * Retrieve authorized users
- *
- * @param {function} cb callback
- */
- authorized(cb: (() => any)): void;
- /**
- * Send invitation to user
- *
- * @param {function} cb callback
- */
- addUserToBucket(cb: (() => any)): void;
- /**
- * Remove user from bucket
- *
- * @param {function} cb callback
- */
- removeUser(cb: (() => any)): void;
- /**
- * Remove yourself from bucket
- *
- * @param {string} email User email
- * @param {function} cb callback
- */
- removeSelf(email: string, cb: (() => any)): void;
- /**
- * Remove invitation
- *
- * @param {string} email Invitation email
- * @param {function} cb callback
- */
- removeInvitation(email: string, cb: (() => any)): void;
- /**
- * Upgrade user permissions
- *
- * @param {string} email email
- * @param {string} role Role
- * @param {string} cb callback
- */
- upgradeUser(email: string, role: string, cb: string): void;
- /**
- * Check if current user is admin
- *
- * @param {object} user email
- * @param {string} cb callback
- */
- isAdmin(user: Object, cb: string): void;
- }
- /**
- * Authenticate
- * @alias auth
- * @constructor
- * @memberof Keymetrics
- *
- * @param {object} opts Options
- */
- declare class Authenticate {
- /**
- * Authenticate
- * @alias auth
- * @constructor
- * @memberof Keymetrics
- *
- * @param {object} opts Options
- */
- constructor(opts: Object);
- /**
- * Get access token
- *
- * @param {string} token Refresh token
- * @param {function} callback Callback
- */
- refresh(token: string, callback: (() => any)): void;
- /**
- * Starts the authentication process
- *
- * @param {object} opts
- * @param {function} callback
- */
- init(opts: Object, callback: (() => any)): void;
- /**
- * Revoke access token
- *
- * @param {function} callback
- */
- logout(callback: (() => any)): void;
- }
- /**
- * Realtime
- * @memberof Keymetrics
- * @constructor
- * @alias realtime
- *
- * @param {object} opts Options
- */
- declare class Realtime {
- /**
- * Realtime
- * @memberof Keymetrics
- * @constructor
- * @alias realtime
- *
- * @param {object} opts Options
- */
- constructor(opts: Object);
- /**
- * Register bucket and start websocket
- *
- * @param {function} cb callback
- */
- init(cb: (() => any)): void;
- /**
- * Unregister from bucket and destroy websocket connection
- * @param {function} cb callback
- */
- unregister(cb: (() => any)): void;
- }
- /**
- * User
- * @memberof Keymetrics
- * @constructor
- * @alias user
- *
- * @param {object} opts Options
- */
- declare class User {
- /**
- * User
- * @memberof Keymetrics
- * @constructor
- * @alias user
- *
- * @param {object} opts Options
- */
- constructor(opts: Object);
- /**
- * Retrieves current user from API
- *
- * @param {function} callback Callback
- */
- refreshUser(callback: (() => any)): void;
- /**
- * set the User Object variable
- *
- * @param {object} user
- */
- setUser(user: Object): void;
- /**
- * return the user object
- * @return {object}
- */
- getUser(): Object;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement