encode<V> static method

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

Implementation

static V encode<V>(
  TreasuryTransaction instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeInt(
    'amount',
    instance.amount,
  );
  TreasuryTransactionsResourceBalanceImpact.encode(
    instance.balanceImpact,
    container.nestedSingleValueContainer('balance_impact').encoder,
  );
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'currency',
    instance.currency,
  );
  container.encodeString(
    'description',
    instance.description,
  );
  if (instance.entries != null) {
    TreasuryTransactionEntries.encode(
      instance.entries!,
      container.nestedSingleValueContainer('entries').encoder,
    );
  }
  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',
  );
  container.encodeString(
    'status',
    instance.status,
  );
  TreasuryTransactionsResourceAbstractTransactionResourceStatusTransitions
      .encode(
    instance.statusTransitions,
    container.nestedSingleValueContainer('status_transitions').encoder,
  );
  return container.value;
}