import type { AtLeast, IPushToken, IUser } from '@rocket.chat/core-typings'; import type { DeleteResult, InsertOneResult, UpdateResult, FindCursor, Document } from 'mongodb'; import type { IBaseModel } from './IBaseModel'; import type { DocumentWithProjection, FindOptionsWithProjection } from '../types/DocumentWithProjection'; export interface IPushTokenModel extends IBaseModel { countTokensByUserId(userId: IUser['_id']): Promise; countGcmTokens(): Promise; countApnTokens(): Promise; findOneByTokenAndAppName(token: IPushToken['token'], appName: IPushToken['appName']): Promise; findFirstByUserId = FindOptionsWithProjection>( userId: IUser['_id'], options?: O, ): Promise | null>; findAllTokensByUserId = FindOptionsWithProjection>( userId: IUser['_id'], options?: O, ): FindCursor>; findTokensByUserIdExceptId = FindOptionsWithProjection>( userId: IUser['_id'], idToIgnore: IPushToken['_id'], options?: O, ): FindCursor>; insertToken(data: AtLeast): Promise>; refreshTokenById( id: IPushToken['_id'], data: Pick, ): Promise>; removeByUserIdExceptTokens(userId: string, tokens: IPushToken['authToken'][]): Promise; removeDuplicateTokens(tokenData: Pick): Promise; removeAllByUserId(userId: string): Promise; removeAllByTokenStringAndUserId(token: string, userId: string): Promise; removeOrUnsetByTokenString(token: string): Promise; }