The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-api/server/v1/spotlight.js

27 lines
550 B

/**
This API returns the result of a query of rooms
and users, using Meteor's Spotlight method.
Method: GET
Route: api/v1/spotlight
Query params:
- query: The term to be searched.
*/
RocketChat.API.v1.addRoute('spotlight', { authRequired: true }, {
get() {
check(this.queryParams, {
query: String
});
const { query } = this.queryParams;
const result = Meteor.runAsUser(this.userId, () =>
Meteor.call('spotlight', query, null, {
rooms: true,
users: true
})
);
return RocketChat.API.v1.success(result);
}
});