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

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

There is a newer version: 66.2
Show newest version
package org.telegram.api.functions.channels;

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 TLRequestChannelsCreateChannel extends TLMethod {
    /**
     * The constant CLASS_ID.
     */
    public static final int CLASS_ID = 0xf4893d7f;

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

    private int flags;
    private String title;
    private String about;

    /**
     * Instantiates a new TL request channels create channel
     */
    public TLRequestChannelsCreateChannel() {
        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 String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getFlags() {
        return flags;
    }

    public void setFlags(int flags) {
        this.flags = flags;
    }

    public String getAbout() {
        return about;
    }

    public void setAbout(String about) {
        this.about = about;
    }

    public void serializeBody(OutputStream stream)
            throws IOException {
        StreamingUtils.writeInt(this.flags, stream);
        StreamingUtils.writeTLString(this.title, stream);
        StreamingUtils.writeTLString(this.about, stream);
    }

    public void deserializeBody(InputStream stream, TLContext context)
            throws IOException {
        this.flags = StreamingUtils.readInt(stream);
        this.title = StreamingUtils.readTLString(stream);
        this.about = StreamingUtils.readTLString(stream);
    }

    public String toString() {
        return "channels.createChannel#f4893d7f";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy