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

tw.yukina.notion.sdk.model.endpoint.page.RequestUpdatePage Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package tw.yukina.notion.sdk.model.endpoint.page;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import tw.yukina.notion.sdk.model.common.Icon;
import tw.yukina.notion.sdk.model.common.file.FileObject;
import tw.yukina.notion.sdk.model.page.Page;
import tw.yukina.notion.sdk.model.page.property.PageProperty;

import java.util.Map;

@Getter
@Setter
@ToString
@EqualsAndHashCode
public class RequestUpdatePage {

    private static final String PROPERTIES_FIELD = "properties";
    private static final String ARCHIVED_FIELD = "archived";
    private static final String ICON_FIELD = "icon";
    private static final String COVER_FIELD = "cover";

    @JsonProperty(PROPERTIES_FIELD)
    private Map properties;

    @JsonProperty(ARCHIVED_FIELD)
    private boolean isArchived;

    @JsonProperty(ICON_FIELD)
    private Icon icon;

    @JsonProperty(COVER_FIELD)
    private FileObject fileObject;

    public static RequestUpdatePage of(Page page){
        RequestUpdatePage requestUpdatePage = new RequestUpdatePage();
        requestUpdatePage.setProperties(page.getPropertyMap());
        requestUpdatePage.setArchived(page.isArchived());
        requestUpdatePage.setIcon(page.getIcon());
        requestUpdatePage.setFileObject(page.getCover());
        return requestUpdatePage;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy