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

org.telegram.api.functions.channels.TLRequestChannelsToggleInvites Maven / Gradle / Ivy

There is a newer version: 66.2
Show newest version
/**
 * This file is part of Support Bot.
 *
 *     Foobar is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     Foobar is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with Foobar.  If not, see .
 */
package org.telegram.api.functions.channels;

import org.telegram.api.input.chat.TLAbsInputChannel;
import org.telegram.api.updates.TLAbsUpdates;
import org.telegram.tl.StreamingUtils;
import org.telegram.tl.TLContext;
import org.telegram.tl.TLMethod;
import org.telegram.tl.TLObject;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * The type TL request channels create channel
 */
public class TLRequestChannelsToggleInvites extends TLMethod {
    /**
     * The constant CLASS_ID.
     */
    public static final int CLASS_ID = 0x49609307;

    private static final int FLAG_BROADCAST  = 0x00000001; // 0
    private static final int FLAG_MEGAGROUP  = 0x00000002; // 1

    /*
     channel:InputChannel enabled:Bool = Updates;
     */
    private TLAbsInputChannel channel;
    private boolean enabled;

    /**
     * Instantiates a new TL request channels create channel
     */
    public TLRequestChannelsToggleInvites() {
        super();
    }

    public int getClassId() {
        return CLASS_ID;
    }

    public TLAbsUpdates deserializeResponse(InputStream stream, TLContext context)
            throws IOException {
        final TLObject res = StreamingUtils.readTLObject(stream, context);
        if (res == null) {
            throw new IOException("Unable to parse response");
        }
        if ((res instanceof TLAbsUpdates)) {
            return (TLAbsUpdates) res;
        }
        throw new IOException("Incorrect response type. Expected " + TLAbsUpdates.class.getName() +", got: " + res.getClass().getName());
    }

    public TLAbsInputChannel getChannel() {
        return channel;
    }

    public void setChannel(TLAbsInputChannel channel) {
        this.channel = channel;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public void serializeBody(OutputStream stream)
            throws IOException {
        StreamingUtils.writeTLObject(this.channel, stream);
        StreamingUtils.writeTLBool(this.enabled, stream);
    }

    public void deserializeBody(InputStream stream, TLContext context)
            throws IOException {
        this.channel = (TLAbsInputChannel) StreamingUtils.readTLObject(stream, context);
        this.enabled = StreamingUtils.readTLBool(stream);
    }

    public String toString() {
        return "channels.toggleInvites#49609307";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy