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

com.annimon.tgbotsmodule.api.methods.answerqueries.AnswerShippingQueryMethod Maven / Gradle / Ivy

The newest version!
package com.annimon.tgbotsmodule.api.methods.answerqueries;

import com.annimon.tgbotsmodule.api.methods.interfaces.Method;
import com.annimon.tgbotsmodule.services.CommonAbsSender;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.jetbrains.annotations.NotNull;
import org.telegram.telegrambots.meta.api.methods.AnswerShippingQuery;
import org.telegram.telegrambots.meta.api.objects.payments.ShippingOption;

public class AnswerShippingQueryMethod implements Method {

    private final AnswerShippingQuery.AnswerShippingQueryBuilder method;

    public AnswerShippingQueryMethod() {
        this(AnswerShippingQuery.builder());
    }

    public AnswerShippingQueryMethod(@NotNull AnswerShippingQuery.AnswerShippingQueryBuilder method) {
        this.method = method;
    }

    public String getShippingQueryId() {
        return method.build().getShippingQueryId();
    }

    public AnswerShippingQueryMethod setShippingQueryId(@NotNull String shippingQueryId) {
        method.shippingQueryId(shippingQueryId);
        return this;
    }

    public List getShippingOptions() {
        return method.build().getShippingOptions();
    }

    public AnswerShippingQueryMethod setShippingOptions(List shippingOptions) {
        method.shippingOptions(shippingOptions);
        return this;
    }

    public boolean getOk() {
        return Boolean.TRUE.equals(method.build().getOk());
    }

    public AnswerShippingQueryMethod setOk(boolean isPersonal) {
        method.ok(isPersonal);
        return this;
    }

    public String getErrorMessage() {
        return method.build().getErrorMessage();
    }

    public AnswerShippingQueryMethod setErrorMessage(String errorMessage) {
        method.errorMessage(errorMessage);
        return this;
    }

    @Override
    public Boolean call(@NotNull CommonAbsSender sender) {
        return sender.call(method.build());
    }

    @Override
    public CompletableFuture callAsync(@NotNull CommonAbsSender sender) {
        return sender.callAsync(method.build());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy