encode<V> static method

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

Implementation

static V encode<V>(
  BillingPortalConfigurationCreateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  ConfigurationBusinessProfile.encode(
    instance.businessProfile,
    container.nestedSingleValueContainer('business_profile').encoder,
  );
  if (instance.defaultReturnUrl != null) {
    container.encodeString(
      'default_return_url',
      instance.defaultReturnUrl!,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  ConfigurationFeatures.encode(
    instance.features,
    container.nestedSingleValueContainer('features').encoder,
  );
  if (instance.loginPage != null) {
    PortalSubscriptionPause.encode(
      instance.loginPage!,
      container.nestedSingleValueContainer('login_page').encoder,
    );
  }
  if (instance.metadata != null) {
    container.encodeMap(
      'metadata',
      (container) => instance.metadata!.forEach((
        key,
        value,
      ) =>
          container.encodeString(
            key,
            value,
          )),
    );
  }
  return container.value;
}