import type { Serialized } from '@rocket.chat/core-typings'; import type { MatchPathPattern, OperationParams, OperationResult, PathFor, PathWithParamsFor, PathWithoutParamsFor, } from '@rocket.chat/rest-typings'; type Next any> = (...args: Parameters) => ReturnType; export type Middleware any> = (context: Parameters, next: Next) => ReturnType; // eslint-disable-next-line @typescript-eslint/naming-convention export interface RestClientInterface { get, TPath extends PathWithParamsFor<'GET'> = PathWithParamsFor<'GET'>>( endpoint: TPath, params: OperationParams<'GET', TPathPattern>, options?: Omit, ): Promise>>; get, TPath extends PathWithoutParamsFor<'GET'> = PathWithoutParamsFor<'GET'>>( endpoint: TPath, params?: undefined, options?: Omit, ): Promise>>; post, TPath extends PathWithParamsFor<'POST'> = PathWithParamsFor<'POST'>>( endpoint: TPath, params: OperationParams<'POST', TPathPattern>, options?: Omit, ): Promise>>; post, TPath extends PathWithoutParamsFor<'POST'> = PathWithoutParamsFor<'POST'>>( endpoint: TPath, params?: undefined, options?: Omit, ): Promise>>; put, TPath extends PathWithParamsFor<'PUT'> = PathWithParamsFor<'PUT'>>( endpoint: TPath, params: OperationParams<'PUT', TPathPattern>, options?: Omit, ): Promise>>; put, TPath extends PathWithoutParamsFor<'PUT'> = PathWithoutParamsFor<'PUT'>>( endpoint: TPath, params?: undefined, options?: Omit, ): Promise>>; delete, TPath extends PathWithParamsFor<'DELETE'> = PathWithParamsFor<'DELETE'>>( endpoint: TPath, params: OperationParams<'DELETE', TPathPattern>, options?: Omit, ): Promise>>; delete, TPath extends PathWithoutParamsFor<'DELETE'> = PathWithoutParamsFor<'DELETE'>>( endpoint: TPath, params?: undefined, options?: Omit, ): Promise>>; upload>( endpoint: TPath, params: void extends OperationParams<'POST', MatchPathPattern> ? void : OperationParams<'POST', MatchPathPattern>, events?: { load?: (event: ProgressEvent) => void; progress?: (event: ProgressEvent) => void; abort?: (event: ProgressEvent) => void; error?: (event: ProgressEvent) => void; }, ): XMLHttpRequest; getCredentials(): | { 'X-User-Id': string; 'X-Auth-Token': string; } | undefined; setCredentials(credentials: undefined | { 'X-User-Id': string; 'X-Auth-Token': string }): void; use(middleware: Middleware): void; send(endpoint: string, method: string, options: Omit): Promise; }