Skip to content

Commit 50111be

Browse files
authored
Add documentMeta parameter in RoutingClient createNew method (#119)
1 parent 223b41f commit 50111be

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/src/client/routing_client.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ class RoutingClient {
4747
/// - [one] - resource to-one relationships
4848
/// - [many] - resource to-many relationships
4949
/// - [meta] - resource meta data
50+
/// - [documentMeta] - document meta
5051
/// - [headers] - any extra HTTP headers
5152
Future<ResourceCreated> createNew(
5253
String type, {
5354
Map<String, Object?> attributes = const {},
5455
Map<String, Identifier> one = const {},
5556
Map<String, Iterable<Identifier>> many = const {},
5657
Map<String, Object?> meta = const {},
58+
Map<String, Object?> documentMeta = const {},
5759
Map<String, String> headers = const {},
5860
}) async {
5961
final response = await send(
@@ -64,7 +66,8 @@ class RoutingClient {
6466
...one.map((key, value) => MapEntry(key, ToOne(value))),
6567
...many.map((key, value) => MapEntry(key, ToMany(value))),
6668
})
67-
..meta.addAll(meta)))
69+
..meta.addAll(meta))
70+
..meta.addAll(documentMeta))
6871
..headers.addAll(headers));
6972

7073
return ResourceCreated(

test/unit/client/client_test.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ void main() {
256256
'tags': [Identifier('tags', '1'), Identifier('tags', '2')]
257257
}, meta: {
258258
'answer': 42
259+
}, documentMeta: {
260+
'hello': 'world'
259261
}, headers: {
260262
'foo': 'bar'
261263
});
@@ -290,7 +292,8 @@ void main() {
290292
}
291293
},
292294
'meta': {'answer': 42}
293-
}
295+
},
296+
'meta': {'hello': 'world'}
294297
});
295298
});
296299
});

0 commit comments

Comments
 (0)