UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

55 lines • 2.08 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../core/resource.mjs"; import { SinglePage } from "../../../../core/pagination.mjs"; import { path } from "../../../../internal/utils/path.mjs"; export var BaseActiveSessions = /* @__PURE__ */ (() => { class BaseActiveSessions extends APIResource { /** * Get active sessions for a single user. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const activeSessionListResponse of client.zeroTrust.access.users.activeSessions.list( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(userID, params, options) { const { account_id } = params; return this._client.getAPIList(path `/accounts/${account_id}/access/users/${userID}/active_sessions`, (SinglePage), options); } /** * Get an active session for a single user. * * @example * ```ts * const activeSession = * await client.zeroTrust.access.users.activeSessions.get( * 'X1aXj1lFVcqqyoXF', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * user_id: 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * }, * ); * ``` */ get(nonce, params, options) { const { account_id, user_id } = params; return this._client.get(path `/accounts/${account_id}/access/users/${user_id}/active_sessions/${nonce}`, options)._thenUnwrap((obj) => obj.result); } } BaseActiveSessions._key = Object.freeze([ 'zeroTrust', 'access', 'users', 'activeSessions', ]); return BaseActiveSessions; })(); export class ActiveSessions extends BaseActiveSessions { } //# sourceMappingURL=active-sessions.mjs.map