createRelationshipAttribute method
Future<AttributeRelationship>
createRelationshipAttribute({
- required String databaseId,
- required String collectionId,
- required RelationshipType type,
- bool? twoWay,
- String? key,
- String? twoWayKey,
- RelationMutate? onDelete,
Create relationship attribute
Create relationship attribute. Learn more about relationship attributes.
Implementation
Future<models.AttributeRelationship> createRelationshipAttribute(
{required String databaseId,
required String collectionId,
required String relatedCollectionId,
required enums.RelationshipType type,
bool? twoWay,
String? key,
String? twoWayKey,
enums.RelationMutate? onDelete}) async {
final String apiPath =
'/databases/{databaseId}/collections/{collectionId}/attributes/relationship'
.replaceAll('{databaseId}', databaseId)
.replaceAll('{collectionId}', collectionId);
final Map<String, dynamic> apiParams = {
'relatedCollectionId': relatedCollectionId,
'type': type.value,
'twoWay': twoWay,
'key': key,
'twoWayKey': twoWayKey,
'onDelete': onDelete?.value,
};
final Map<String, String> apiHeaders = {
'content-type': 'application/json',
};
final res = await client.call(HttpMethod.post,
path: apiPath, params: apiParams, headers: apiHeaders);
return models.AttributeRelationship.fromMap(res.data);
}