invoke method
Future<Map>
invoke(
- String method, {
- Map? parameters,
- required int clientId,
- Duration? functionTimeOut,
- bool isVoid = false,
- Duration? delayDuration,
- Duration? invokeTimeOut,
- bool? isUseCache = false,
- Duration? durationCacheExpire,
- String? extra,
- bool? isAutoGetChat,
- bool? isInvokeThrowOnError,
- FutureOr<
String> onGenerateExtraInvoke()?, - FutureOr<
Map> onGetInvokeData()?,
call api latest Tdlib-Methods example:
tg.invoke(
"getChat",
parameters: {
"chat_id": 0,
},
clientId: tg.client_id,
);
Implementation
Future<Map> invoke(
String method, {
Map? parameters,
required int clientId,
Duration? functionTimeOut,
bool isVoid = false,
Duration? delayDuration,
Duration? invokeTimeOut,
bool? isUseCache = false,
Duration? durationCacheExpire,
String? extra,
bool? isAutoGetChat,
bool? isInvokeThrowOnError,
FutureOr<String> Function(int client_id, TdlibBase libTdJson)?
onGenerateExtraInvoke,
FutureOr<Map> Function(String extra, int client_id, TdlibBase libTdJson)?
onGetInvokeData,
}) async {
isUseCache ??= false;
durationCacheExpire ??= Duration(
minutes: 1,
);
isInvokeThrowOnError ??= is_invoke_throw_on_error;
onGetInvokeData ??= on_get_invoke_data;
onGenerateExtraInvoke ??= on_generate_extra_invoke;
isAutoGetChat ??= is_auto_get_chat;
//
invokeTimeOut ??= invoke_time_out;
parameters ??= {};
parameters["@type"] = method;
return await invokeRaw(
parameters: parameters,
clientId: clientId,
isVoid: isVoid,
delayDuration: delayDuration ?? Duration(microseconds: 1),
invokeTimeOut: invokeTimeOut,
functionTimeOut: functionTimeOut ?? Duration(minutes: 15),
isUseCache: isUseCache,
durationCacheExpire: durationCacheExpire,
extra: extra ?? "",
isAutoGetChat: isAutoGetChat,
isInvokeThrowOnError: isInvokeThrowOnError,
onGenerateExtraInvoke: onGenerateExtraInvoke,
onGetInvokeData: onGetInvokeData,
);
}