typing(SessionManager): fetch method return cache
This commit is contained in:
@@ -22,16 +22,12 @@ class SessionManager extends CachedManager {
|
|||||||
* @returns {Promise<Collection<string, Session>>}
|
* @returns {Promise<Collection<string, Session>>}
|
||||||
*/
|
*/
|
||||||
fetch() {
|
fetch() {
|
||||||
return this.client.api.auth.sessions
|
return this.client.api.auth.sessions.get().then(data => {
|
||||||
.get()
|
|
||||||
.then(data => {
|
|
||||||
const allData = data.user_sessions;
|
const allData = data.user_sessions;
|
||||||
|
|
||||||
this.cache.clear();
|
this.cache.clear();
|
||||||
for (const session of allData) {
|
for (const session of allData) {
|
||||||
this._add(session, true, { id: session.id_hash });
|
this._add(session, true, { id: session.id_hash });
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.cache;
|
return this.cache;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
4
typings/index.d.ts
vendored
4
typings/index.d.ts
vendored
@@ -72,7 +72,7 @@ import { AgentOptions } from 'node:https';
|
|||||||
import { Response, ProxyAgent } from 'undici';
|
import { Response, ProxyAgent } from 'undici';
|
||||||
import { Readable, Writable, Stream } from 'node:stream';
|
import { Readable, Writable, Stream } from 'node:stream';
|
||||||
import { MessagePort, Worker } from 'node:worker_threads';
|
import { MessagePort, Worker } from 'node:worker_threads';
|
||||||
import { authenticator } from "otplib";
|
import { authenticator } from 'otplib';
|
||||||
import { CookieJar } from 'tough-cookie';
|
import { CookieJar } from 'tough-cookie';
|
||||||
import { RtpPacket } from 'werift-rtp';
|
import { RtpPacket } from 'werift-rtp';
|
||||||
import * as WebSocket from 'ws';
|
import * as WebSocket from 'ws';
|
||||||
@@ -2557,7 +2557,7 @@ export class WebEmbed {
|
|||||||
|
|
||||||
export class SessionManager extends CachedManager<string, Session, any> {
|
export class SessionManager extends CachedManager<string, Session, any> {
|
||||||
private constructor(client: Client, iterable: Iterable<any>);
|
private constructor(client: Client, iterable: Iterable<any>);
|
||||||
public fetch(): Promise<this>;
|
public fetch(): Promise<Collection<string, Session>>;
|
||||||
public logoutAllDevices(): Promise<void>;
|
public logoutAllDevices(): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user