mirror of
https://github.com/langgenius/dify.git
synced 2026-06-17 23:21:12 +08:00
Co-authored-by: GareArc <garethcxy@dify.ai> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: L1nSn0w <l1nsn0w@qq.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: gigglewang <gigglewang@dify.ai> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
23 lines
610 B
TypeScript
23 lines
610 B
TypeScript
import type { SessionListResponse } from '@dify/contracts/api/openapi/types.gen'
|
|
import type { KyInstance } from 'ky'
|
|
|
|
export class AccountSessionsClient {
|
|
private readonly http: KyInstance
|
|
|
|
constructor(http: KyInstance) {
|
|
this.http = http
|
|
}
|
|
|
|
async list(): Promise<SessionListResponse> {
|
|
return this.http.get('account/sessions').json<SessionListResponse>()
|
|
}
|
|
|
|
async revoke(sessionId: string): Promise<void> {
|
|
await this.http.delete(`account/sessions/${encodeURIComponent(sessionId)}`)
|
|
}
|
|
|
|
async revokeSelf(): Promise<void> {
|
|
await this.http.delete('account/sessions/self')
|
|
}
|
|
}
|