import { APIResource } from "../../core/resource.mjs"; import { APIPromise } from "../../core/api-promise.mjs"; import { RequestOptions } from "../../internal/request-options.mjs"; export declare class Sessions extends APIResource { /** * List the current user's authenticated sessions with device, location, masked IP * and last-active metadata. The current session is flagged with `is_current`. */ list(params?: SessionListParams | null | undefined, options?: RequestOptions): APIPromise; /** * Revoke a single session the caller owns. Revoking the current session logs this * device out. */ delete(sessionID: string, params?: SessionDeleteParams | null | undefined, options?: RequestOptions): APIPromise; /** * Revoke every session the caller owns except the one making this request. */ deleteAll(params?: SessionDeleteAllParams | null | undefined, options?: RequestOptions): APIPromise; } /** * Response body for the revoke endpoints. */ export interface RevokeSessionsResponse { /** * Human-readable summary. */ message: string; /** * Number of StackAuth sessions revoked by this call. */ revoked_count: number; } /** * Response body for GET /auth/sessions. */ export interface SessionListResponse { /** * Sessions, current first then by last activity descending. */ sessions?: Array; } export declare namespace SessionListResponse { /** * One authenticated session in the current user's Active Sessions list. */ interface Session { /** * StackAuth session id; pass to DELETE /auth/sessions/{id} to revoke. */ id: string; /** * True for the session making this request ("This device"). */ is_current: boolean; /** * Native app name, e.g. "GLChat Mobile" (null for browsers). */ app?: string | null; /** * Browser, e.g. "Chrome" (null for native apps / unknown). */ browser?: string | null; /** * When the session was created. */ created_at?: string | null; /** * Coarse device class. */ device_type?: 'desktop' | 'mobile' | 'tablet' | 'unknown'; /** * Last time this session's token was used against StackAuth. */ last_active_at?: string | null; /** * Approximate location. */ location?: Session.Location; /** * IP with the host part redacted; never the full address. */ masked_ip?: string | null; /** * Operating system, e.g. "macOS" (null if unknown). */ os?: string | null; } namespace Session { /** * Approximate location. */ interface Location { /** * City name, if StackAuth resolved one. */ city?: string | null; /** * ISO country code, if StackAuth resolved one. */ country?: string | null; } } } export interface SessionListParams { 'Accept-Language'?: string; /** * Set to `structured` to receive errors in the structured envelope. Omit it to * keep the legacy error body. */ 'X-Error-Format'?: string; } export interface SessionDeleteParams { 'Accept-Language'?: string; /** * Set to `structured` to receive errors in the structured envelope. Omit it to * keep the legacy error body. */ 'X-Error-Format'?: string; } export interface SessionDeleteAllParams { 'Accept-Language'?: string; /** * Set to `structured` to receive errors in the structured envelope. Omit it to * keep the legacy error body. */ 'X-Error-Format'?: string; } export declare namespace Sessions { export { type RevokeSessionsResponse as RevokeSessionsResponse, type SessionListResponse as SessionListResponse, type SessionListParams as SessionListParams, type SessionDeleteParams as SessionDeleteParams, type SessionDeleteAllParams as SessionDeleteAllParams, }; } //# sourceMappingURL=sessions.d.mts.map