encode<V> static method

V encode<V>(
  1. SourceAcceptance instance,
  2. Encoder<V> encoder
)

Implementation

static V encode<V>(
  SourceAcceptance instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.date != null) {
    container.encodeDateTime(
      'date',
      instance.date!,
    );
  }
  if (instance.ip != null) {
    container.encodeString(
      'ip',
      instance.ip!,
    );
  }
  if (instance.offline != null) {
    SourceOffline.encode(
      instance.offline!,
      container.nestedSingleValueContainer('offline').encoder,
    );
  }
  if (instance.online != null) {
    AccountOwnershipDeclaration.encode(
      instance.online!,
      container.nestedSingleValueContainer('online').encoder,
    );
  }
  MandateBacsDebitNetworkStatus.encode(
    instance.status,
    container.nestedSingleValueContainer('status').encoder,
  );
  if (instance.type != null) {
    CustomerAcceptanceType.encode(
      instance.type!,
      container.nestedSingleValueContainer('type').encoder,
    );
  }
  if (instance.userAgent != null) {
    container.encodeString(
      'user_agent',
      instance.userAgent!,
    );
  }
  return container.value;
}