mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-09-01 08:54:08 +00:00
810 lines
27 KiB
Dart
810 lines
27 KiB
Dart
// This file is automatically generated, so please do not edit it.
|
|
// @generated by `flutter_rust_bridge`@ 2.12.0.
|
|
|
|
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
|
|
|
|
import '../api/server/prekeys.dart';
|
|
import '../frb_generated.dart';
|
|
import '../services/media_upload.dart';
|
|
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
|
|
|
// These functions are ignored because they are not marked as `pub`: `api_result`, `empty_api_response`, `from_rust_state`
|
|
// These types are ignored because they are neither used by any `pub` functions nor (for structs and enums) marked `#[frb(unignore)]`: `ApiConfig`, `ServerResult`
|
|
// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`
|
|
|
|
enum ApiConnectionState {
|
|
stopped,
|
|
connecting,
|
|
connected,
|
|
authenticating,
|
|
authenticated,
|
|
reconnecting,
|
|
suspended,
|
|
permanentlyRejected,
|
|
}
|
|
|
|
class ApiEvent {
|
|
final ApiEventKind kind;
|
|
final ApiConnectionState? state;
|
|
final String? message;
|
|
|
|
const ApiEvent({
|
|
required this.kind,
|
|
this.state,
|
|
this.message,
|
|
});
|
|
|
|
@override
|
|
int get hashCode => kind.hashCode ^ state.hashCode ^ message.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is ApiEvent &&
|
|
runtimeType == other.runtimeType &&
|
|
kind == other.kind &&
|
|
state == other.state &&
|
|
message == other.message;
|
|
}
|
|
|
|
enum ApiEventKind {
|
|
connectionStateChanged,
|
|
transportError,
|
|
authenticated,
|
|
planUpdated,
|
|
appOutdated,
|
|
newDeviceRegistered,
|
|
loginTokenMigrated,
|
|
}
|
|
|
|
class FrbAdditionalAccount {
|
|
final PlatformInt64 userId;
|
|
final String planId;
|
|
|
|
const FrbAdditionalAccount({
|
|
required this.userId,
|
|
required this.planId,
|
|
});
|
|
|
|
@override
|
|
int get hashCode => userId.hashCode ^ planId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is FrbAdditionalAccount &&
|
|
runtimeType == other.runtimeType &&
|
|
userId == other.userId &&
|
|
planId == other.planId;
|
|
}
|
|
|
|
class FrbMemoriesUploadUrls {
|
|
final String mediaId;
|
|
final FrbPresignedPost? thumbnailUpload;
|
|
final FrbPresignedPost? fullUpload;
|
|
|
|
const FrbMemoriesUploadUrls({
|
|
required this.mediaId,
|
|
this.thumbnailUpload,
|
|
this.fullUpload,
|
|
});
|
|
|
|
@override
|
|
int get hashCode =>
|
|
mediaId.hashCode ^ thumbnailUpload.hashCode ^ fullUpload.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is FrbMemoriesUploadUrls &&
|
|
runtimeType == other.runtimeType &&
|
|
mediaId == other.mediaId &&
|
|
thumbnailUpload == other.thumbnailUpload &&
|
|
fullUpload == other.fullUpload;
|
|
}
|
|
|
|
class FrbMemoriesUsage {
|
|
final PlatformInt64 currentBytes;
|
|
final PlatformInt64 count;
|
|
final PlatformInt64 maxBytes;
|
|
|
|
const FrbMemoriesUsage({
|
|
required this.currentBytes,
|
|
required this.count,
|
|
required this.maxBytes,
|
|
});
|
|
|
|
@override
|
|
int get hashCode =>
|
|
currentBytes.hashCode ^ count.hashCode ^ maxBytes.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is FrbMemoriesUsage &&
|
|
runtimeType == other.runtimeType &&
|
|
currentBytes == other.currentBytes &&
|
|
count == other.count &&
|
|
maxBytes == other.maxBytes;
|
|
}
|
|
|
|
class FrbPasswordlessNotificationMessage {
|
|
final PlatformInt64 id;
|
|
final Uint8List encryptedMessage;
|
|
|
|
const FrbPasswordlessNotificationMessage({
|
|
required this.id,
|
|
required this.encryptedMessage,
|
|
});
|
|
|
|
@override
|
|
int get hashCode => id.hashCode ^ encryptedMessage.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is FrbPasswordlessNotificationMessage &&
|
|
runtimeType == other.runtimeType &&
|
|
id == other.id &&
|
|
encryptedMessage == other.encryptedMessage;
|
|
}
|
|
|
|
class FrbPlanBalance {
|
|
final PlatformInt64 usedDailyMediaUploadLimit;
|
|
final PlatformInt64 usedUploadMediaSizeLimit;
|
|
final PlatformInt64? paymentPeriodDays;
|
|
final PlatformInt64? lastPaymentDoneUnixTimestamp;
|
|
final List<FrbAdditionalAccount> additionalAccounts;
|
|
final bool? autoRenewal;
|
|
final PlatformInt64? additionalAccountOwnerId;
|
|
|
|
const FrbPlanBalance({
|
|
required this.usedDailyMediaUploadLimit,
|
|
required this.usedUploadMediaSizeLimit,
|
|
this.paymentPeriodDays,
|
|
this.lastPaymentDoneUnixTimestamp,
|
|
required this.additionalAccounts,
|
|
this.autoRenewal,
|
|
this.additionalAccountOwnerId,
|
|
});
|
|
|
|
@override
|
|
int get hashCode =>
|
|
usedDailyMediaUploadLimit.hashCode ^
|
|
usedUploadMediaSizeLimit.hashCode ^
|
|
paymentPeriodDays.hashCode ^
|
|
lastPaymentDoneUnixTimestamp.hashCode ^
|
|
additionalAccounts.hashCode ^
|
|
autoRenewal.hashCode ^
|
|
additionalAccountOwnerId.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is FrbPlanBalance &&
|
|
runtimeType == other.runtimeType &&
|
|
usedDailyMediaUploadLimit == other.usedDailyMediaUploadLimit &&
|
|
usedUploadMediaSizeLimit == other.usedUploadMediaSizeLimit &&
|
|
paymentPeriodDays == other.paymentPeriodDays &&
|
|
lastPaymentDoneUnixTimestamp == other.lastPaymentDoneUnixTimestamp &&
|
|
additionalAccounts == other.additionalAccounts &&
|
|
autoRenewal == other.autoRenewal &&
|
|
additionalAccountOwnerId == other.additionalAccountOwnerId;
|
|
}
|
|
|
|
class FrbPresignedPost {
|
|
final String url;
|
|
final List<(String, String)> fields;
|
|
|
|
const FrbPresignedPost({
|
|
required this.url,
|
|
required this.fields,
|
|
});
|
|
|
|
@override
|
|
int get hashCode => url.hashCode ^ fields.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is FrbPresignedPost &&
|
|
runtimeType == other.runtimeType &&
|
|
url == other.url &&
|
|
fields == other.fields;
|
|
}
|
|
|
|
class FrbProofOfWork {
|
|
final String prefix;
|
|
final PlatformInt64 difficulty;
|
|
|
|
const FrbProofOfWork({
|
|
required this.prefix,
|
|
required this.difficulty,
|
|
});
|
|
|
|
@override
|
|
int get hashCode => prefix.hashCode ^ difficulty.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is FrbProofOfWork &&
|
|
runtimeType == other.runtimeType &&
|
|
prefix == other.prefix &&
|
|
difficulty == other.difficulty;
|
|
}
|
|
|
|
class FrbUserData {
|
|
final PlatformInt64 userId;
|
|
final Uint8List username;
|
|
final Uint8List publicIdentityKey;
|
|
|
|
const FrbUserData({
|
|
required this.userId,
|
|
required this.username,
|
|
required this.publicIdentityKey,
|
|
});
|
|
|
|
@override
|
|
int get hashCode =>
|
|
userId.hashCode ^ username.hashCode ^ publicIdentityKey.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is FrbUserData &&
|
|
runtimeType == other.runtimeType &&
|
|
userId == other.userId &&
|
|
username == other.username &&
|
|
publicIdentityKey == other.publicIdentityKey;
|
|
}
|
|
|
|
/// Flutter-facing facade for the Rust-owned API runtime.
|
|
class RustApi {
|
|
const RustApi();
|
|
|
|
/// Gives up on a media file whose source could not be produced, marking
|
|
/// its messages as deleted by the sender instead of retrying forever.
|
|
static Future<void> abandonMedia({required String mediaId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiAbandonMedia(mediaId: mediaId);
|
|
|
|
static Future<void> addAdditionalUser({required PlatformInt64 userId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiAddAdditionalUser(
|
|
userId: userId,
|
|
);
|
|
|
|
static Future<BigInt> allocateSequence() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiAllocateSequence();
|
|
|
|
static String apiBaseUrl({required String protocol}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiApiBaseUrl(protocol: protocol);
|
|
|
|
static Future<Map<String, String>> authenticationHeaders() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiAuthenticationHeaders();
|
|
|
|
static String avatarPngPath({
|
|
required PlatformInt64 contactId,
|
|
required PlatformInt64 profileCounter,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiAvatarPngPath(
|
|
contactId: contactId,
|
|
profileCounter: profileCounter,
|
|
);
|
|
|
|
static Future<void> changeUsername({required String username}) => RustLib
|
|
.instance
|
|
.api
|
|
.crateBridgeApiRustApiChangeUsername(username: username);
|
|
|
|
static Future<void> checkForDeletedUsernames() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiCheckForDeletedUsernames();
|
|
|
|
static Future<List<FrbPasswordlessNotificationMessage>>
|
|
checkForPasswordlessNotification({
|
|
required String notificationId,
|
|
required List<int> downloadAuthToken,
|
|
required Int64List alreadyReceivedMessageIds,
|
|
}) => RustLib.instance.api
|
|
.crateBridgeApiRustApiCheckForPasswordlessNotification(
|
|
notificationId: notificationId,
|
|
downloadAuthToken: downloadAuthToken,
|
|
alreadyReceivedMessageIds: alreadyReceivedMessageIds,
|
|
);
|
|
|
|
/// Acknowledges the pending contact-request notifications and returns the
|
|
/// native notification IDs to withdraw.
|
|
static Future<List<String>> clearContactRequestNotifications() => RustLib
|
|
.instance
|
|
.api
|
|
.crateBridgeApiRustApiClearContactRequestNotifications();
|
|
|
|
/// Acknowledges every pending notification of a conversation the user just
|
|
/// opened and returns the native notification IDs to withdraw.
|
|
static Future<List<String>> clearConversationNotifications({
|
|
required String conversationId,
|
|
}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiClearConversationNotifications(
|
|
conversationId: conversationId,
|
|
);
|
|
|
|
static Future<void> close() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiClose();
|
|
|
|
static Future<void> confirmMemoriesUpload({required String mediaId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiConfirmMemoriesUpload(
|
|
mediaId: mediaId,
|
|
);
|
|
|
|
static Future<void> connect() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiConnect();
|
|
|
|
static Future<ApiConnectionState> connectionState() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiConnectionState();
|
|
|
|
/// Trims fully transparent borders an editor left around a stored image and
|
|
/// refreshes the preview and content hash derived from it.
|
|
static Future<void> cropMediaTransparentBorders({required String mediaId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiCropMediaTransparentBorders(
|
|
mediaId: mediaId,
|
|
);
|
|
|
|
static Future<String?> currentUserAvatarPath() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiCurrentUserAvatarPath();
|
|
|
|
static String decodeAvatarSvg({required List<int> avatarSvgCompressed}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiDecodeAvatarSvg(
|
|
avatarSvgCompressed: avatarSvgCompressed,
|
|
);
|
|
|
|
static Future<void> deleteAccount() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiDeleteAccount();
|
|
|
|
static Future<void> deleteMemory({required String mediaId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiDeleteMemory(mediaId: mediaId);
|
|
|
|
static Future<void> disableMemoriesBackup() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiDisableMemoriesBackup();
|
|
|
|
static Future<void> downloadDone({required List<int> token}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiDownloadDone(token: token);
|
|
|
|
static Future<void> downloadMedia({required String mediaId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiDownloadMedia(mediaId: mediaId);
|
|
|
|
static Future<void> downloadPendingMedia() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiDownloadPendingMedia();
|
|
|
|
/// Path to a contact's avatar PNG, rendered from the stored SVG if it is
|
|
/// missing. Returns `None` when the contact has no avatar at all.
|
|
static Future<String?> ensureAvatarPng({required PlatformInt64 contactId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiEnsureAvatarPng(
|
|
contactId: contactId,
|
|
);
|
|
|
|
static Future<void> establishSignalSession({
|
|
required PlatformInt64 contactId,
|
|
Uint8List? expectedPublicKey,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiEstablishSignalSession(
|
|
contactId: contactId,
|
|
expectedPublicKey: expectedPublicKey,
|
|
);
|
|
|
|
static Stream<ApiEvent> events() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiEvents();
|
|
|
|
/// Settles every background transfer this device believes is still in
|
|
/// flight and resumes any upload a terminated process left behind.
|
|
static Future<void> finishStartedMediaUploads() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiFinishStartedMediaUploads();
|
|
|
|
static Future<void> forceIpaCheck() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiForceIpaCheck();
|
|
|
|
static Future<String> getMemoriesUrl({
|
|
required String mediaId,
|
|
required bool thumbnail,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiGetMemoriesUrl(
|
|
mediaId: mediaId,
|
|
thumbnail: thumbnail,
|
|
);
|
|
|
|
static Future<FrbMemoriesUsage> getMemoriesUsage() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiGetMemoriesUsage();
|
|
|
|
static Future<FrbPlanBalance> getPlanBalance() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiGetPlanBalance();
|
|
|
|
static Future<FrbProofOfWork> getProofOfWork() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiGetProofOfWork();
|
|
|
|
static Future<Uint8List> getServerKeyForPasswordlessRecovery({
|
|
required PlatformInt64 userId,
|
|
required List<int> serverKeyProtection,
|
|
Uint8List? pinUnlockToken,
|
|
Uint8List? pinProtectionKey,
|
|
String? email,
|
|
}) => RustLib.instance.api
|
|
.crateBridgeApiRustApiGetServerKeyForPasswordlessRecovery(
|
|
userId: userId,
|
|
serverKeyProtection: serverKeyProtection,
|
|
pinUnlockToken: pinUnlockToken,
|
|
pinProtectionKey: pinProtectionKey,
|
|
email: email,
|
|
);
|
|
|
|
static Future<FrbUserData> getUserById({required PlatformInt64 userId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiGetUserById(userId: userId);
|
|
|
|
static Future<FrbUserData> getUserData({required String username}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiGetUserData(username: username);
|
|
|
|
static Future<PlatformInt64> getUserIdFromUsername({
|
|
required String username,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiGetUserIdFromUsername(
|
|
username: username,
|
|
);
|
|
|
|
/// Creates the media row and its content-encryption material and returns
|
|
/// the media id the UI addresses every later step by.
|
|
static Future<String> initializeMediaUpload({
|
|
required String mediaType,
|
|
PlatformInt64? displayLimitInMilliseconds,
|
|
required bool isDraftMedia,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiInitializeMediaUpload(
|
|
mediaType: mediaType,
|
|
displayLimitInMilliseconds: displayLimitInMilliseconds,
|
|
isDraftMedia: isDraftMedia,
|
|
);
|
|
|
|
static Future<String> insertAndSendAdditionalData({
|
|
required String groupId,
|
|
required String messageType,
|
|
required List<int> additionalData,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiInsertAndSendAdditionalData(
|
|
groupId: groupId,
|
|
messageType: messageType,
|
|
additionalData: additionalData,
|
|
);
|
|
|
|
static Future<String> insertAndSendAskAboutUser({
|
|
required PlatformInt64 contactId,
|
|
required PlatformInt64 askAboutUserId,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiInsertAndSendAskAboutUser(
|
|
contactId: contactId,
|
|
askAboutUserId: askAboutUserId,
|
|
);
|
|
|
|
static Future<String> insertAndSendContactShare({
|
|
required String groupId,
|
|
required Int64List contactIds,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiInsertAndSendContactShare(
|
|
groupId: groupId,
|
|
contactIds: contactIds,
|
|
);
|
|
|
|
static Future<String> insertAndSendText({
|
|
required String groupId,
|
|
required String text,
|
|
String? quoteMessageId,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiInsertAndSendText(
|
|
groupId: groupId,
|
|
text: text,
|
|
quoteMessageId: quoteMessageId,
|
|
);
|
|
|
|
static Future<void> ipaPurchase({
|
|
required String productId,
|
|
required String source,
|
|
required String verificationData,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiIpaPurchase(
|
|
productId: productId,
|
|
source: source,
|
|
verificationData: verificationData,
|
|
);
|
|
|
|
static Future<FrbPlanBalance> loadPlanBalance() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiLoadPlanBalance();
|
|
|
|
/// Explains a send that stopped because the media was too large: the size
|
|
/// it reached and the largest single object the plan accepts.
|
|
static Future<MediaSizeReport> mediaSizeLimitReport({
|
|
required String mediaId,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiMediaSizeLimitReport(
|
|
mediaId: mediaId,
|
|
);
|
|
|
|
/// Reports that a Flutter plugin step finished so Rust can record the
|
|
/// derived state (thumbnail present, crop analyzed, new size and hash).
|
|
static Future<void> mediaStepFinished({
|
|
required String mediaId,
|
|
required String kind,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiMediaStepFinished(
|
|
mediaId: mediaId,
|
|
kind: kind,
|
|
);
|
|
|
|
/// The number of pending notification events. iOS cannot derive its app
|
|
/// icon badge from the delivered alerts, so the running app pushes this
|
|
/// into `UNUserNotificationCenter` whenever the outbox changes.
|
|
static Future<PlatformInt64> notificationBadgeCount() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiNotificationBadgeCount();
|
|
|
|
static Future<void> notifyMessagesOpened({
|
|
required PlatformInt64 contactId,
|
|
required List<String> messageIds,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiNotifyMessagesOpened(
|
|
contactId: contactId,
|
|
messageIds: messageIds,
|
|
);
|
|
|
|
static Future<void> performPasswordlessRecoveryHeartbeat() => RustLib
|
|
.instance
|
|
.api
|
|
.crateBridgeApiRustApiPerformPasswordlessRecoveryHeartbeat();
|
|
|
|
/// Deletes temporary media whose messages are finished with it.
|
|
static Future<void> purgeMediaTempFolder() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiPurgeMediaTempFolder();
|
|
|
|
static Future<PlatformInt64> register({
|
|
required String username,
|
|
required PlatformInt64 proofOfWork,
|
|
required String langCode,
|
|
required bool isIos,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiRegister(
|
|
username: username,
|
|
proofOfWork: proofOfWork,
|
|
langCode: langCode,
|
|
isIos: isIos,
|
|
);
|
|
|
|
static Future<void> registerPasswordlessNotification({
|
|
required String notificationId,
|
|
required List<int> downloadAuthToken,
|
|
required String langCode,
|
|
String? googleFcm,
|
|
}) => RustLib.instance.api
|
|
.crateBridgeApiRustApiRegisterPasswordlessNotification(
|
|
notificationId: notificationId,
|
|
downloadAuthToken: downloadAuthToken,
|
|
langCode: langCode,
|
|
googleFcm: googleFcm,
|
|
);
|
|
|
|
static Future<void> registerPasswordlessRecovery({
|
|
required List<int> encryptedServerKey,
|
|
Uint8List? pinUnlockToken,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiRegisterPasswordlessRecovery(
|
|
encryptedServerKey: encryptedServerKey,
|
|
pinUnlockToken: pinUnlockToken,
|
|
);
|
|
|
|
/// Reloads identity and authentication settings from Rust-owned storage.
|
|
/// No configuration values are accepted from the caller.
|
|
static Future<void> reloadConfiguration() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiReloadConfiguration();
|
|
|
|
static Future<void> removeAdditionalUser({required PlatformInt64 userId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiRemoveAdditionalUser(
|
|
userId: userId,
|
|
);
|
|
|
|
/// Deletes every file of a media item while keeping its row.
|
|
static Future<void> removeMediaFiles({required String mediaId}) => RustLib
|
|
.instance
|
|
.api
|
|
.crateBridgeApiRustApiRemoveMediaFiles(mediaId: mediaId);
|
|
|
|
static Future<void> reportUser({
|
|
required PlatformInt64 userId,
|
|
required String reason,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiReportUser(
|
|
userId: userId,
|
|
reason: reason,
|
|
);
|
|
|
|
/// Sends a protobuf ClientToServer envelope. Rust assigns the sequence ID
|
|
/// and resolves this future with the matching ServerToClient response.
|
|
static Future<Uint8List> requestBinary({required List<int> bytes}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiRequestBinary(bytes: bytes);
|
|
|
|
static Future<void> requestContactByUsername({required String username}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiRequestContactByUsername(
|
|
username: username,
|
|
);
|
|
|
|
static Future<void> requestMediaReupload({required String mediaId}) => RustLib
|
|
.instance
|
|
.api
|
|
.crateBridgeApiRustApiRequestMediaReupload(mediaId: mediaId);
|
|
|
|
static Future<FrbMemoriesUploadUrls> requestMemoriesUpload({
|
|
required PlatformInt64 size,
|
|
required PlatformInt64 originalDate,
|
|
required String mediaId,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiRequestMemoriesUpload(
|
|
size: size,
|
|
originalDate: originalDate,
|
|
mediaId: mediaId,
|
|
);
|
|
|
|
static Future<void> retransmitAllMessages() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiRetransmitAllMessages();
|
|
|
|
static Future<void> retryPendingMediaReuploads() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiRetryPendingMediaReuploads();
|
|
|
|
/// Retries the media sends whose receipts are still marked for retry.
|
|
static Future<void> reuploadPendingMedia() =>
|
|
RustLib.instance.api.crateBridgeApiRustApiReuploadPendingMedia();
|
|
|
|
/// Exports a stored media file to the user's photo library.
|
|
static Future<void> saveMediaToGallery({required String mediaId}) => RustLib
|
|
.instance
|
|
.api
|
|
.crateBridgeApiRustApiSaveMediaToGallery(mediaId: mediaId);
|
|
|
|
static Future<void> sendBinary({required List<int> bytes}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiSendBinary(bytes: bytes);
|
|
|
|
static Future<void> sendContactProfile({required PlatformInt64 contactId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiSendContactProfile(
|
|
contactId: contactId,
|
|
);
|
|
|
|
static Future<Uint8List?> sendEncryptedContent({
|
|
required PlatformInt64 contactId,
|
|
required List<int> content,
|
|
String? messageId,
|
|
bool? onlySendIfNoReceiptsAreOpen,
|
|
bool? onlyReturnEncryptedData,
|
|
bool? blocking,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiSendEncryptedContent(
|
|
contactId: contactId,
|
|
content: content,
|
|
messageId: messageId,
|
|
onlySendIfNoReceiptsAreOpen: onlySendIfNoReceiptsAreOpen,
|
|
onlyReturnEncryptedData: onlyReturnEncryptedData,
|
|
blocking: blocking,
|
|
);
|
|
|
|
static Future<void> sendEncryptedContentToGroup({
|
|
required String groupId,
|
|
required List<int> content,
|
|
String? messageId,
|
|
bool? onlySendIfNoReceiptsAreOpen,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiSendEncryptedContentToGroup(
|
|
groupId: groupId,
|
|
content: content,
|
|
messageId: messageId,
|
|
onlySendIfNoReceiptsAreOpen: onlySendIfNoReceiptsAreOpen,
|
|
);
|
|
|
|
/// Creates one outgoing message per selected group and starts the upload.
|
|
static Future<void> sendMediaToGroups({
|
|
required String mediaId,
|
|
required List<String> groupIds,
|
|
Uint8List? additionalMessageData,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiSendMediaToGroups(
|
|
mediaId: mediaId,
|
|
groupIds: groupIds,
|
|
additionalMessageData: additionalMessageData,
|
|
);
|
|
|
|
static Future<void> sendQueuedMessage({required String receiptId}) => RustLib
|
|
.instance
|
|
.api
|
|
.crateBridgeApiRustApiSendQueuedMessage(receiptId: receiptId);
|
|
|
|
static Future<void> sendTextMessage({
|
|
required PlatformInt64 userId,
|
|
required List<int> body,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiSendTextMessage(
|
|
userId: userId,
|
|
body: body,
|
|
);
|
|
|
|
static Future<void> sendTyping({
|
|
required String groupId,
|
|
required bool isTyping,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiSendTyping(
|
|
groupId: groupId,
|
|
isTyping: isTyping,
|
|
);
|
|
|
|
static Future<void> setBackground({required bool inBackground}) => RustLib
|
|
.instance
|
|
.api
|
|
.crateBridgeApiRustApiSetBackground(inBackground: inBackground);
|
|
|
|
static Future<void> setLoginToken({required List<int> token}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiSetLoginToken(token: token);
|
|
|
|
static Future<void> setMediaDisplayLimit({
|
|
required String mediaId,
|
|
PlatformInt64? displayLimitInMilliseconds,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiSetMediaDisplayLimit(
|
|
mediaId: mediaId,
|
|
displayLimitInMilliseconds: displayLimitInMilliseconds,
|
|
);
|
|
|
|
static Future<void> setMediaRequiresAuthentication({
|
|
required String mediaId,
|
|
required bool requiresAuthentication,
|
|
}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiSetMediaRequiresAuthentication(
|
|
mediaId: mediaId,
|
|
requiresAuthentication: requiresAuthentication,
|
|
);
|
|
|
|
static Future<void> setNetworkAvailable({required bool available}) => RustLib
|
|
.instance
|
|
.api
|
|
.crateBridgeApiRustApiSetNetworkAvailable(available: available);
|
|
|
|
static Future<void> storeMedia({required String mediaId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiStoreMedia(mediaId: mediaId);
|
|
|
|
static Future<void> submitRecoveryShare({
|
|
required String notificationId,
|
|
required List<int> encryptedMessage,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiSubmitRecoveryShare(
|
|
notificationId: notificationId,
|
|
encryptedMessage: encryptedMessage,
|
|
);
|
|
|
|
static Future<void> toggleMediaRemoveAudio({required String mediaId}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiToggleMediaRemoveAudio(
|
|
mediaId: mediaId,
|
|
);
|
|
|
|
static Future<bool> tryRequestContactById({
|
|
required PlatformInt64 contactId,
|
|
required List<int> expectedPublicKey,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiTryRequestContactById(
|
|
contactId: contactId,
|
|
expectedPublicKey: expectedPublicKey,
|
|
);
|
|
|
|
static Future<void> updateFcmToken({required String token}) =>
|
|
RustLib.instance.api.crateBridgeApiRustApiUpdateFcmToken(token: token);
|
|
|
|
static Future<void> updateSignedPreKey({
|
|
required PlatformInt64 id,
|
|
required List<int> key,
|
|
required List<int> signature,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiUpdateSignedPreKey(
|
|
id: id,
|
|
key: key,
|
|
signature: signature,
|
|
);
|
|
|
|
static Future<void> uploadPqcPreKeys({
|
|
required List<int> publicIdentityKey,
|
|
required PlatformInt64 registrationId,
|
|
required PlatformInt64 eccSignedPrekeyId,
|
|
required List<int> eccSignedPrekey,
|
|
required List<int> eccSignedPrekeySignature,
|
|
required PlatformInt64 kyberSignedPrekeyId,
|
|
required List<int> kyberSignedPrekey,
|
|
required List<int> kyberSignedPrekeySignature,
|
|
required List<PqcPreKeyInput> prekeys,
|
|
}) => RustLib.instance.api.crateBridgeApiRustApiUploadPqcPreKeys(
|
|
publicIdentityKey: publicIdentityKey,
|
|
registrationId: registrationId,
|
|
eccSignedPrekeyId: eccSignedPrekeyId,
|
|
eccSignedPrekey: eccSignedPrekey,
|
|
eccSignedPrekeySignature: eccSignedPrekeySignature,
|
|
kyberSignedPrekeyId: kyberSignedPrekeyId,
|
|
kyberSignedPrekey: kyberSignedPrekey,
|
|
kyberSignedPrekeySignature: kyberSignedPrekeySignature,
|
|
prekeys: prekeys,
|
|
);
|
|
|
|
@override
|
|
int get hashCode => 0;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is RustApi && runtimeType == other.runtimeType;
|
|
}
|