PcoPeopleMessage constructor

PcoPeopleMessage({
  1. String? id,
  2. String? kind,
  3. String? toAddresses,
  4. String? subject,
  5. String? file,
  6. String? deliveryStatus,
  7. String? rejectReason,
  8. DateTime? createdAt,
  9. DateTime? sentAt,
  10. DateTime? bouncedAt,
  11. DateTime? rejectionNotificationSentAt,
  12. String? fromName,
  13. String? fromAddress,
  14. DateTime? readAt,
  15. String? appName,
  16. String? messageType,
  17. Map<String, List<PcoResource>>? withRelationships,
  18. List<PcoResource>? withIncluded,
})

Create a new PcoPeopleMessage object. This object cannot be created with the API

NOTES:

  • Creating an instance of a class this way does not save it on the server.
  • This object cannot be saved directly to the server.
  • Only set the id field if you know what you are doing. Save operations will overwrite data when the id is set.
  • Dummy data can be supplied for a required parameter, but if so, .save() should not be called on the object
  • FIELDS USED WHEN CREATING: none
  • FIELDS USED WHEN UPDATING: none

Implementation

factory PcoPeopleMessage(
    {String? id,
    String? kind,
    String? toAddresses,
    String? subject,
    String? file,
    String? deliveryStatus,
    String? rejectReason,
    DateTime? createdAt,
    DateTime? sentAt,
    DateTime? bouncedAt,
    DateTime? rejectionNotificationSentAt,
    String? fromName,
    String? fromAddress,
    DateTime? readAt,
    String? appName,
    String? messageType,
    Map<String, List<PcoResource>>? withRelationships,
    List<PcoResource>? withIncluded}) {
  var obj = PcoPeopleMessage.empty();
  obj._id = id;
  if (kind != null) obj._attributes['kind'] = kind;
  if (toAddresses != null) obj._attributes['to_addresses'] = toAddresses;
  if (subject != null) obj._attributes['subject'] = subject;
  if (file != null) obj._attributes['file'] = file;
  if (deliveryStatus != null)
    obj._attributes['delivery_status'] = deliveryStatus;
  if (rejectReason != null) obj._attributes['reject_reason'] = rejectReason;
  if (createdAt != null)
    obj._attributes['created_at'] = createdAt.toIso8601String();
  if (sentAt != null) obj._attributes['sent_at'] = sentAt.toIso8601String();
  if (bouncedAt != null)
    obj._attributes['bounced_at'] = bouncedAt.toIso8601String();
  if (rejectionNotificationSentAt != null)
    obj._attributes['rejection_notification_sent_at'] =
        rejectionNotificationSentAt.toIso8601String();
  if (fromName != null) obj._attributes['from_name'] = fromName;
  if (fromAddress != null) obj._attributes['from_address'] = fromAddress;
  if (readAt != null) obj._attributes['read_at'] = readAt.toIso8601String();
  if (appName != null) obj._attributes['app_name'] = appName;
  if (messageType != null) obj._attributes['message_type'] = messageType;

  if (withRelationships != null) {
    for (var r in withRelationships.entries) {
      obj._relationships[r.key] = r.value;
    }
    obj._hasManualRelationships = true;
  }

  if (withIncluded != null) {
    obj._included.addAll(withIncluded);
    obj._hasManualIncluded = true;
  }

  return obj;
}