getAttachables method

Future<List<QuickbooksAttachableEntity>> getAttachables({
  1. required String id,
  2. required String accessToken,
  3. required String companyId,
})

Gets all QuickbooksAttachableEntity for the requested id in the Quickbooks API for the given accessToken

Implementation

Future<List<QuickbooksAttachableEntity>> getAttachables({
  required String id,
  required String accessToken,
  required String companyId,
}) async {
  var query = buildQuery(
      query: "select * from attachable",
      firstConditions: "AttachableRef.EntityRef.Type = 'Item'",
      conditions: "AttachableRef.EntityRef.value = '$id'");

  List<Map<String, dynamic>> items = await getQuery(
    query: query,
    accessToken: accessToken,
    companyId: companyId,
    location: 'Attachable',
  );

  List<QuickbooksAttachableEntity> results = [];

  for (var item in items) {
    results.add(QuickbooksAttachableEntity.fromMap(item));
  }
  return results;
}