UNPKG

unifi-client

Version:

NodeJs client for Unifi products (https://www.ui.com/)

55 lines (54 loc) 1.52 kB
import { IUnknownClient } from './IUnknownClient'; import { _ObjectSubSite } from '../commons/_ObjectSubSite'; import { Client } from './Client'; import { macAddress, unifiId } from '../commons'; export type partialClient = Partial<IUnknownClient> & { mac: string; }; export interface IClientListParams { blocked?: true; type?: 'all' | 'blocked' | string; conn?: 'all' | string; /** * clients within last X hours */ within?: number; } export declare class Clients extends _ObjectSubSite { create(client: partialClient): Promise<Client | undefined>; /** * get a client by _id * @param _id - unifiId */ getById(_id: unifiId): Promise<Client | undefined>; /** * get a Client by mac * call /stat/sta/:mac ( seems to return same as /stat/user/:mac ) * @param mac - the macAddress */ getByMac(mac: macAddress): Promise<Client | undefined>; list2(params?: IClientListParams): Promise<Array<Client>>; list3(params?: IClientListParams): Promise<Array<Client>>; /** * Use this function to list clients * * example to get all blocked user in the last 10 hours * ``` * list({ * type: 'blocked', * conn: 'all', * within: 10 * }); * ``` * * example to get all user from the last 2 hours * ``` * list({ * type: 'all', * conn: 'all', * within: 2 * }); * ``` */ list(params?: IClientListParams): Promise<Array<Client>>; }