SHA256
Merge origin/main: умный поиск каналов и пользователей
This commit is contained in:
@@ -3206,8 +3206,23 @@ export class AuthService {
|
||||
return response.payload || {};
|
||||
}
|
||||
|
||||
async searchChannels(query, { limit = 10, ownerLogin = '' } = {}) {
|
||||
const payload = { query, limit };
|
||||
if (ownerLogin) payload.ownerLogin = ownerLogin;
|
||||
const response = await this.ws.request('SearchChannels', payload);
|
||||
if (response.status !== 200) throw opError('SearchChannels', response);
|
||||
return Array.isArray(response.payload?.channels) ? response.payload.channels : [];
|
||||
}
|
||||
|
||||
async searchPeople(query, { limit = 10 } = {}) {
|
||||
const response = await this.ws.request('SearchUsers', { prefix: query, limit });
|
||||
if (response.status !== 200) throw opError('SearchUsers', response);
|
||||
return Array.isArray(response.payload?.users) ? response.payload.users : [];
|
||||
}
|
||||
|
||||
async searchUsers(prefix, options = {}) {
|
||||
const payload = { prefix };
|
||||
if (Number.isInteger(options?.limit)) payload.limit = options.limit;
|
||||
if (typeof options?.isServer === 'boolean') {
|
||||
payload.isServer = options.isServer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user