encode<V> static method

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

Implementation

static V encode<V>(
  AccountLinkCreateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeString(
    'account',
    instance.account,
  );
  if (instance.collect != null) {
    container.encodeString(
      'collect',
      instance.collect!,
    );
  }
  if (instance.collectionOptions != null) {
    AccountLinkCollectionOptions.encode(
      instance.collectionOptions!,
      container.nestedSingleValueContainer('collection_options').encoder,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.refreshUrl != null) {
    container.encodeString(
      'refresh_url',
      instance.refreshUrl!,
    );
  }
  if (instance.returnUrl != null) {
    container.encodeString(
      'return_url',
      instance.returnUrl!,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  return container.value;
}