Create attachment with referenced link

This commit is contained in:
2025-04-06 23:03:01 +08:00
parent aa50561247
commit 935cf774b1
6 changed files with 195 additions and 189 deletions

View File

@ -120,6 +120,25 @@ class SnAttachmentProvider {
'webp': 'image/webp',
};
Future<SnAttachment> createWithReferenceLink(
String url,
String pool,
Map<String, dynamic>? metadata, {
String? mimetype,
}) async {
final resp = await _sn.client.post(
'/cgi/uc/attachments/referenced',
data: {
'url': url,
'pool': pool,
'metadata': metadata,
if (mimetype != null) 'mimetype': mimetype,
},
);
return SnAttachment.fromJson(resp.data);
}
Future<SnAttachment> directUploadOne(
Uint8List data,
String filename,