it.auties.whatsapp.model.response.NewsletterSubscribersResponse Maven / Gradle / Ivy
package it.auties.whatsapp.model.response;
import com.fasterxml.jackson.annotation.JsonProperty;
import it.auties.whatsapp.util.Json;
import java.util.Optional;
public record NewsletterSubscribersResponse(@JsonProperty("subscribers_count") Long subscribersCount) {
public static Optional ofJson(String json) {
return Json.readValue(json, JsonResponse.class)
.data()
.map(response -> response.result().response());
}
private record JsonResponse(Optional data) {
}
private record JsonData(@JsonProperty("xwa2_newsletter") WrappedResult result) {
}
private record WrappedResult(@JsonProperty("thread_metadata") NewsletterSubscribersResponse response) {
}
}