encode<V> static method

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

Implementation

static V encode<V>(
  FinancialConnectionsSession instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.accountHolder != null) {
    BankConnectionsResourceAccountholder.encode(
      instance.accountHolder!,
      container.nestedSingleValueContainer('account_holder').encoder,
    );
  }
  FinancialConnectionsSessionAccounts.encode(
    instance.accounts,
    container.nestedSingleValueContainer('accounts').encoder,
  );
  container.encodeString(
    'client_secret',
    instance.clientSecret,
  );
  if (instance.filters != null) {
    BankConnectionsResourceLinkAccountSessionFilters.encode(
      instance.filters!,
      container.nestedSingleValueContainer('filters').encoder,
    );
  }
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'financial_connections.session',
  );
  container.encodeList(
    'permissions',
    (container) => instance.permissions
        .forEach((el) => FinancialConnectionsAccountPermissionsItem.encode(
              el,
              container.nestedSingleValueContainer().encoder,
            )),
  );
  if (instance.prefetch != null) {
    container.encodeList(
      'prefetch',
      (container) =>
          instance.prefetch!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.returnUrl != null) {
    container.encodeString(
      'return_url',
      instance.returnUrl!,
    );
  }
  return container.value;
}