encode<V> static method

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

Implementation

static V encode<V>(
  FinancialConnectionsAccount instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.accountHolder != null) {
    BankConnectionsResourceAccountholder.encode(
      instance.accountHolder!,
      container.nestedSingleValueContainer('account_holder').encoder,
    );
  }
  if (instance.balance != null) {
    BankConnectionsResourceBalance.encode(
      instance.balance!,
      container.nestedSingleValueContainer('balance').encoder,
    );
  }
  if (instance.balanceRefresh != null) {
    BankConnectionsResourceBalanceRefresh.encode(
      instance.balanceRefresh!,
      container.nestedSingleValueContainer('balance_refresh').encoder,
    );
  }
  container.encodeString(
    'category',
    instance.category,
  );
  container.encodeDateTime(
    'created',
    instance.created,
  );
  if (instance.displayName != null) {
    container.encodeString(
      'display_name',
      instance.displayName!,
    );
  }
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeString(
    'institution_name',
    instance.institutionName,
  );
  if (instance.last4 != null) {
    container.encodeString(
      'last4',
      instance.last4!,
    );
  }
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'financial_connections.account',
  );
  if (instance.ownership != null) {
    FinancialConnectionsAccountOwnershipOrId.encode(
      instance.ownership!,
      container.nestedSingleValueContainer('ownership').encoder,
    );
  }
  if (instance.ownershipRefresh != null) {
    BankConnectionsResourceOwnershipRefresh.encode(
      instance.ownershipRefresh!,
      container.nestedSingleValueContainer('ownership_refresh').encoder,
    );
  }
  if (instance.permissions != null) {
    container.encodeList(
      'permissions',
      (container) =>
          instance.permissions!.forEach((el) => container.encodeString(el)),
    );
  }
  container.encodeString(
    'status',
    instance.status,
  );
  container.encodeString(
    'subcategory',
    instance.subcategory,
  );
  if (instance.subscriptions != null) {
    container.encodeList(
      'subscriptions',
      (container) => instance.subscriptions!
          .forEach((el) => container.encodeString('transactions')),
    );
  }
  container.encodeList(
    'supported_payment_method_types',
    (container) => instance.supportedPaymentMethodTypes
        .forEach((el) => container.encodeString(el)),
  );
  if (instance.transactionRefresh != null) {
    BankConnectionsResourceTransactionRefresh.encode(
      instance.transactionRefresh!,
      container.nestedSingleValueContainer('transaction_refresh').encoder,
    );
  }
  return container.value;
}