encode<V> static method

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

Implementation

static V encode<V>(
  IssuingToken instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  IssuingCardOrId.encode(
    instance.card,
    container.nestedSingleValueContainer('card').encoder,
  );
  container.encodeDateTime(
    'created',
    instance.created,
  );
  if (instance.deviceFingerprint != null) {
    container.encodeString(
      'device_fingerprint',
      instance.deviceFingerprint!,
    );
  }
  container.encodeString(
    'id',
    instance.id,
  );
  if (instance.last4 != null) {
    container.encodeString(
      'last4',
      instance.last4!,
    );
  }
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'network',
    instance.network,
  );
  if (instance.networkData != null) {
    IssuingNetworkTokenNetworkData.encode(
      instance.networkData!,
      container.nestedSingleValueContainer('network_data').encoder,
    );
  }
  container.encodeDateTime(
    'network_updated_at',
    instance.networkUpdatedAt,
  );
  container.encodeString(
    'object',
    'issuing.token',
  );
  container.encodeString(
    'status',
    instance.status,
  );
  if (instance.walletProvider != null) {
    container.encodeString(
      'wallet_provider',
      instance.walletProvider!,
    );
  }
  return container.value;
}