<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: rpc.proto

namespace OS\PB;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * Generated from protobuf message <code>OS.PB.HTTPRequest</code>
 */
class HTTPRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * specify either http or https. If protocol not specified, assumed it is https
     *
     * Generated from protobuf field <code>string URL = 1;</code>
     */
    protected $URL = '';
    /**
     * One of the types must be used
     *
     * Generated from protobuf field <code>.OS.PB.HTTPMethodType Method = 2;</code>
     */
    protected $Method = 0;
    /**
     * this is list of key value pairs, each ending in \r\n. For example: "Transfer-Encoding: chunked\r\n"
     *
     * Generated from protobuf field <code>repeated string Headers = 3;</code>
     */
    private $Headers;
    /**
     * if blank, then HTTP/1.1
     *
     * Generated from protobuf field <code>string Protocol = 4;</code>
     */
    protected $Protocol = '';
    protected $BodyType;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $URL
     *           specify either http or https. If protocol not specified, assumed it is https
     *     @type int $Method
     *           One of the types must be used
     *     @type string[] $Headers
     *           this is list of key value pairs, each ending in \r\n. For example: "Transfer-Encoding: chunked\r\n"
     *     @type string $Protocol
     *           if blank, then HTTP/1.1
     *     @type string $Raw
     *           application/json or other application type required in headers 
     *     @type string $Binary
     *           binary payload, content length header calculated from this field
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Rpc::initOnce();
        parent::__construct($data);
    }

    /**
     * specify either http or https. If protocol not specified, assumed it is https
     *
     * Generated from protobuf field <code>string URL = 1;</code>
     * @return string
     */
    public function getURL()
    {
        return $this->URL;
    }

    /**
     * specify either http or https. If protocol not specified, assumed it is https
     *
     * Generated from protobuf field <code>string URL = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setURL($var)
    {
        GPBUtil::checkString($var, True);
        $this->URL = $var;

        return $this;
    }

    /**
     * One of the types must be used
     *
     * Generated from protobuf field <code>.OS.PB.HTTPMethodType Method = 2;</code>
     * @return int
     */
    public function getMethod()
    {
        return $this->Method;
    }

    /**
     * One of the types must be used
     *
     * Generated from protobuf field <code>.OS.PB.HTTPMethodType Method = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setMethod($var)
    {
        GPBUtil::checkEnum($var, \OS\PB\HTTPMethodType::class);
        $this->Method = $var;

        return $this;
    }

    /**
     * this is list of key value pairs, each ending in \r\n. For example: "Transfer-Encoding: chunked\r\n"
     *
     * Generated from protobuf field <code>repeated string Headers = 3;</code>
     * @return RepeatedField<string>
     */
    public function getHeaders()
    {
        return $this->Headers;
    }

    /**
     * this is list of key value pairs, each ending in \r\n. For example: "Transfer-Encoding: chunked\r\n"
     *
     * Generated from protobuf field <code>repeated string Headers = 3;</code>
     * @param string[] $var
     * @return $this
     */
    public function setHeaders($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->Headers = $arr;

        return $this;
    }

    /**
     * if blank, then HTTP/1.1
     *
     * Generated from protobuf field <code>string Protocol = 4;</code>
     * @return string
     */
    public function getProtocol()
    {
        return $this->Protocol;
    }

    /**
     * if blank, then HTTP/1.1
     *
     * Generated from protobuf field <code>string Protocol = 4;</code>
     * @param string $var
     * @return $this
     */
    public function setProtocol($var)
    {
        GPBUtil::checkString($var, True);
        $this->Protocol = $var;

        return $this;
    }

    /**
     * application/json or other application type required in headers 
     *
     * Generated from protobuf field <code>string Raw = 10;</code>
     * @return string
     */
    public function getRaw()
    {
        return $this->readOneof(10);
    }

    public function hasRaw()
    {
        return $this->hasOneof(10);
    }

    /**
     * application/json or other application type required in headers 
     *
     * Generated from protobuf field <code>string Raw = 10;</code>
     * @param string $var
     * @return $this
     */
    public function setRaw($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(10, $var);

        return $this;
    }

    /**
     * binary payload, content length header calculated from this field
     *
     * Generated from protobuf field <code>bytes Binary = 15;</code>
     * @return string
     */
    public function getBinary()
    {
        return $this->readOneof(15);
    }

    public function hasBinary()
    {
        return $this->hasOneof(15);
    }

    /**
     * binary payload, content length header calculated from this field
     *
     * Generated from protobuf field <code>bytes Binary = 15;</code>
     * @param string $var
     * @return $this
     */
    public function setBinary($var)
    {
        GPBUtil::checkString($var, False);
        $this->writeOneof(15, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getBodyType()
    {
        return $this->whichOneof("BodyType");
    }

}

