encode<V> static method

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

Implementation

static V encode<V>(
  TreasuryTransactionEntry instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  TreasuryTransactionsResourceBalanceImpact.encode(
    instance.balanceImpact,
    container.nestedSingleValueContainer('balance_impact').encoder,
  );
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'currency',
    instance.currency,
  );
  container.encodeDateTime(
    'effective_at',
    instance.effectiveAt,
  );
  container.encodeString(
    'financial_account',
    instance.financialAccount,
  );
  if (instance.flow != null) {
    container.encodeString(
      'flow',
      instance.flow!,
    );
  }
  if (instance.flowDetails != null) {
    TreasuryTransactionFlowDetails.encode(
      instance.flowDetails!,
      container.nestedSingleValueContainer('flow_details').encoder,
    );
  }
  TreasuryTransactionFlowDetailsType.encode(
    instance.flowType,
    container.nestedSingleValueContainer('flow_type').encoder,
  );
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'treasury.transaction_entry',
  );
  TreasuryTransactionOrId.encode(
    instance.transaction,
    container.nestedSingleValueContainer('transaction').encoder,
  );
  container.encodeString(
    'type',
    instance.type,
  );
  return container.value;
}