Skip to content

Commit 127d0e9

Browse files
feat: add rust method to upload chat media (#739)
* feat: add rust method to upload chat media
1 parent 32ca49c commit 127d0e9

File tree

9 files changed

+632
-13
lines changed

9 files changed

+632
-13
lines changed

lib/src/rust/api/media_files.dart

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// This file is automatically generated, so please do not edit it.
2+
// @generated by `flutter_rust_bridge`@ 2.11.1.
3+
4+
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
5+
6+
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
7+
8+
import '../frb_generated.dart';
9+
import 'error.dart';
10+
11+
// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `clone`, `fmt`, `fmt`, `from`, `from`
12+
13+
Future<MediaFile> uploadChatMedia({
14+
required String accountPubkey,
15+
required String groupId,
16+
required String filePath,
17+
}) => RustLib.instance.api.crateApiMediaFilesUploadChatMedia(
18+
accountPubkey: accountPubkey,
19+
groupId: groupId,
20+
filePath: filePath,
21+
);
22+
23+
class FileMetadata {
24+
final String? originalFilename;
25+
final String? dimensions;
26+
final String? blurhash;
27+
28+
const FileMetadata({
29+
this.originalFilename,
30+
this.dimensions,
31+
this.blurhash,
32+
});
33+
34+
@override
35+
int get hashCode => originalFilename.hashCode ^ dimensions.hashCode ^ blurhash.hashCode;
36+
37+
@override
38+
bool operator ==(Object other) =>
39+
identical(this, other) ||
40+
other is FileMetadata &&
41+
runtimeType == other.runtimeType &&
42+
originalFilename == other.originalFilename &&
43+
dimensions == other.dimensions &&
44+
blurhash == other.blurhash;
45+
}
46+
47+
class MediaFile {
48+
final String id;
49+
final String mlsGroupId;
50+
final String accountPubkey;
51+
final String filePath;
52+
final String fileHash;
53+
final String mimeType;
54+
final String mediaType;
55+
final String blossomUrl;
56+
final String nostrKey;
57+
final FileMetadata? fileMetadata;
58+
final DateTime createdAt;
59+
60+
const MediaFile({
61+
required this.id,
62+
required this.mlsGroupId,
63+
required this.accountPubkey,
64+
required this.filePath,
65+
required this.fileHash,
66+
required this.mimeType,
67+
required this.mediaType,
68+
required this.blossomUrl,
69+
required this.nostrKey,
70+
this.fileMetadata,
71+
required this.createdAt,
72+
});
73+
74+
@override
75+
int get hashCode =>
76+
id.hashCode ^
77+
mlsGroupId.hashCode ^
78+
accountPubkey.hashCode ^
79+
filePath.hashCode ^
80+
fileHash.hashCode ^
81+
mimeType.hashCode ^
82+
mediaType.hashCode ^
83+
blossomUrl.hashCode ^
84+
nostrKey.hashCode ^
85+
fileMetadata.hashCode ^
86+
createdAt.hashCode;
87+
88+
@override
89+
bool operator ==(Object other) =>
90+
identical(this, other) ||
91+
other is MediaFile &&
92+
runtimeType == other.runtimeType &&
93+
id == other.id &&
94+
mlsGroupId == other.mlsGroupId &&
95+
accountPubkey == other.accountPubkey &&
96+
filePath == other.filePath &&
97+
fileHash == other.fileHash &&
98+
mimeType == other.mimeType &&
99+
mediaType == other.mediaType &&
100+
blossomUrl == other.blossomUrl &&
101+
nostrKey == other.nostrKey &&
102+
fileMetadata == other.fileMetadata &&
103+
createdAt == other.createdAt;
104+
}

0 commit comments

Comments
 (0)