<?hh
/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */

/**
 * Original thrift service:-
 * PubSubStreamingService
 */
interface PubSubStreamingServiceAsyncIf extends \IThriftAsyncIf {
}

/**
 * Original thrift service:-
 * PubSubStreamingService
 */
interface PubSubStreamingServiceIf extends \IThriftSyncIf {
}

/**
 * Original thrift service:-
 * PubSubStreamingService
 */
interface PubSubStreamingServiceAsyncClientIf extends PubSubStreamingServiceAsyncIf {
  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   returnstream(1: i32 i32_from,
   *                2: i32 i32_to);
   */
  public function returnstream(int $i32_from, int $i32_to): Awaitable<\ResponseAndStream<null, int>>;

  /**
   * Original thrift definition:-
   * void, stream<i32, throws (1: FooStreamEx e)>
   *   streamthrows(1: i32 foo);
   */
  public function streamthrows(int $foo): Awaitable<\ResponseAndStream<null, int>>;

  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   servicethrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public function servicethrows(int $foo): Awaitable<\ResponseAndStream<null, int>>;

  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   servicethrows2(1: i32 foo)
   *   throws (1: FooEx e1,
   *           2: FooEx2 e2);
   */
  public function servicethrows2(int $foo): Awaitable<\ResponseAndStream<null, int>>;

  /**
   * Original thrift definition:-
   * void, stream<i32, throws (1: FooStreamEx e)>
   *   boththrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public function boththrows(int $foo): Awaitable<\ResponseAndStream<null, int>>;

  /**
   * Original thrift definition:-
   * i32, stream<i32, throws (1: FooStreamEx e)>
   *   responseandstreamstreamthrows(1: i32 foo);
   */
  public function responseandstreamstreamthrows(int $foo): Awaitable<\ResponseAndStream<int, int>>;

  /**
   * Original thrift definition:-
   * i32, stream<i32>
   *   responseandstreamservicethrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public function responseandstreamservicethrows(int $foo): Awaitable<\ResponseAndStream<int, int>>;

  /**
   * Original thrift definition:-
   * i32, stream<i32, throws (1: FooStreamEx e)>
   *   responseandstreamboththrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public function responseandstreamboththrows(int $foo): Awaitable<\ResponseAndStream<int, int>>;

  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   returnstreamFast(1: i32 i32_from,
   *                    2: i32 i32_to);
   */
  public function returnstreamFast(int $i32_from, int $i32_to): Awaitable<\ResponseAndStream<null, int>>;
}

/**
 * Original thrift service:-
 * PubSubStreamingService
 */
interface PubSubStreamingServiceClientIf extends \IThriftSyncIf {
  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   returnstream(1: i32 i32_from,
   *                2: i32 i32_to);
   */
  public function returnstream(int $i32_from, int $i32_to): Awaitable<\ResponseAndStream<null, int>>;

  /**
   * Original thrift definition:-
   * void, stream<i32, throws (1: FooStreamEx e)>
   *   streamthrows(1: i32 foo);
   */
  public function streamthrows(int $foo): Awaitable<\ResponseAndStream<null, int>>;

  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   servicethrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public function servicethrows(int $foo): Awaitable<\ResponseAndStream<null, int>>;

  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   servicethrows2(1: i32 foo)
   *   throws (1: FooEx e1,
   *           2: FooEx2 e2);
   */
  public function servicethrows2(int $foo): Awaitable<\ResponseAndStream<null, int>>;

  /**
   * Original thrift definition:-
   * void, stream<i32, throws (1: FooStreamEx e)>
   *   boththrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public function boththrows(int $foo): Awaitable<\ResponseAndStream<null, int>>;

  /**
   * Original thrift definition:-
   * i32, stream<i32, throws (1: FooStreamEx e)>
   *   responseandstreamstreamthrows(1: i32 foo);
   */
  public function responseandstreamstreamthrows(int $foo): Awaitable<\ResponseAndStream<int, int>>;

  /**
   * Original thrift definition:-
   * i32, stream<i32>
   *   responseandstreamservicethrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public function responseandstreamservicethrows(int $foo): Awaitable<\ResponseAndStream<int, int>>;

  /**
   * Original thrift definition:-
   * i32, stream<i32, throws (1: FooStreamEx e)>
   *   responseandstreamboththrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public function responseandstreamboththrows(int $foo): Awaitable<\ResponseAndStream<int, int>>;

  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   returnstreamFast(1: i32 i32_from,
   *                    2: i32 i32_to);
   */
  public function returnstreamFast(int $i32_from, int $i32_to): Awaitable<\ResponseAndStream<null, int>>;
}

/**
 * Original thrift service:-
 * PubSubStreamingService
 */
trait PubSubStreamingServiceClientBase {
  require extends \ThriftClientBase;

  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   returnstream(1: i32 i32_from,
   *                2: i32 i32_to);
   */
  public async function returnstream(int $i32_from, int $i32_to): Awaitable<\ResponseAndStream<null, int>> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = PubSubStreamingService_returnstream_args::fromShape(shape(
      'i32_from' => $i32_from,
      'i32_to' => $i32_to,
    ));
    await $this->asyncHandler_->genBefore("PubSubStreamingService", "returnstream", $args);
    $currentseqid = $this->sendImplHelper($args, "returnstream", false, "PubSubStreamingService" );
    return await $this->genAwaitStreamResponse(PubSubStreamingService_returnstream_FirstResponse::class, PubSubStreamingService_returnstream_StreamResponse::class, "returnstream", true, $currentseqid, $rpc_options);
  }

  /**
   * Original thrift definition:-
   * void, stream<i32, throws (1: FooStreamEx e)>
   *   streamthrows(1: i32 foo);
   */
  public async function streamthrows(int $foo): Awaitable<\ResponseAndStream<null, int>> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = PubSubStreamingService_streamthrows_args::fromShape(shape(
      'foo' => $foo,
    ));
    await $this->asyncHandler_->genBefore("PubSubStreamingService", "streamthrows", $args);
    $currentseqid = $this->sendImplHelper($args, "streamthrows", false, "PubSubStreamingService" );
    return await $this->genAwaitStreamResponse(PubSubStreamingService_streamthrows_FirstResponse::class, PubSubStreamingService_streamthrows_StreamResponse::class, "streamthrows", true, $currentseqid, $rpc_options);
  }

  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   servicethrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public async function servicethrows(int $foo): Awaitable<\ResponseAndStream<null, int>> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = PubSubStreamingService_servicethrows_args::fromShape(shape(
      'foo' => $foo,
    ));
    await $this->asyncHandler_->genBefore("PubSubStreamingService", "servicethrows", $args);
    $currentseqid = $this->sendImplHelper($args, "servicethrows", false, "PubSubStreamingService" );
    return await $this->genAwaitStreamResponse(PubSubStreamingService_servicethrows_FirstResponse::class, PubSubStreamingService_servicethrows_StreamResponse::class, "servicethrows", true, $currentseqid, $rpc_options);
  }

  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   servicethrows2(1: i32 foo)
   *   throws (1: FooEx e1,
   *           2: FooEx2 e2);
   */
  public async function servicethrows2(int $foo): Awaitable<\ResponseAndStream<null, int>> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = PubSubStreamingService_servicethrows2_args::fromShape(shape(
      'foo' => $foo,
    ));
    await $this->asyncHandler_->genBefore("PubSubStreamingService", "servicethrows2", $args);
    $currentseqid = $this->sendImplHelper($args, "servicethrows2", false, "PubSubStreamingService" );
    return await $this->genAwaitStreamResponse(PubSubStreamingService_servicethrows2_FirstResponse::class, PubSubStreamingService_servicethrows2_StreamResponse::class, "servicethrows2", true, $currentseqid, $rpc_options);
  }

  /**
   * Original thrift definition:-
   * void, stream<i32, throws (1: FooStreamEx e)>
   *   boththrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public async function boththrows(int $foo): Awaitable<\ResponseAndStream<null, int>> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = PubSubStreamingService_boththrows_args::fromShape(shape(
      'foo' => $foo,
    ));
    await $this->asyncHandler_->genBefore("PubSubStreamingService", "boththrows", $args);
    $currentseqid = $this->sendImplHelper($args, "boththrows", false, "PubSubStreamingService" );
    return await $this->genAwaitStreamResponse(PubSubStreamingService_boththrows_FirstResponse::class, PubSubStreamingService_boththrows_StreamResponse::class, "boththrows", true, $currentseqid, $rpc_options);
  }

  /**
   * Original thrift definition:-
   * i32, stream<i32, throws (1: FooStreamEx e)>
   *   responseandstreamstreamthrows(1: i32 foo);
   */
  public async function responseandstreamstreamthrows(int $foo): Awaitable<\ResponseAndStream<int, int>> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = PubSubStreamingService_responseandstreamstreamthrows_args::fromShape(shape(
      'foo' => $foo,
    ));
    await $this->asyncHandler_->genBefore("PubSubStreamingService", "responseandstreamstreamthrows", $args);
    $currentseqid = $this->sendImplHelper($args, "responseandstreamstreamthrows", false, "PubSubStreamingService" );
    return await $this->genAwaitStreamResponse(PubSubStreamingService_responseandstreamstreamthrows_FirstResponse::class, PubSubStreamingService_responseandstreamstreamthrows_StreamResponse::class, "responseandstreamstreamthrows", false, $currentseqid, $rpc_options);
  }

  /**
   * Original thrift definition:-
   * i32, stream<i32>
   *   responseandstreamservicethrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public async function responseandstreamservicethrows(int $foo): Awaitable<\ResponseAndStream<int, int>> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = PubSubStreamingService_responseandstreamservicethrows_args::fromShape(shape(
      'foo' => $foo,
    ));
    await $this->asyncHandler_->genBefore("PubSubStreamingService", "responseandstreamservicethrows", $args);
    $currentseqid = $this->sendImplHelper($args, "responseandstreamservicethrows", false, "PubSubStreamingService" );
    return await $this->genAwaitStreamResponse(PubSubStreamingService_responseandstreamservicethrows_FirstResponse::class, PubSubStreamingService_responseandstreamservicethrows_StreamResponse::class, "responseandstreamservicethrows", false, $currentseqid, $rpc_options);
  }

  /**
   * Original thrift definition:-
   * i32, stream<i32, throws (1: FooStreamEx e)>
   *   responseandstreamboththrows(1: i32 foo)
   *   throws (1: FooEx e);
   */
  public async function responseandstreamboththrows(int $foo): Awaitable<\ResponseAndStream<int, int>> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = PubSubStreamingService_responseandstreamboththrows_args::fromShape(shape(
      'foo' => $foo,
    ));
    await $this->asyncHandler_->genBefore("PubSubStreamingService", "responseandstreamboththrows", $args);
    $currentseqid = $this->sendImplHelper($args, "responseandstreamboththrows", false, "PubSubStreamingService" );
    return await $this->genAwaitStreamResponse(PubSubStreamingService_responseandstreamboththrows_FirstResponse::class, PubSubStreamingService_responseandstreamboththrows_StreamResponse::class, "responseandstreamboththrows", false, $currentseqid, $rpc_options);
  }

  /**
   * Original thrift definition:-
   * void, stream<i32>
   *   returnstreamFast(1: i32 i32_from,
   *                    2: i32 i32_to);
   */
  public async function returnstreamFast(int $i32_from, int $i32_to): Awaitable<\ResponseAndStream<null, int>> {
    $hh_frame_metadata = $this->getHHFrameMetadata();
    if ($hh_frame_metadata !== null) {
      \HH\set_frame_metadata($hh_frame_metadata);
    }
    $rpc_options = $this->getAndResetOptions() ?? \ThriftClientBase::defaultOptions();
    $args = PubSubStreamingService_returnstreamFast_args::fromShape(shape(
      'i32_from' => $i32_from,
      'i32_to' => $i32_to,
    ));
    await $this->asyncHandler_->genBefore("PubSubStreamingService", "returnstreamFast", $args);
    $currentseqid = $this->sendImplHelper($args, "returnstreamFast", false, "PubSubStreamingService" );
    return await $this->genAwaitStreamResponse(PubSubStreamingService_returnstreamFast_FirstResponse::class, PubSubStreamingService_returnstreamFast_StreamResponse::class, "returnstreamFast", true, $currentseqid, $rpc_options);
  }

}

class PubSubStreamingServiceAsyncClient extends \ThriftClientBase implements PubSubStreamingServiceAsyncClientIf {
  use PubSubStreamingServiceClientBase;

}

class PubSubStreamingServiceClient extends \ThriftClientBase implements PubSubStreamingServiceClientIf {
  use PubSubStreamingServiceClientBase;

}

abstract class PubSubStreamingServiceAsyncProcessorBase extends \ThriftAsyncProcessor {
  use \GetThriftServiceMetadata;
  abstract const type TThriftIf as PubSubStreamingServiceAsyncIf;
  const classname<\IThriftServiceStaticMetadata> SERVICE_METADATA_CLASS = PubSubStreamingServiceStaticMetadata::class;
  const string THRIFT_SVC_NAME = 'PubSubStreamingService';

  protected async function process_getThriftServiceMetadata(int $seqid, \TProtocol $input, \TProtocol $output): Awaitable<void> {
    $this->process_getThriftServiceMetadataHelper($seqid, $input, $output, PubSubStreamingServiceStaticMetadata::class);
  }
}
class PubSubStreamingServiceAsyncProcessor extends PubSubStreamingServiceAsyncProcessorBase {
  const type TThriftIf = PubSubStreamingServiceAsyncIf;
}

abstract class PubSubStreamingServiceSyncProcessorBase extends \ThriftSyncProcessor {
  use \GetThriftServiceMetadata;
  abstract const type TThriftIf as PubSubStreamingServiceIf;
  const classname<\IThriftServiceStaticMetadata> SERVICE_METADATA_CLASS = PubSubStreamingServiceStaticMetadata::class;
  const string THRIFT_SVC_NAME = 'PubSubStreamingService';

  protected function process_getThriftServiceMetadata(int $seqid, \TProtocol $input, \TProtocol $output): void {
    $this->process_getThriftServiceMetadataHelper($seqid, $input, $output, PubSubStreamingServiceStaticMetadata::class);
  }
}
class PubSubStreamingServiceSyncProcessor extends PubSubStreamingServiceSyncProcessorBase {
  const type TThriftIf = PubSubStreamingServiceIf;
}
// For backwards compatibility
class PubSubStreamingServiceProcessor extends PubSubStreamingServiceSyncProcessor {}

// HELPER FUNCTIONS AND STRUCTURES

class PubSubStreamingService_returnstream_args implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'i32_from',
      'type' => \TType::I32,
    ),
    2 => shape(
      'var' => 'i32_to',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'i32_from' => 1,
    'i32_to' => 2,
  ];

  const type TConstructorShape = shape(
    ?'i32_from' => ?int,
    ?'i32_to' => ?int,
  );

  const int STRUCTURAL_ID = 6851224626875989960;
  public int $i32_from;
  public int $i32_to;

  public function __construct(?int $i32_from = null, ?int $i32_to = null)[] {
    $this->i32_from = $i32_from ?? 0;
    $this->i32_to = $i32_to ?? 0;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'i32_from'),
      Shapes::idx($shape, 'i32_to'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_returnstream_args';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.returnstream_args",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "i32_from",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "i32_to",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_returnstream_StreamResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
  );

  const int STRUCTURAL_ID = 3865318819874171525;
  public ?this::TResult $success;

  public function __construct(?this::TResult $success = null)[] {
    $this->success = $success;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_returnstream_StreamResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_returnstream_StreamResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_returnstream_FirstResponse extends \ThriftSyncStructWithoutResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_returnstream_FirstResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_returnstream_FirstResponse",
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_streamthrows_args implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'foo',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'foo' => 1,
  ];

  const type TConstructorShape = shape(
    ?'foo' => ?int,
  );

  const int STRUCTURAL_ID = 4302560019326481254;
  public int $foo;

  public function __construct(?int $foo = null)[] {
    $this->foo = $foo ?? 0;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'foo'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_streamthrows_args';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.streamthrows_args",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "foo",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_streamthrows_StreamResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
    1 => shape(
      'var' => 'e',
      'type' => \TType::STRUCT,
      'class' => FooStreamEx::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
    'e' => 1,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
    ?'e' => ?FooStreamEx,
  );

  const int STRUCTURAL_ID = 7900894693871902695;
  public ?this::TResult $success;
  public ?FooStreamEx $e;

  public function __construct(?this::TResult $success = null, ?FooStreamEx $e = null)[] {
    $this->success = $success;
    $this->e = $e;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
      Shapes::idx($shape, 'e'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_streamthrows_StreamResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_streamthrows_StreamResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.FooStreamEx",
                    )
                  ),
                )
              ),
              "name" => "e",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function checkForException(): ?\TException {
    if ($this->e !== null) {
      return $this->e;
    }
    return null;
  }
  
  public function setException(\Exception $e): bool {
    if ($e is FooStreamEx) {
      $this->e = $e;
      return true;
    }
    return false;
  }
}

class PubSubStreamingService_streamthrows_FirstResponse extends \ThriftSyncStructWithoutResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_streamthrows_FirstResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_streamthrows_FirstResponse",
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_servicethrows_args implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'foo',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'foo' => 1,
  ];

  const type TConstructorShape = shape(
    ?'foo' => ?int,
  );

  const int STRUCTURAL_ID = 4302560019326481254;
  public int $foo;

  public function __construct(?int $foo = null)[] {
    $this->foo = $foo ?? 0;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'foo'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_servicethrows_args';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.servicethrows_args",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "foo",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_servicethrows_StreamResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
  );

  const int STRUCTURAL_ID = 3865318819874171525;
  public ?this::TResult $success;

  public function __construct(?this::TResult $success = null)[] {
    $this->success = $success;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_servicethrows_StreamResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_servicethrows_StreamResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_servicethrows_FirstResponse extends \ThriftSyncStructWithoutResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'e',
      'type' => \TType::STRUCT,
      'class' => FooEx::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'e' => 1,
  ];

  const type TConstructorShape = shape(
    ?'e' => ?FooEx,
  );

  const int STRUCTURAL_ID = 1166333131961181261;
  public ?FooEx $e;

  public function __construct(?FooEx $e = null)[] {
    $this->e = $e;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'e'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_servicethrows_FirstResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_servicethrows_FirstResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.FooEx",
                    )
                  ),
                )
              ),
              "name" => "e",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function checkForException(): ?\TException {
    if ($this->e !== null) {
      return $this->e;
    }
    return null;
  }
  
  public function setException(\Exception $e): bool {
    if ($e is FooEx) {
      $this->e = $e;
      return true;
    }
    return false;
  }
}

