encode<V> static method

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

Implementation

static V encode<V>(
  IssuingDispute instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeInt(
    'amount',
    instance.amount,
  );
  if (instance.balanceTransactions != null) {
    container.encodeList(
      'balance_transactions',
      (container) => instance.balanceTransactions!
          .forEach((el) => BalanceTransaction.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'currency',
    instance.currency,
  );
  IssuingDisputeEvidence.encode(
    instance.evidence,
    container.nestedSingleValueContainer('evidence').encoder,
  );
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeMap(
    'metadata',
    (container) => instance.metadata.forEach((
      key,
      value,
    ) =>
        container.encodeString(
          key,
          value,
        )),
  );
  container.encodeString(
    'object',
    'issuing.dispute',
  );
  container.encodeString(
    'status',
    instance.status,
  );
  IssuingTransactionOrId.encode(
    instance.transaction,
    container.nestedSingleValueContainer('transaction').encoder,
  );
  if (instance.treasury != null) {
    IssuingDisputeTreasury.encode(
      instance.treasury!,
      container.nestedSingleValueContainer('treasury').encoder,
    );
  }
  return container.value;
}