encode<V> static method

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

Implementation

static V encode<V>(
  BillingPortalConfigurationUpdateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.active != null) {
    container.encodeBool(
      'active',
      instance.active!,
    );
  }
  if (instance.businessProfile != null) {
    BillingPortalConfigurationUpdateOptionsBusinessProfile.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)),
    );
  }
  if (instance.features != null) {
    BillingPortalConfigurationUpdateOptionsFeatures.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;
}