class PubSubStreamingService_servicethrows2_args implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'foo',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'foo' => 1,
  ];

  const type TConstructorShape = shape(
    ?'foo' => ?int,
  );

  const int STRUCTURAL_ID = 4302560019326481254;
  public int $foo;

  public function __construct(?int $foo = null)[] {
    $this->foo = $foo ?? 0;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'foo'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_servicethrows2_args';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.servicethrows2_args",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "foo",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_servicethrows2_StreamResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
  );

  const int STRUCTURAL_ID = 3865318819874171525;
  public ?this::TResult $success;

  public function __construct(?this::TResult $success = null)[] {
    $this->success = $success;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_servicethrows2_StreamResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_servicethrows2_StreamResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_servicethrows2_FirstResponse extends \ThriftSyncStructWithoutResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'e1',
      'type' => \TType::STRUCT,
      'class' => FooEx::class,
    ),
    2 => shape(
      'var' => 'e2',
      'type' => \TType::STRUCT,
      'class' => FooEx2::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'e1' => 1,
    'e2' => 2,
  ];

  const type TConstructorShape = shape(
    ?'e1' => ?FooEx,
    ?'e2' => ?FooEx2,
  );

  const int STRUCTURAL_ID = 5404057405652507927;
  public ?FooEx $e1;
  public ?FooEx2 $e2;

  public function __construct(?FooEx $e1 = null, ?FooEx2 $e2 = null)[] {
    $this->e1 = $e1;
    $this->e2 = $e2;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'e1'),
      Shapes::idx($shape, 'e2'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_servicethrows2_FirstResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_servicethrows2_FirstResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.FooEx",
                    )
                  ),
                )
              ),
              "name" => "e1",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.FooEx2",
                    )
                  ),
                )
              ),
              "name" => "e2",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function checkForException(): ?\TException {
    if ($this->e1 !== null) {
      return $this->e1;
    }
    if ($this->e2 !== null) {
      return $this->e2;
    }
    return null;
  }
  
  public function setException(\Exception $e): bool {
    if ($e is FooEx) {
      $this->e1 = $e;
      return true;
    }
    if ($e is FooEx2) {
      $this->e2 = $e;
      return true;
    }
    return false;
  }
}

class PubSubStreamingService_boththrows_args implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'foo',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'foo' => 1,
  ];

  const type TConstructorShape = shape(
    ?'foo' => ?int,
  );

  const int STRUCTURAL_ID = 4302560019326481254;
  public int $foo;

  public function __construct(?int $foo = null)[] {
    $this->foo = $foo ?? 0;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'foo'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_boththrows_args';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.boththrows_args",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "foo",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_boththrows_StreamResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
    1 => shape(
      'var' => 'e',
      'type' => \TType::STRUCT,
      'class' => FooStreamEx::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
    'e' => 1,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
    ?'e' => ?FooStreamEx,
  );

  const int STRUCTURAL_ID = 7900894693871902695;
  public ?this::TResult $success;
  public ?FooStreamEx $e;

  public function __construct(?this::TResult $success = null, ?FooStreamEx $e = null)[] {
    $this->success = $success;
    $this->e = $e;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
      Shapes::idx($shape, 'e'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_boththrows_StreamResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_boththrows_StreamResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.FooStreamEx",
                    )
                  ),
                )
              ),
              "name" => "e",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function checkForException(): ?\TException {
    if ($this->e !== null) {
      return $this->e;
    }
    return null;
  }
  
  public function setException(\Exception $e): bool {
    if ($e is FooStreamEx) {
      $this->e = $e;
      return true;
    }
    return false;
  }
}

class PubSubStreamingService_boththrows_FirstResponse extends \ThriftSyncStructWithoutResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'e',
      'type' => \TType::STRUCT,
      'class' => FooEx::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'e' => 1,
  ];

  const type TConstructorShape = shape(
    ?'e' => ?FooEx,
  );

  const int STRUCTURAL_ID = 1166333131961181261;
  public ?FooEx $e;

  public function __construct(?FooEx $e = null)[] {
    $this->e = $e;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'e'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_boththrows_FirstResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_boththrows_FirstResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.FooEx",
                    )
                  ),
                )
              ),
              "name" => "e",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function checkForException(): ?\TException {
    if ($this->e !== null) {
      return $this->e;
    }
    return null;
  }
  
  public function setException(\Exception $e): bool {
    if ($e is FooEx) {
      $this->e = $e;
      return true;
    }
    return false;
  }
}

class PubSubStreamingService_responseandstreamstreamthrows_args implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'foo',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'foo' => 1,
  ];

  const type TConstructorShape = shape(
    ?'foo' => ?int,
  );

  const int STRUCTURAL_ID = 4302560019326481254;
  public int $foo;

  public function __construct(?int $foo = null)[] {
    $this->foo = $foo ?? 0;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'foo'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_responseandstreamstreamthrows_args';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.responseandstreamstreamthrows_args",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "foo",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_responseandstreamstreamthrows_StreamResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
    1 => shape(
      'var' => 'e',
      'type' => \TType::STRUCT,
      'class' => FooStreamEx::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
    'e' => 1,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
    ?'e' => ?FooStreamEx,
  );

  const int STRUCTURAL_ID = 7900894693871902695;
  public ?this::TResult $success;
  public ?FooStreamEx $e;

  public function __construct(?this::TResult $success = null, ?FooStreamEx $e = null)[] {
    $this->success = $success;
    $this->e = $e;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
      Shapes::idx($shape, 'e'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_responseandstreamstreamthrows_StreamResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_responseandstreamstreamthrows_StreamResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.FooStreamEx",
                    )
                  ),
                )
              ),
              "name" => "e",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function checkForException(): ?\TException {
    if ($this->e !== null) {
      return $this->e;
    }
    return null;
  }
  
  public function setException(\Exception $e): bool {
    if ($e is FooStreamEx) {
      $this->e = $e;
      return true;
    }
    return false;
  }
}

class PubSubStreamingService_responseandstreamstreamthrows_FirstResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
  );

  const int STRUCTURAL_ID = 3865318819874171525;
  public ?this::TResult $success;

  public function __construct(?this::TResult $success = null)[] {
    $this->success = $success;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_responseandstreamstreamthrows_FirstResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_responseandstreamstreamthrows_FirstResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_responseandstreamservicethrows_args implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'foo',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'foo' => 1,
  ];

  const type TConstructorShape = shape(
    ?'foo' => ?int,
  );

  const int STRUCTURAL_ID = 4302560019326481254;
  public int $foo;

  public function __construct(?int $foo = null)[] {
    $this->foo = $foo ?? 0;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'foo'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_responseandstreamservicethrows_args';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.responseandstreamservicethrows_args",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "foo",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_responseandstreamservicethrows_StreamResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
  );

  const int STRUCTURAL_ID = 3865318819874171525;
  public ?this::TResult $success;

  public function __construct(?this::TResult $success = null)[] {
    $this->success = $success;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_responseandstreamservicethrows_StreamResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_responseandstreamservicethrows_StreamResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_responseandstreamservicethrows_FirstResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
    1 => shape(
      'var' => 'e',
      'type' => \TType::STRUCT,
      'class' => FooEx::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
    'e' => 1,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
    ?'e' => ?FooEx,
  );

  const int STRUCTURAL_ID = 7792945036684644137;
  public ?this::TResult $success;
  public ?FooEx $e;

  public function __construct(?this::TResult $success = null, ?FooEx $e = null)[] {
    $this->success = $success;
    $this->e = $e;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
      Shapes::idx($shape, 'e'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_responseandstreamservicethrows_FirstResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_responseandstreamservicethrows_FirstResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.FooEx",
                    )
                  ),
                )
              ),
              "name" => "e",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function checkForException(): ?\TException {
    if ($this->e !== null) {
      return $this->e;
    }
    return null;
  }
  
  public function setException(\Exception $e): bool {
    if ($e is FooEx) {
      $this->e = $e;
      return true;
    }
    return false;
  }
}

class PubSubStreamingService_responseandstreamboththrows_args implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'foo',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'foo' => 1,
  ];

  const type TConstructorShape = shape(
    ?'foo' => ?int,
  );

  const int STRUCTURAL_ID = 4302560019326481254;
  public int $foo;

  public function __construct(?int $foo = null)[] {
    $this->foo = $foo ?? 0;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'foo'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_responseandstreamboththrows_args';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.responseandstreamboththrows_args",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "foo",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_responseandstreamboththrows_StreamResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
    1 => shape(
      'var' => 'e',
      'type' => \TType::STRUCT,
      'class' => FooStreamEx::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
    'e' => 1,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
    ?'e' => ?FooStreamEx,
  );

  const int STRUCTURAL_ID = 7900894693871902695;
  public ?this::TResult $success;
  public ?FooStreamEx $e;

  public function __construct(?this::TResult $success = null, ?FooStreamEx $e = null)[] {
    $this->success = $success;
    $this->e = $e;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
      Shapes::idx($shape, 'e'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_responseandstreamboththrows_StreamResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_responseandstreamboththrows_StreamResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.FooStreamEx",
                    )
                  ),
                )
              ),
              "name" => "e",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function checkForException(): ?\TException {
    if ($this->e !== null) {
      return $this->e;
    }
    return null;
  }
  
  public function setException(\Exception $e): bool {
    if ($e is FooStreamEx) {
      $this->e = $e;
      return true;
    }
    return false;
  }
}

