encode<V> static method

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

Implementation

static V encode<V>(
  IssuingPersonalizationDesign instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.cardLogo != null) {
    FileOrId.encode(
      instance.cardLogo!,
      container.nestedSingleValueContainer('card_logo').encoder,
    );
  }
  if (instance.carrierText != null) {
    IssuingPersonalizationDesignCarrierText.encode(
      instance.carrierText!,
      container.nestedSingleValueContainer('carrier_text').encoder,
    );
  }
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  if (instance.lookupKey != null) {
    container.encodeString(
      'lookup_key',
      instance.lookupKey!,
    );
  }
  container.encodeMap(
    'metadata',
    (container) => instance.metadata.forEach((
      key,
      value,
    ) =>
        container.encodeString(
          key,
          value,
        )),
  );
  if (instance.name != null) {
    container.encodeString(
      'name',
      instance.name!,
    );
  }
  container.encodeString(
    'object',
    'issuing.personalization_design',
  );
  IssuingPhysicalBundleOrId.encode(
    instance.physicalBundle,
    container.nestedSingleValueContainer('physical_bundle').encoder,
  );
  IssuingPersonalizationDesignPreferences.encode(
    instance.preferences,
    container.nestedSingleValueContainer('preferences').encoder,
  );
  IssuingPersonalizationDesignRejectionReasons.encode(
    instance.rejectionReasons,
    container.nestedSingleValueContainer('rejection_reasons').encoder,
  );
  container.encodeString(
    'status',
    instance.status,
  );
  return container.value;
}