UNPKG

vk-io

Version:

Modern VK API SDK for Node.js

47 lines (46 loc) 1.34 kB
import { API } from '../../api'; import { Upload } from '../../upload'; import { kSerializeData, UpdateSource } from '../../utils/constants'; export type ContextDefaultState = Record<string, any>; export interface IContextOptions<P, S, Type extends string = string, SubType extends string = string> { api: API; upload: Upload; type: Type; subTypes: SubType[]; payload: P; state?: S; source: UpdateSource; updateType: string | number; groupId?: number; } export type ContextFactoryOptions<P, S> = Omit<IContextOptions<P, S>, 'type' | 'subTypes'>; export declare class Context<P = object, S = ContextDefaultState, Type extends string = string, SubType extends string = string> { type: Type; subTypes: SubType[]; state: S; protected api: API; protected upload: Upload; $groupId?: number; protected payload: P; [key: string]: any; /** * Constructor */ constructor(options: IContextOptions<P, S, Type, SubType>); /** * Returns custom tag */ get [Symbol.toStringTag](): string; /** * Checks whether the context of some of these types */ is(rawTypes: (Type | SubType)[]): boolean; /** * Returns data for JSON */ toJSON(): object; /** * Returns the custom data */ [kSerializeData](): object; }