encodeRequest static method
Encode feed request
Implementation
static Uint8List encodeRequest({
required String operation,
required PeerId ownerPeerId,
String? path,
Map<String, String>? headers,
Uint8List? body,
String? title,
String? description,
String? entryType,
int? sequenceNumber,
int? fromSequence,
int? toSequence,
int? limit,
bool collaborative = false,
}) {
final data = <String, dynamic>{
'operation': operation,
'ownerPeerId': ownerPeerId.toString(),
};
if (path != null) data['path'] = path;
if (headers != null && headers.isNotEmpty) data['headers'] = headers;
if (body != null) data['body'] = base64Encode(body);
if (title != null) data['title'] = title;
if (description != null) data['description'] = description;
if (entryType != null) data['entryType'] = entryType;
if (sequenceNumber != null) data['sequenceNumber'] = sequenceNumber;
if (fromSequence != null) data['fromSequence'] = fromSequence;
if (toSequence != null) data['toSequence'] = toSequence;
if (limit != null) data['limit'] = limit;
if (collaborative) data['collaborative'] = true;
final json = jsonEncode(data);
return Uint8List.fromList(utf8.encode(json));
}