2020-10-31 02:10:44 +00:00
|
|
|
import { AuthSentCode } from "./layer";
|
2020-10-03 23:10:57 +00:00
|
|
|
import type { ApiError } from "./lib/mtproto/apiManager";
|
|
|
|
|
2020-06-13 08:19:39 +00:00
|
|
|
export type InvokeApiOptions = Partial<{
|
|
|
|
dcID: number,
|
2020-10-07 13:57:33 +00:00
|
|
|
floodMaxTimeout: number,
|
|
|
|
noErrorBox: true,
|
|
|
|
fileUpload: true,
|
|
|
|
ignoreErrors: true,
|
|
|
|
fileDownload: true,
|
|
|
|
createNetworker: true,
|
|
|
|
singleInRequest: true,
|
2020-06-13 08:19:39 +00:00
|
|
|
startMaxLength: number,
|
|
|
|
|
2020-10-15 16:54:54 +00:00
|
|
|
prepareTempMessageID: string,
|
2020-06-13 08:19:39 +00:00
|
|
|
afterMessageID: string,
|
2020-10-07 13:57:33 +00:00
|
|
|
resultType: string,
|
2020-06-13 08:19:39 +00:00
|
|
|
|
2020-10-15 16:54:54 +00:00
|
|
|
timeout: number,
|
2020-06-13 08:19:39 +00:00
|
|
|
waitTime: number,
|
|
|
|
stopTime: number,
|
|
|
|
rawError: any
|
2020-08-18 18:31:30 +00:00
|
|
|
}>;
|
|
|
|
|
2020-08-28 11:25:43 +00:00
|
|
|
export type WorkerTaskTemplate = {
|
|
|
|
type: string,
|
|
|
|
id: number,
|
2020-10-03 23:10:57 +00:00
|
|
|
payload?: any,
|
|
|
|
error?: ApiError
|
2020-08-28 15:11:25 +00:00
|
|
|
};
|
|
|
|
|
2020-09-17 19:33:23 +00:00
|
|
|
export type Modify<T, R> = Omit<T, keyof R> & R;
|
2020-09-23 20:29:53 +00:00
|
|
|
|
|
|
|
//export type Parameters<T> = T extends (... args: infer T) => any ? T : never;
|
|
|
|
|
2020-10-31 02:10:44 +00:00
|
|
|
export type ArgumentTypes<F extends Function> = F extends (...args: infer A) => any ? A : never;
|
|
|
|
|
|
|
|
export type AuthState = AuthState.signIn | AuthState.authCode | AuthState.password | AuthState.signUp | AuthState.signedIn;
|
|
|
|
export namespace AuthState {
|
|
|
|
export type signIn = {
|
|
|
|
_: 'authStateSignIn'
|
|
|
|
};
|
|
|
|
|
|
|
|
export type authCode = {
|
|
|
|
_: 'authStateAuthCode',
|
|
|
|
sentCode: AuthSentCode.authSentCode
|
|
|
|
};
|
|
|
|
|
|
|
|
export type password = {
|
|
|
|
_: 'authStatePassword'
|
|
|
|
};
|
|
|
|
|
|
|
|
export type signUp = {
|
|
|
|
_: 'authStateSignUp',
|
|
|
|
authCode: {
|
|
|
|
phone_number: string,
|
|
|
|
phone_code_hash: string
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export type signedIn = {
|
|
|
|
_: 'authStateSignedIn'
|
|
|
|
};
|
|
|
|
}
|