mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-31 11:30:39 +00:00
29 lines
1,013 B
Java
29 lines
1,013 B
Java
package org.asamk.signal.json;
|
|
|
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
|
import org.asamk.signal.util.Util;
|
|
|
|
public record JsonContactAddress(
|
|
String type,
|
|
String label,
|
|
String street,
|
|
String pobox,
|
|
String neighborhood,
|
|
String city,
|
|
String region,
|
|
String postcode,
|
|
String country
|
|
) {
|
|
|
|
static JsonContactAddress from(MessageEnvelope.Data.SharedContact.Address address) {
|
|
return new JsonContactAddress(address.type().name(),
|
|
Util.getStringIfNotBlank(address.label()),
|
|
Util.getStringIfNotBlank(address.street()),
|
|
Util.getStringIfNotBlank(address.pobox()),
|
|
Util.getStringIfNotBlank(address.neighborhood()),
|
|
Util.getStringIfNotBlank(address.city()),
|
|
Util.getStringIfNotBlank(address.region()),
|
|
Util.getStringIfNotBlank(address.postcode()),
|
|
Util.getStringIfNotBlank(address.country()));
|
|
}
|
|
}
|