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

org.telegram.api.functions.account.TLRequestAccountReportPeer 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.account;

import org.telegram.api.input.peer.TLAbsInputPeer;
import org.telegram.api.input.reportspamreason.TLAbsReportSpamReason;
import org.telegram.tl.StreamingUtils;
import org.telegram.tl.TLBool;
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 account change phone.
 */
public class TLRequestAccountReportPeer extends TLMethod {
    /**
     * The constant CLASS_ID.
     */
    public static final int CLASS_ID = 0xae189d5f;

    private TLAbsInputPeer peer;
    private TLAbsReportSpamReason reason;

    /**
     * Instantiates a new TL request account change phone.
     */
    public TLRequestAccountReportPeer() {
        super();
    }

    public int getClassId() {
        return CLASS_ID;
    }

    public TLBool 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 TLBool)) {
            return (TLBool) res;
        }
        throw new IOException("Incorrect response type. Expected " + TLBool.class.getCanonicalName() + ", got: " + res.getClass().getCanonicalName());
    }

    public TLAbsReportSpamReason getReason() {
        return reason;
    }

    public void setReason(TLAbsReportSpamReason reason) {
        this.reason = reason;
    }

    public TLAbsInputPeer getPeer() {
        return peer;
    }

    public void setPeer(TLAbsInputPeer peer) {
        this.peer = peer;
    }

    @Override
    public void serializeBody(OutputStream stream)
            throws IOException {
        StreamingUtils.writeTLObject(this.peer, stream);
        StreamingUtils.writeTLObject(this.reason, stream);
    }

    @Override
    public void deserializeBody(InputStream stream, TLContext context)
            throws IOException {
        this.peer = (TLAbsInputPeer) StreamingUtils.readTLObject(stream, context);
        this.reason = (TLAbsReportSpamReason) StreamingUtils.readTLObject(stream, context);
    }

    @Override
    public String toString() {
        return "account.reportPeer#ae189d5f";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy