encode<V> static method

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

Implementation

static V encode<V>(
  TaxId instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.country != null) {
    container.encodeString(
      'country',
      instance.country!,
    );
  }
  container.encodeDateTime(
    'created',
    instance.created,
  );
  if (instance.customer != null) {
    CustomerOrId.encode(
      instance.customer!,
      container.nestedSingleValueContainer('customer').encoder,
    );
  }
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'tax_id',
  );
  if (instance.owner != null) {
    TaxIDsOwner.encode(
      instance.owner!,
      container.nestedSingleValueContainer('owner').encoder,
    );
  }
  InvoicesResourceInvoiceTaxIdType.encode(
    instance.type,
    container.nestedSingleValueContainer('type').encoder,
  );
  container.encodeString(
    'value',
    instance.value,
  );
  if (instance.verification != null) {
    TaxIdVerification.encode(
      instance.verification!,
      container.nestedSingleValueContainer('verification').encoder,
    );
  }
  return container.value;
}