getRelation method

Future<EntityRelation?> getRelation(
  1. EntityId fromId,
  2. String relationType,
  3. RelationTypeGroup relationTypeGroup,
  4. EntityId toId, {
  5. RequestConfig? requestConfig,
})

Implementation

Future<EntityRelation?> getRelation(EntityId fromId, String relationType,
    RelationTypeGroup relationTypeGroup, EntityId toId,
    {RequestConfig? requestConfig}) async {
  return nullIfNotFound(
    (RequestConfig requestConfig) async {
      var response =
          await _tbClient.get<Map<String, dynamic>>('/api/relation',
              queryParameters: {
                'fromId': fromId.id,
                'fromType': fromId.entityType.toShortString(),
                'relationType': relationType,
                'relationTypeGroup': relationTypeGroup.toShortString(),
                'toId': toId.id,
                'toType': toId.entityType.toShortString()
              },
              options: defaultHttpOptionsFromConfig(requestConfig));
      return response.data != null
          ? EntityRelation.fromJson(response.data!)
          : null;
    },
    requestConfig: requestConfig,
  );
}