encode<V> static method

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

Implementation

static V encode<V>(
  IssuingCardShipping instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  Address.encode(
    instance.address,
    container.nestedSingleValueContainer('address').encoder,
  );
  if (instance.carrier != null) {
    container.encodeString(
      'carrier',
      instance.carrier!,
    );
  }
  if (instance.customs != null) {
    IssuingCardShippingCustoms.encode(
      instance.customs!,
      container.nestedSingleValueContainer('customs').encoder,
    );
  }
  if (instance.eta != null) {
    container.encodeDateTime(
      'eta',
      instance.eta!,
    );
  }
  container.encodeString(
    'name',
    instance.name,
  );
  if (instance.phoneNumber != null) {
    container.encodeString(
      'phone_number',
      instance.phoneNumber!,
    );
  }
  if (instance.requireSignature != null) {
    container.encodeBool(
      'require_signature',
      instance.requireSignature!,
    );
  }
  container.encodeString(
    'service',
    instance.service,
  );
  if (instance.status != null) {
    container.encodeString(
      'status',
      instance.status!,
    );
  }
  if (instance.trackingNumber != null) {
    container.encodeString(
      'tracking_number',
      instance.trackingNumber!,
    );
  }
  if (instance.trackingUrl != null) {
    container.encodeString(
      'tracking_url',
      instance.trackingUrl!,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  return container.value;
}