All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.auties.whatsapp.model.response.CreateAdminInviteNewsletterResponse Maven / Gradle / Ivy

package it.auties.whatsapp.model.response;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import it.auties.whatsapp.model.jid.Jid;
import it.auties.whatsapp.util.Json;

import java.util.Map;
import java.util.Optional;

public record CreateAdminInviteNewsletterResponse(@JsonProperty("id") Jid jid, @JsonProperty("mute") Long mute) {
    @JsonCreator
    CreateAdminInviteNewsletterResponse(Map json) {
        this(Jid.of(json.get("id")), Long.parseLong(json.get("invite_expiration_time")));
    }

    public static Optional ofJson(String json) {
        return Json.readValue(json, JsonData.class)
                .data()
                .map(JsonResponse::response);
    }

    private record JsonData(Optional data) {

    }

    private record JsonResponse(
            @JsonProperty("xwa2_newsletter_admin_invite_create") CreateAdminInviteNewsletterResponse response) {

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy