/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { Date } from "../../types/java/util/Date"; import type { Publisher } from "../../types/senselogic/sitevision/api/versioning/Publisher"; import type { Builder } from "../../types/senselogic/sitevision/api/base/Builder"; /** * Builder for creating a {@link Publisher} with a specific setup of state. * *

* Initial state of a PublisherBuilder is: *

* * *

* Example of how to use PublisherBuilder and Publisher to publish a page at a given time using server-side JavaScript: *

*
   // 1. Import PublishingUtil in apps (WebApp, RESTApp, Widget, MCPServer etc)
 *    // NOTE! Use the require function instead in other server-side JavaScripts (e.g. Script module), i.e:
 *    // const publishingUtil = require("PublishingUtil");
 *    import publishingUtil from "@sitevision/api/server/PublishingUtil";
 *
 *    // 2. Create a publisher builder instance
 *    const publisherBuilder = publishingUtil.getPublisherBuilder();
 *
 *    const page = ... // Get the page node to publish
 *    const date = ... // Create a specific publish date, or null for imminent publishing
 *
 *    // 3. Create a publisher
 *    const publisher = publisherBuilder
 *                         .setPublishDate(date)
 *                         .build();
 *
 *    // 4. Publish
 *    try {
 *       publisher.publish(page);
 *       console.log("Page published successfully!");
 *    } catch (e) {
 *       console.log("Failed to publish page");
 *    }
 *  
* *

* Tip! The {@link senselogic.sitevision.api.base.Builder Builder interface documentation} contains * more information about Builders and how to work with them! *

* *

* An instance of the Sitevision class implementing this interface can be obtained via * {@link PublishingUtil#getPublisherBuilder()}. * See {@link PublishingUtil} for how to obtain an instance of the PublishingUtil interface. *

* @author Magnus Lövgren * @since Sitevision 2026.08.1 */ export interface PublisherBuilder extends Builder { /** * Sets the publish date. * *

* A publish date before "now" will throw an IllegalStateException when calling {@link #build()}. * Use null for immediate publishing. *

* @param aPublishDate the publish date to set, or null for immediate publishing * @return this builder instance */ setPublishDate(aPublishDate: Date): PublisherBuilder; /** * Sets the unpublish date. * *

* A unpublish date before "now" will throw an IllegalStateException when calling {@link #build()}. *

*

* A unpublish date must differ at least one minute from the actual publish date, * otherwise an IllegalStateException will be thrown when calling {@link #build()}. *

* @param aUnpublishDate the unpublish date to set, or null for no unpublishing * @return this builder instance */ setUnpublishDate(aUnpublishDate: Date): PublisherBuilder; /** * Sets the ("Best before") notification date. * *

* A notification date before "now" will throw an IllegalStateException when calling {@link #build()}. *

*

* A notification date must be equal or after the actual publish date, * otherwise an IllegalStateException will be thrown when calling {@link #build()}. *

* @param aNotificationDate the notification date to set, or null for no notification * @return this builder instance */ setNotificationDate(aNotificationDate: Date): PublisherBuilder; /** * Whether mobile users should be notified when the page is published. * *

* Note that this setting in practice is only applicable when publishing a sv:article * and current user must have {@link senselogic.sitevision.api.security.PermissionUtil.Permission#SEND_PUSH_NOTIFICATIONS} * for it to have any effect. *

* @param aNotifyMobileUsers true if mobile users should be notified, false otherwise * @return this builder instance */ setNotifyMobileUsers(aNotifyMobileUsers: boolean): PublisherBuilder; /** * Creates a Publisher instance using currently specified state. * @return a Publisher instance * @throws IllegalStateException if state for publisher execution is not valid, see individual set methods for value restrictions */ build(): Publisher; } declare namespace PublisherBuilder {} declare var publisherBuilder: PublisherBuilder; export default publisherBuilder;