getSingle static method

Future<PcoPeopleNote?> getSingle(
  1. String id, {
  2. PcoPeopleNoteQuery? query,
  3. bool includeAllRelated = false,
  4. bool includeCategory = false,
  5. bool includeCreatedBy = false,
  6. bool includePerson = false,
})

Will get a single PcoPeopleNote object using a path like this: /people/v2/notes/[id]

Additional options may be specified by using the query argument, but some query options are also available as boolean flags in this function call too.

Implementation

static Future<PcoPeopleNote?> getSingle(
  String id, {
  PcoPeopleNoteQuery? query,
  bool includeAllRelated = false,
  bool includeCategory = false,
  bool includeCreatedBy = false,
  bool includePerson = false,
}) async {
  query ??= PcoPeopleNoteQuery();
  if (includeAllRelated) query.include.addAll(PcoPeopleNote.canInclude);
  if (includeCategory) query.include.add('category');
  if (includeCreatedBy) query.include.add('created_by');
  if (includePerson) query.include.add('person');
  var url = '/people/v2/notes/$id';
  var retval = await PcoCollection.fromApiCall<PcoPeopleNote>(url,
      query: query, apiVersion: kApiVersion);
  return retval.items.isEmpty ? null : retval.items.first;
}