createRelationship method
Creates a relationship between two entities (user, space, content). The 'favourite' relationship is supported by default, but you can use this method to create any type of relationship between two entities.
For example, the following method creates a 'sibling' relationship between
two pieces of content:
GET /wiki/rest/api/relation/sibling/from/content/123/to/content/456
Permissions required: Permission to access the Confluence site ('Can use' global permission).
Implementation
Future<Relation> createRelationship(
{required String relationName,
required String sourceType,
required String sourceKey,
required String targetType,
required String targetKey,
String? sourceStatus,
String? targetStatus,
int? sourceVersion,
int? targetVersion}) async {
return Relation.fromJson(await _client.send(
'put',
'wiki/rest/api/relation/{relationName}/from/{sourceType}/{sourceKey}/to/{targetType}/{targetKey}',
pathParameters: {
'relationName': relationName,
'sourceType': sourceType,
'sourceKey': sourceKey,
'targetType': targetType,
'targetKey': targetKey,
},
queryParameters: {
if (sourceStatus != null) 'sourceStatus': sourceStatus,
if (targetStatus != null) 'targetStatus': targetStatus,
if (sourceVersion != null) 'sourceVersion': '$sourceVersion',
if (targetVersion != null) 'targetVersion': '$targetVersion',
},
));
}