PostApiV3DiscussionsRequest.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945
  1. <?php
  2. /**
  3. * PostApiV3DiscussionsRequest
  4. *
  5. * PHP version 8.1
  6. *
  7. * @category Class
  8. * @package WikipaliApi
  9. * @author OpenAPI Generator team
  10. * @link https://openapi-generator.tech
  11. */
  12. /**
  13. * MINT API
  14. *
  15. * International Academy Of Pali Tipitaka(国际巴利三藏学院) 由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
  16. *
  17. * The version of the OpenAPI document: 2026.10.15
  18. * Generated by: https://openapi-generator.tech
  19. * Generator version: 7.25.0
  20. */
  21. /**
  22. * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
  23. * https://openapi-generator.tech
  24. * Do not edit the class manually.
  25. */
  26. namespace WikipaliApi\Model;
  27. use \ArrayAccess;
  28. use \WikipaliApi\ObjectSerializer;
  29. /**
  30. * PostApiV3DiscussionsRequest Class Doc Comment
  31. *
  32. * @category Class
  33. * @package WikipaliApi
  34. * @author OpenAPI Generator team
  35. * @link https://openapi-generator.tech
  36. * @implements \ArrayAccess<string, mixed>
  37. */
  38. class PostApiV3DiscussionsRequest implements ModelInterface, ArrayAccess, \JsonSerializable
  39. {
  40. public const DISCRIMINATOR = null;
  41. /**
  42. * The original name of the model.
  43. *
  44. * @var string
  45. */
  46. protected static $openAPIModelName = 'post_api_v3_discussions_request';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'target_type' => 'string',
  54. 'target_id' => 'string',
  55. 'type' => 'string',
  56. 'title' => 'string',
  57. 'content' => 'string',
  58. 'severity' => 'string',
  59. 'pos_start' => 'int',
  60. 'pos_end' => 'int',
  61. 'quote_exact' => 'string',
  62. 'quote_prefix' => 'string',
  63. 'quote_suffix' => 'string',
  64. 'tpl_id' => 'string',
  65. 'notify' => 'bool'
  66. ];
  67. /**
  68. * Array of property to format mappings. Used for (de)serialization
  69. *
  70. * @var string[]
  71. * @phpstan-var array<string, string|null>
  72. * @psalm-var array<string, string|null>
  73. */
  74. protected static $openAPIFormats = [
  75. 'target_type' => null,
  76. 'target_id' => null,
  77. 'type' => null,
  78. 'title' => null,
  79. 'content' => null,
  80. 'severity' => null,
  81. 'pos_start' => null,
  82. 'pos_end' => null,
  83. 'quote_exact' => null,
  84. 'quote_prefix' => null,
  85. 'quote_suffix' => null,
  86. 'tpl_id' => null,
  87. 'notify' => null
  88. ];
  89. /**
  90. * Array of nullable properties. Used for (de)serialization
  91. *
  92. * @var boolean[]
  93. */
  94. protected static array $openAPINullables = [
  95. 'target_type' => false,
  96. 'target_id' => false,
  97. 'type' => false,
  98. 'title' => false,
  99. 'content' => false,
  100. 'severity' => false,
  101. 'pos_start' => false,
  102. 'pos_end' => false,
  103. 'quote_exact' => false,
  104. 'quote_prefix' => false,
  105. 'quote_suffix' => false,
  106. 'tpl_id' => false,
  107. 'notify' => false
  108. ];
  109. /**
  110. * If a nullable field gets set to null, insert it here
  111. *
  112. * @var boolean[]
  113. */
  114. protected array $openAPINullablesSetToNull = [];
  115. /**
  116. * Array of property to type mappings. Used for (de)serialization
  117. *
  118. * @return array
  119. */
  120. public static function openAPITypes()
  121. {
  122. return self::$openAPITypes;
  123. }
  124. /**
  125. * Array of property to format mappings. Used for (de)serialization
  126. *
  127. * @return array
  128. */
  129. public static function openAPIFormats()
  130. {
  131. return self::$openAPIFormats;
  132. }
  133. /**
  134. * Array of nullable properties
  135. *
  136. * @return array
  137. */
  138. protected static function openAPINullables(): array
  139. {
  140. return self::$openAPINullables;
  141. }
  142. /**
  143. * Array of nullable field names deliberately set to null
  144. *
  145. * @return boolean[]
  146. */
  147. private function getOpenAPINullablesSetToNull(): array
  148. {
  149. return $this->openAPINullablesSetToNull;
  150. }
  151. /**
  152. * Setter - Array of nullable field names deliberately set to null
  153. *
  154. * @param boolean[] $openAPINullablesSetToNull
  155. */
  156. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  157. {
  158. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  159. }
  160. /**
  161. * Checks if a property is nullable
  162. *
  163. * @param string $property
  164. * @return bool
  165. */
  166. public static function isNullable(string $property): bool
  167. {
  168. return self::openAPINullables()[$property] ?? false;
  169. }
  170. /**
  171. * Checks if a nullable property is set to null.
  172. *
  173. * @param string $property
  174. * @return bool
  175. */
  176. public function isNullableSetToNull(string $property): bool
  177. {
  178. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  179. }
  180. /**
  181. * Array of attributes where the key is the local name,
  182. * and the value is the original name
  183. *
  184. * @var string[]
  185. */
  186. protected static $attributeMap = [
  187. 'target_type' => 'target_type',
  188. 'target_id' => 'target_id',
  189. 'type' => 'type',
  190. 'title' => 'title',
  191. 'content' => 'content',
  192. 'severity' => 'severity',
  193. 'pos_start' => 'pos_start',
  194. 'pos_end' => 'pos_end',
  195. 'quote_exact' => 'quote_exact',
  196. 'quote_prefix' => 'quote_prefix',
  197. 'quote_suffix' => 'quote_suffix',
  198. 'tpl_id' => 'tpl_id',
  199. 'notify' => 'notify'
  200. ];
  201. /**
  202. * Array of attributes to setter functions (for deserialization of responses)
  203. *
  204. * @var string[]
  205. */
  206. protected static $setters = [
  207. 'target_type' => 'setTargetType',
  208. 'target_id' => 'setTargetId',
  209. 'type' => 'setType',
  210. 'title' => 'setTitle',
  211. 'content' => 'setContent',
  212. 'severity' => 'setSeverity',
  213. 'pos_start' => 'setPosStart',
  214. 'pos_end' => 'setPosEnd',
  215. 'quote_exact' => 'setQuoteExact',
  216. 'quote_prefix' => 'setQuotePrefix',
  217. 'quote_suffix' => 'setQuoteSuffix',
  218. 'tpl_id' => 'setTplId',
  219. 'notify' => 'setNotify'
  220. ];
  221. /**
  222. * Array of attributes to getter functions (for serialization of requests)
  223. *
  224. * @var string[]
  225. */
  226. protected static $getters = [
  227. 'target_type' => 'getTargetType',
  228. 'target_id' => 'getTargetId',
  229. 'type' => 'getType',
  230. 'title' => 'getTitle',
  231. 'content' => 'getContent',
  232. 'severity' => 'getSeverity',
  233. 'pos_start' => 'getPosStart',
  234. 'pos_end' => 'getPosEnd',
  235. 'quote_exact' => 'getQuoteExact',
  236. 'quote_prefix' => 'getQuotePrefix',
  237. 'quote_suffix' => 'getQuoteSuffix',
  238. 'tpl_id' => 'getTplId',
  239. 'notify' => 'getNotify'
  240. ];
  241. /**
  242. * Array of attributes where the key is the local name,
  243. * and the value is the original name
  244. *
  245. * @return array
  246. */
  247. public static function attributeMap()
  248. {
  249. return self::$attributeMap;
  250. }
  251. /**
  252. * Array of attributes to setter functions (for deserialization of responses)
  253. *
  254. * @return array
  255. */
  256. public static function setters()
  257. {
  258. return self::$setters;
  259. }
  260. /**
  261. * Array of attributes to getter functions (for serialization of requests)
  262. *
  263. * @return array
  264. */
  265. public static function getters()
  266. {
  267. return self::$getters;
  268. }
  269. /**
  270. * The original name of the model.
  271. *
  272. * @return string
  273. */
  274. public function getModelName()
  275. {
  276. return self::$openAPIModelName;
  277. }
  278. public const TARGET_TYPE_SENTENCE = 'sentence';
  279. public const TARGET_TYPE_WBW = 'wbw';
  280. public const TARGET_TYPE_ARTICLE = 'article';
  281. public const TARGET_TYPE_TERM = 'term';
  282. public const TARGET_TYPE_TASK = 'task';
  283. public const TYPE_DISCUSSION = 'discussion';
  284. public const TYPE_QA = 'qa';
  285. public const TYPE_HELP = 'help';
  286. public const TYPE_ISSUE = 'issue';
  287. public const TYPE_NOTE = 'note';
  288. public const TYPE_COMMENTARY = 'commentary';
  289. public const SEVERITY_ERROR = 'error';
  290. public const SEVERITY_WARNING = 'warning';
  291. public const SEVERITY_INFO = 'info';
  292. public const SEVERITY_URGENT = 'urgent';
  293. public const SEVERITY_NORMAL = 'normal';
  294. /**
  295. * Gets allowable values of the enum
  296. *
  297. * @return string[]
  298. */
  299. public function getTargetTypeAllowableValues()
  300. {
  301. return [
  302. self::TARGET_TYPE_SENTENCE,
  303. self::TARGET_TYPE_WBW,
  304. self::TARGET_TYPE_ARTICLE,
  305. self::TARGET_TYPE_TERM,
  306. self::TARGET_TYPE_TASK,
  307. ];
  308. }
  309. /**
  310. * Gets allowable values of the enum
  311. *
  312. * @return string[]
  313. */
  314. public function getTypeAllowableValues()
  315. {
  316. return [
  317. self::TYPE_DISCUSSION,
  318. self::TYPE_QA,
  319. self::TYPE_HELP,
  320. self::TYPE_ISSUE,
  321. self::TYPE_NOTE,
  322. self::TYPE_COMMENTARY,
  323. ];
  324. }
  325. /**
  326. * Gets allowable values of the enum
  327. *
  328. * @return string[]
  329. */
  330. public function getSeverityAllowableValues()
  331. {
  332. return [
  333. self::SEVERITY_ERROR,
  334. self::SEVERITY_WARNING,
  335. self::SEVERITY_INFO,
  336. self::SEVERITY_URGENT,
  337. self::SEVERITY_NORMAL,
  338. ];
  339. }
  340. /**
  341. * Associative array for storing property values
  342. *
  343. * @var mixed[]
  344. */
  345. protected $container = [];
  346. /**
  347. * Constructor
  348. *
  349. * @param mixed[]|null $data Associated array of property values
  350. * initializing the model
  351. */
  352. public function __construct(?array $data = null)
  353. {
  354. $this->setIfExists('target_type', $data ?? [], null);
  355. $this->setIfExists('target_id', $data ?? [], null);
  356. $this->setIfExists('type', $data ?? [], 'discussion');
  357. $this->setIfExists('title', $data ?? [], null);
  358. $this->setIfExists('content', $data ?? [], null);
  359. $this->setIfExists('severity', $data ?? [], null);
  360. $this->setIfExists('pos_start', $data ?? [], null);
  361. $this->setIfExists('pos_end', $data ?? [], null);
  362. $this->setIfExists('quote_exact', $data ?? [], null);
  363. $this->setIfExists('quote_prefix', $data ?? [], null);
  364. $this->setIfExists('quote_suffix', $data ?? [], null);
  365. $this->setIfExists('tpl_id', $data ?? [], null);
  366. $this->setIfExists('notify', $data ?? [], true);
  367. }
  368. /**
  369. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  370. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  371. * $this->openAPINullablesSetToNull array
  372. *
  373. * @param string $variableName
  374. * @param array $fields
  375. * @param mixed $defaultValue
  376. */
  377. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  378. {
  379. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  380. $this->openAPINullablesSetToNull[] = $variableName;
  381. }
  382. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  383. }
  384. /**
  385. * Show all the invalid properties with reasons.
  386. *
  387. * @return array invalid properties with reasons
  388. */
  389. public function listInvalidProperties()
  390. {
  391. $invalidProperties = [];
  392. if ($this->container['target_type'] === null) {
  393. $invalidProperties[] = "'target_type' can't be null";
  394. }
  395. $allowedValues = $this->getTargetTypeAllowableValues();
  396. if (!is_null($this->container['target_type']) && !in_array($this->container['target_type'], $allowedValues, true)) {
  397. $invalidProperties[] = sprintf(
  398. "invalid value '%s' for 'target_type', must be one of '%s'",
  399. $this->container['target_type'],
  400. implode("', '", $allowedValues)
  401. );
  402. }
  403. if ($this->container['target_id'] === null) {
  404. $invalidProperties[] = "'target_id' can't be null";
  405. }
  406. $allowedValues = $this->getTypeAllowableValues();
  407. if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
  408. $invalidProperties[] = sprintf(
  409. "invalid value '%s' for 'type', must be one of '%s'",
  410. $this->container['type'],
  411. implode("', '", $allowedValues)
  412. );
  413. }
  414. $allowedValues = $this->getSeverityAllowableValues();
  415. if (!is_null($this->container['severity']) && !in_array($this->container['severity'], $allowedValues, true)) {
  416. $invalidProperties[] = sprintf(
  417. "invalid value '%s' for 'severity', must be one of '%s'",
  418. $this->container['severity'],
  419. implode("', '", $allowedValues)
  420. );
  421. }
  422. return $invalidProperties;
  423. }
  424. /**
  425. * Validate all the properties in the model
  426. * return true if all passed
  427. *
  428. * @return bool True if all properties are valid
  429. */
  430. public function valid()
  431. {
  432. return count($this->listInvalidProperties()) === 0;
  433. }
  434. /**
  435. * Gets target_type
  436. *
  437. * @return string
  438. */
  439. public function getTargetType()
  440. {
  441. return $this->container['target_type'];
  442. }
  443. /**
  444. * Sets target_type
  445. *
  446. * @param string $target_type 挂靠对象的类型
  447. *
  448. * @return self
  449. */
  450. public function setTargetType($target_type)
  451. {
  452. if (is_null($target_type)) {
  453. throw new \InvalidArgumentException('non-nullable target_type cannot be null');
  454. }
  455. $allowedValues = $this->getTargetTypeAllowableValues();
  456. if (!in_array($target_type, $allowedValues, true)) {
  457. throw new \InvalidArgumentException(
  458. sprintf(
  459. "Invalid value '%s' for 'target_type', must be one of '%s'",
  460. $target_type,
  461. implode("', '", $allowedValues)
  462. )
  463. );
  464. }
  465. $this->container['target_type'] = $target_type;
  466. return $this;
  467. }
  468. /**
  469. * Gets target_id
  470. *
  471. * @return string
  472. */
  473. public function getTargetId()
  474. {
  475. return $this->container['target_id'];
  476. }
  477. /**
  478. * Sets target_id
  479. *
  480. * @param string $target_id 挂靠对象的 uuid
  481. *
  482. * @return self
  483. */
  484. public function setTargetId($target_id)
  485. {
  486. if (is_null($target_id)) {
  487. throw new \InvalidArgumentException('non-nullable target_id cannot be null');
  488. }
  489. $this->container['target_id'] = $target_id;
  490. return $this;
  491. }
  492. /**
  493. * Gets type
  494. *
  495. * @return string|null
  496. */
  497. public function getType()
  498. {
  499. return $this->container['type'];
  500. }
  501. /**
  502. * Sets type
  503. *
  504. * @param string|null $type 类型
  505. *
  506. * @return self
  507. */
  508. public function setType($type)
  509. {
  510. if (is_null($type)) {
  511. throw new \InvalidArgumentException('non-nullable type cannot be null');
  512. }
  513. $allowedValues = $this->getTypeAllowableValues();
  514. if (!in_array($type, $allowedValues, true)) {
  515. throw new \InvalidArgumentException(
  516. sprintf(
  517. "Invalid value '%s' for 'type', must be one of '%s'",
  518. $type,
  519. implode("', '", $allowedValues)
  520. )
  521. );
  522. }
  523. $this->container['type'] = $type;
  524. return $this;
  525. }
  526. /**
  527. * Gets title
  528. *
  529. * @return string|null
  530. */
  531. public function getTitle()
  532. {
  533. return $this->container['title'];
  534. }
  535. /**
  536. * Sets title
  537. *
  538. * @param string|null $title 标题,最长 256 字符;评论线程必填,批注可省
  539. *
  540. * @return self
  541. */
  542. public function setTitle($title)
  543. {
  544. if (is_null($title)) {
  545. throw new \InvalidArgumentException('non-nullable title cannot be null');
  546. }
  547. $this->container['title'] = $title;
  548. return $this;
  549. }
  550. /**
  551. * Gets content
  552. *
  553. * @return string|null
  554. */
  555. public function getContent()
  556. {
  557. return $this->container['content'];
  558. }
  559. /**
  560. * Sets content
  561. *
  562. * @param string|null $content 正文(markdown);批注必填
  563. *
  564. * @return self
  565. */
  566. public function setContent($content)
  567. {
  568. if (is_null($content)) {
  569. throw new \InvalidArgumentException('non-nullable content cannot be null');
  570. }
  571. $this->container['content'] = $content;
  572. return $this;
  573. }
  574. /**
  575. * Gets severity
  576. *
  577. * @return string|null
  578. */
  579. public function getSeverity()
  580. {
  581. return $this->container['severity'];
  582. }
  583. /**
  584. * Sets severity
  585. *
  586. * @param string|null $severity 严重程度
  587. *
  588. * @return self
  589. */
  590. public function setSeverity($severity)
  591. {
  592. if (is_null($severity)) {
  593. throw new \InvalidArgumentException('non-nullable severity cannot be null');
  594. }
  595. $allowedValues = $this->getSeverityAllowableValues();
  596. if (!in_array($severity, $allowedValues, true)) {
  597. throw new \InvalidArgumentException(
  598. sprintf(
  599. "Invalid value '%s' for 'severity', must be one of '%s'",
  600. $severity,
  601. implode("', '", $allowedValues)
  602. )
  603. );
  604. }
  605. $this->container['severity'] = $severity;
  606. return $this;
  607. }
  608. /**
  609. * Gets pos_start
  610. *
  611. * @return int|null
  612. */
  613. public function getPosStart()
  614. {
  615. return $this->container['pos_start'];
  616. }
  617. /**
  618. * Sets pos_start
  619. *
  620. * @param int|null $pos_start 批注锚点在句子文本中的起始偏移(只限批注)
  621. *
  622. * @return self
  623. */
  624. public function setPosStart($pos_start)
  625. {
  626. if (is_null($pos_start)) {
  627. throw new \InvalidArgumentException('non-nullable pos_start cannot be null');
  628. }
  629. $this->container['pos_start'] = $pos_start;
  630. return $this;
  631. }
  632. /**
  633. * Gets pos_end
  634. *
  635. * @return int|null
  636. */
  637. public function getPosEnd()
  638. {
  639. return $this->container['pos_end'];
  640. }
  641. /**
  642. * Sets pos_end
  643. *
  644. * @param int|null $pos_end 批注锚点的结束偏移,批注插在这里(只限批注)
  645. *
  646. * @return self
  647. */
  648. public function setPosEnd($pos_end)
  649. {
  650. if (is_null($pos_end)) {
  651. throw new \InvalidArgumentException('non-nullable pos_end cannot be null');
  652. }
  653. $this->container['pos_end'] = $pos_end;
  654. return $this;
  655. }
  656. /**
  657. * Gets quote_exact
  658. *
  659. * @return string|null
  660. */
  661. public function getQuoteExact()
  662. {
  663. return $this->container['quote_exact'];
  664. }
  665. /**
  666. * Sets quote_exact
  667. *
  668. * @param string|null $quote_exact 锚定的原文片段(只限批注)
  669. *
  670. * @return self
  671. */
  672. public function setQuoteExact($quote_exact)
  673. {
  674. if (is_null($quote_exact)) {
  675. throw new \InvalidArgumentException('non-nullable quote_exact cannot be null');
  676. }
  677. $this->container['quote_exact'] = $quote_exact;
  678. return $this;
  679. }
  680. /**
  681. * Gets quote_prefix
  682. *
  683. * @return string|null
  684. */
  685. public function getQuotePrefix()
  686. {
  687. return $this->container['quote_prefix'];
  688. }
  689. /**
  690. * Sets quote_prefix
  691. *
  692. * @param string|null $quote_prefix 锚定片段前的上下文,用于重新定位(只限批注)
  693. *
  694. * @return self
  695. */
  696. public function setQuotePrefix($quote_prefix)
  697. {
  698. if (is_null($quote_prefix)) {
  699. throw new \InvalidArgumentException('non-nullable quote_prefix cannot be null');
  700. }
  701. $this->container['quote_prefix'] = $quote_prefix;
  702. return $this;
  703. }
  704. /**
  705. * Gets quote_suffix
  706. *
  707. * @return string|null
  708. */
  709. public function getQuoteSuffix()
  710. {
  711. return $this->container['quote_suffix'];
  712. }
  713. /**
  714. * Sets quote_suffix
  715. *
  716. * @param string|null $quote_suffix 锚定片段后的上下文,用于重新定位(只限批注)
  717. *
  718. * @return self
  719. */
  720. public function setQuoteSuffix($quote_suffix)
  721. {
  722. if (is_null($quote_suffix)) {
  723. throw new \InvalidArgumentException('non-nullable quote_suffix cannot be null');
  724. }
  725. $this->container['quote_suffix'] = $quote_suffix;
  726. return $this;
  727. }
  728. /**
  729. * Gets tpl_id
  730. *
  731. * @return string|null
  732. */
  733. public function getTplId()
  734. {
  735. return $this->container['tpl_id'];
  736. }
  737. /**
  738. * Sets tpl_id
  739. *
  740. * @param string|null $tpl_id 话题模板(文章)的 uuid
  741. *
  742. * @return self
  743. */
  744. public function setTplId($tpl_id)
  745. {
  746. if (is_null($tpl_id)) {
  747. throw new \InvalidArgumentException('non-nullable tpl_id cannot be null');
  748. }
  749. $this->container['tpl_id'] = $tpl_id;
  750. return $this;
  751. }
  752. /**
  753. * Gets notify
  754. *
  755. * @return bool|null
  756. */
  757. public function getNotify()
  758. {
  759. return $this->container['notify'];
  760. }
  761. /**
  762. * Sets notify
  763. *
  764. * @param bool|null $notify 是否发通知(批注不发)
  765. *
  766. * @return self
  767. */
  768. public function setNotify($notify)
  769. {
  770. if (is_null($notify)) {
  771. throw new \InvalidArgumentException('non-nullable notify cannot be null');
  772. }
  773. $this->container['notify'] = $notify;
  774. return $this;
  775. }
  776. /**
  777. * Returns true if offset exists. False otherwise.
  778. *
  779. * @param integer|string $offset Offset
  780. *
  781. * @return boolean
  782. */
  783. public function offsetExists(mixed $offset): bool
  784. {
  785. return isset($this->container[$offset]);
  786. }
  787. /**
  788. * Gets offset.
  789. *
  790. * @param integer|string $offset Offset
  791. *
  792. * @return mixed|null
  793. */
  794. #[\ReturnTypeWillChange]
  795. public function offsetGet(mixed $offset)
  796. {
  797. return $this->container[$offset] ?? null;
  798. }
  799. /**
  800. * Sets value based on offset.
  801. *
  802. * @param int|null $offset Offset
  803. * @param mixed $value Value to be set
  804. *
  805. * @return void
  806. */
  807. public function offsetSet($offset, $value): void
  808. {
  809. if (is_null($offset)) {
  810. $this->container[] = $value;
  811. } else {
  812. $this->container[$offset] = $value;
  813. }
  814. }
  815. /**
  816. * Unsets offset.
  817. *
  818. * @param integer|string $offset Offset
  819. *
  820. * @return void
  821. */
  822. public function offsetUnset(mixed $offset): void
  823. {
  824. unset($this->container[$offset]);
  825. }
  826. /**
  827. * Serializes the object to a value that can be serialized natively by json_encode().
  828. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  829. *
  830. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  831. * of any type other than a resource.
  832. */
  833. #[\ReturnTypeWillChange]
  834. public function jsonSerialize()
  835. {
  836. return ObjectSerializer::sanitizeForSerialization($this);
  837. }
  838. /**
  839. * Gets the string presentation of the object
  840. *
  841. * @return string
  842. */
  843. public function __toString()
  844. {
  845. return json_encode(
  846. ObjectSerializer::sanitizeForSerialization($this),
  847. JSON_PRETTY_PRINT
  848. );
  849. }
  850. /**
  851. * Gets a header-safe presentation of the object
  852. *
  853. * @return string
  854. */
  855. public function toHeaderValue()
  856. {
  857. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  858. }
  859. }