encode<V> static method

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

Implementation

static V encode<V>(
  Review instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.billingZip != null) {
    container.encodeString(
      'billing_zip',
      instance.billingZip!,
    );
  }
  if (instance.charge != null) {
    ChargeOrId.encode(
      instance.charge!,
      container.nestedSingleValueContainer('charge').encoder,
    );
  }
  if (instance.closedReason != null) {
    container.encodeString(
      'closed_reason',
      instance.closedReason!,
    );
  }
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'id',
    instance.id,
  );
  if (instance.ipAddress != null) {
    container.encodeString(
      'ip_address',
      instance.ipAddress!,
    );
  }
  if (instance.ipAddressLocation != null) {
    RadarReviewResourceLocation.encode(
      instance.ipAddressLocation!,
      container.nestedSingleValueContainer('ip_address_location').encoder,
    );
  }
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'review',
  );
  container.encodeBool(
    'open',
    instance.open,
  );
  container.encodeString(
    'opened_reason',
    instance.openedReason,
  );
  if (instance.paymentIntent != null) {
    PaymentIntentOrId.encode(
      instance.paymentIntent!,
      container.nestedSingleValueContainer('payment_intent').encoder,
    );
  }
  container.encodeString(
    'reason',
    instance.reason,
  );
  if (instance.session != null) {
    RadarReviewResourceSession.encode(
      instance.session!,
      container.nestedSingleValueContainer('session').encoder,
    );
  }
  return container.value;
}