class PubSubStreamingService_responseandstreamboththrows_FirstResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
    1 => shape(
      'var' => 'e',
      'type' => \TType::STRUCT,
      'class' => FooEx::class,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
    'e' => 1,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
    ?'e' => ?FooEx,
  );

  const int STRUCTURAL_ID = 7792945036684644137;
  public ?this::TResult $success;
  public ?FooEx $e;

  public function __construct(?this::TResult $success = null, ?FooEx $e = null)[] {
    $this->success = $success;
    $this->e = $e;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
      Shapes::idx($shape, 'e'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_responseandstreamboththrows_FirstResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_responseandstreamboththrows_FirstResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_struct" => tmeta_ThriftStructType::fromShape(
                    shape(
                      "name" => "module.FooEx",
                    )
                  ),
                )
              ),
              "name" => "e",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

  public function checkForException(): ?\TException {
    if ($this->e !== null) {
      return $this->e;
    }
    return null;
  }
  
  public function setException(\Exception $e): bool {
    if ($e is FooEx) {
      $this->e = $e;
      return true;
    }
    return false;
  }
}

class PubSubStreamingService_returnstreamFast_args implements \IThriftSyncStruct, \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
    1 => shape(
      'var' => 'i32_from',
      'type' => \TType::I32,
    ),
    2 => shape(
      'var' => 'i32_to',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'i32_from' => 1,
    'i32_to' => 2,
  ];

  const type TConstructorShape = shape(
    ?'i32_from' => ?int,
    ?'i32_to' => ?int,
  );

  const int STRUCTURAL_ID = 6851224626875989960;
  public int $i32_from;
  public int $i32_to;

  public function __construct(?int $i32_from = null, ?int $i32_to = null)[] {
    $this->i32_from = $i32_from ?? 0;
    $this->i32_to = $i32_to ?? 0;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'i32_from'),
      Shapes::idx($shape, 'i32_to'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_returnstreamFast_args';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.returnstreamFast_args",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 1,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "i32_from",
            )
          ),
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 2,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "i32_to",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_returnstreamFast_StreamResponse extends \ThriftSyncStructWithResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const type TResult = int;

  const \ThriftStructTypes::TSpec SPEC = dict[
    0 => shape(
      'var' => 'success',
      'type' => \TType::I32,
    ),
  ];
  const dict<string, int> FIELDMAP = dict[
    'success' => 0,
  ];

  const type TConstructorShape = shape(
    ?'success' => ?this::TResult,
  );

  const int STRUCTURAL_ID = 3865318819874171525;
  public ?this::TResult $success;

  public function __construct(?this::TResult $success = null)[] {
    $this->success = $success;
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
      Shapes::idx($shape, 'success'),
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_returnstreamFast_StreamResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_returnstreamFast_StreamResponse",
        "fields" => vec[
          tmeta_ThriftField::fromShape(
            shape(
              "id" => 0,
              "type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                )
              ),
              "name" => "success",
            )
          ),
        ],
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingService_returnstreamFast_FirstResponse extends \ThriftSyncStructWithoutResult implements \IThriftStructMetadata {
  use \ThriftSerializationTrait;

  const \ThriftStructTypes::TSpec SPEC = dict[
  ];
  const dict<string, int> FIELDMAP = dict[
  ];

  const type TConstructorShape = shape(
  );

  const int STRUCTURAL_ID = 957977401221134810;

  public function __construct()[] {
  }

  public static function withDefaultValues()[]: this {
    return new static();
  }

  public static function fromShape(self::TConstructorShape $shape)[]: this {
    return new static(
    );
  }

  public function getName()[]: string {
    return 'PubSubStreamingService_returnstreamFast_FirstResponse';
  }

  public static function getStructMetadata()[]: \tmeta_ThriftStruct {
    return tmeta_ThriftStruct::fromShape(
      shape(
        "name" => "module.PubSubStreamingService_returnstreamFast_FirstResponse",
        "is_union" => false,
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TStructAnnotations {
    return shape(
      'struct' => dict[],
      'fields' => dict[
      ],
    );
  }

  public function getInstanceKey()[write_props]: string {
    return \TCompactSerializer::serialize($this);
  }

}

class PubSubStreamingServiceStaticMetadata implements \IThriftServiceStaticMetadata {
  public static function getServiceMetadata()[]: \tmeta_ThriftService {
    return tmeta_ThriftService::fromShape(
      shape(
        "name" => "module.PubSubStreamingService",
        "functions" => vec[
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "returnstream",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_stream" => tmeta_ThriftStreamType::fromShape(
                    shape(
                      "elemType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                      "initialResponseType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_VOID_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "arguments" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "i32_from",
                  )
                ),
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 2,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "i32_to",
                  )
                ),
              ],
            )
          ),
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "streamthrows",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_stream" => tmeta_ThriftStreamType::fromShape(
                    shape(
                      "elemType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                      "initialResponseType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_VOID_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "arguments" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "foo",
                  )
                ),
              ],
            )
          ),
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "servicethrows",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_stream" => tmeta_ThriftStreamType::fromShape(
                    shape(
                      "elemType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                      "initialResponseType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_VOID_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "arguments" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "foo",
                  )
                ),
              ],
              "exceptions" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_struct" => tmeta_ThriftStructType::fromShape(
                          shape(
                            "name" => "module.FooEx",
                          )
                        ),
                      )
                    ),
                    "name" => "e",
                  )
                ),
              ],
            )
          ),
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "servicethrows2",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_stream" => tmeta_ThriftStreamType::fromShape(
                    shape(
                      "elemType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                      "initialResponseType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_VOID_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "arguments" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "foo",
                  )
                ),
              ],
              "exceptions" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_struct" => tmeta_ThriftStructType::fromShape(
                          shape(
                            "name" => "module.FooEx",
                          )
                        ),
                      )
                    ),
                    "name" => "e1",
                  )
                ),
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 2,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_struct" => tmeta_ThriftStructType::fromShape(
                          shape(
                            "name" => "module.FooEx2",
                          )
                        ),
                      )
                    ),
                    "name" => "e2",
                  )
                ),
              ],
            )
          ),
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "boththrows",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_stream" => tmeta_ThriftStreamType::fromShape(
                    shape(
                      "elemType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                      "initialResponseType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_VOID_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "arguments" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "foo",
                  )
                ),
              ],
              "exceptions" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_struct" => tmeta_ThriftStructType::fromShape(
                          shape(
                            "name" => "module.FooEx",
                          )
                        ),
                      )
                    ),
                    "name" => "e",
                  )
                ),
              ],
            )
          ),
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "responseandstreamstreamthrows",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_stream" => tmeta_ThriftStreamType::fromShape(
                    shape(
                      "elemType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                      "initialResponseType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "arguments" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "foo",
                  )
                ),
              ],
            )
          ),
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "responseandstreamservicethrows",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_stream" => tmeta_ThriftStreamType::fromShape(
                    shape(
                      "elemType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                      "initialResponseType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "arguments" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "foo",
                  )
                ),
              ],
              "exceptions" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_struct" => tmeta_ThriftStructType::fromShape(
                          shape(
                            "name" => "module.FooEx",
                          )
                        ),
                      )
                    ),
                    "name" => "e",
                  )
                ),
              ],
            )
          ),
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "responseandstreamboththrows",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_stream" => tmeta_ThriftStreamType::fromShape(
                    shape(
                      "elemType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                      "initialResponseType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "arguments" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "foo",
                  )
                ),
              ],
              "exceptions" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_struct" => tmeta_ThriftStructType::fromShape(
                          shape(
                            "name" => "module.FooEx",
                          )
                        ),
                      )
                    ),
                    "name" => "e",
                  )
                ),
              ],
            )
          ),
          tmeta_ThriftFunction::fromShape(
            shape(
              "name" => "returnstreamFast",
              "return_type" => tmeta_ThriftType::fromShape(
                shape(
                  "t_stream" => tmeta_ThriftStreamType::fromShape(
                    shape(
                      "elemType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                        )
                      ),
                      "initialResponseType" => tmeta_ThriftType::fromShape(
                        shape(
                          "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_VOID_TYPE,
                        )
                      ),
                    )
                  ),
                )
              ),
              "arguments" => vec[
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 1,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "i32_from",
                  )
                ),
                tmeta_ThriftField::fromShape(
                  shape(
                    "id" => 2,
                    "type" => tmeta_ThriftType::fromShape(
                      shape(
                        "t_primitive" => tmeta_ThriftPrimitiveType::THRIFT_I32_TYPE,
                      )
                    ),
                    "name" => "i32_to",
                  )
                ),
              ],
            )
          ),
        ],
      )
    );
  }

  public static function getServiceMetadataResponse()[]: \tmeta_ThriftServiceMetadataResponse {
    return \tmeta_ThriftServiceMetadataResponse::fromShape(
      shape(
        'context' => \tmeta_ThriftServiceContext::fromShape(
          shape(
            'service_info' => self::getServiceMetadata(),
            'module' => \tmeta_ThriftModuleContext::fromShape(
              shape(
                'name' => 'module',
              )
            ),
          )
        ),
        'metadata' => \tmeta_ThriftMetadata::fromShape(
          shape(
            'enums' => dict[
            ],
            'structs' => dict[
            ],
            'exceptions' => dict[
              'module.FooEx' => FooEx::getExceptionMetadata(),
              'module.FooEx2' => FooEx2::getExceptionMetadata(),
            ],
            'services' => dict[
            ],
          )
        ),
      )
    );
  }

  public static function getAllStructuredAnnotations()[write_props]: \TServiceAnnotations {
    return shape(
      'service' => dict[],
      'functions' => dict[
        'returnstreamFast' => dict[
          '\facebook\thrift\annotation\cpp\ProcessInEbThreadUnsafe' => \facebook\thrift\annotation\cpp\ProcessInEbThreadUnsafe::fromShape(
            shape(
            )
          ),
        ],
      ],
    );
  }
}

