encode<V> static method

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

Implementation

static V encode<V>(
  FinancialConnectionsSessionCreateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  SessionAccountHolder.encode(
    instance.accountHolder,
    container.nestedSingleValueContainer('account_holder').encoder,
  );
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.filters != null) {
    SessionFilters.encode(
      instance.filters!,
      container.nestedSingleValueContainer('filters').encoder,
    );
  }
  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) => FinancialConnectionsSessionPrefetchItem.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  if (instance.returnUrl != null) {
    container.encodeString(
      'return_url',
      instance.returnUrl!,
    );
  }
  return container.value;
}