2
0

PostApiV3DiscussionsRequest.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947
  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.21
  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_GLOSSARY = 'glossary';
  288. public const TYPE_NOTE = 'note';
  289. public const TYPE_COMMENTARY = 'commentary';
  290. public const SEVERITY_ERROR = 'error';
  291. public const SEVERITY_WARNING = 'warning';
  292. public const SEVERITY_SUGGESTION = 'suggestion';
  293. public const SEVERITY_URGENT = 'urgent';
  294. public const SEVERITY_NORMAL = 'normal';
  295. /**
  296. * Gets allowable values of the enum
  297. *
  298. * @return string[]
  299. */
  300. public function getTargetTypeAllowableValues()
  301. {
  302. return [
  303. self::TARGET_TYPE_SENTENCE,
  304. self::TARGET_TYPE_WBW,
  305. self::TARGET_TYPE_ARTICLE,
  306. self::TARGET_TYPE_TERM,
  307. self::TARGET_TYPE_TASK,
  308. ];
  309. }
  310. /**
  311. * Gets allowable values of the enum
  312. *
  313. * @return string[]
  314. */
  315. public function getTypeAllowableValues()
  316. {
  317. return [
  318. self::TYPE_DISCUSSION,
  319. self::TYPE_QA,
  320. self::TYPE_HELP,
  321. self::TYPE_ISSUE,
  322. self::TYPE_GLOSSARY,
  323. self::TYPE_NOTE,
  324. self::TYPE_COMMENTARY,
  325. ];
  326. }
  327. /**
  328. * Gets allowable values of the enum
  329. *
  330. * @return string[]
  331. */
  332. public function getSeverityAllowableValues()
  333. {
  334. return [
  335. self::SEVERITY_ERROR,
  336. self::SEVERITY_WARNING,
  337. self::SEVERITY_SUGGESTION,
  338. self::SEVERITY_URGENT,
  339. self::SEVERITY_NORMAL,
  340. ];
  341. }
  342. /**
  343. * Associative array for storing property values
  344. *
  345. * @var mixed[]
  346. */
  347. protected $container = [];
  348. /**
  349. * Constructor
  350. *
  351. * @param mixed[]|null $data Associated array of property values
  352. * initializing the model
  353. */
  354. public function __construct(?array $data = null)
  355. {
  356. $this->setIfExists('target_type', $data ?? [], null);
  357. $this->setIfExists('target_id', $data ?? [], null);
  358. $this->setIfExists('type', $data ?? [], 'discussion');
  359. $this->setIfExists('title', $data ?? [], null);
  360. $this->setIfExists('content', $data ?? [], null);
  361. $this->setIfExists('severity', $data ?? [], null);
  362. $this->setIfExists('pos_start', $data ?? [], null);
  363. $this->setIfExists('pos_end', $data ?? [], null);
  364. $this->setIfExists('quote_exact', $data ?? [], null);
  365. $this->setIfExists('quote_prefix', $data ?? [], null);
  366. $this->setIfExists('quote_suffix', $data ?? [], null);
  367. $this->setIfExists('tpl_id', $data ?? [], null);
  368. $this->setIfExists('notify', $data ?? [], true);
  369. }
  370. /**
  371. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  372. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  373. * $this->openAPINullablesSetToNull array
  374. *
  375. * @param string $variableName
  376. * @param array $fields
  377. * @param mixed $defaultValue
  378. */
  379. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  380. {
  381. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  382. $this->openAPINullablesSetToNull[] = $variableName;
  383. }
  384. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  385. }
  386. /**
  387. * Show all the invalid properties with reasons.
  388. *
  389. * @return array invalid properties with reasons
  390. */
  391. public function listInvalidProperties()
  392. {
  393. $invalidProperties = [];
  394. if ($this->container['target_type'] === null) {
  395. $invalidProperties[] = "'target_type' can't be null";
  396. }
  397. $allowedValues = $this->getTargetTypeAllowableValues();
  398. if (!is_null($this->container['target_type']) && !in_array($this->container['target_type'], $allowedValues, true)) {
  399. $invalidProperties[] = sprintf(
  400. "invalid value '%s' for 'target_type', must be one of '%s'",
  401. $this->container['target_type'],
  402. implode("', '", $allowedValues)
  403. );
  404. }
  405. if ($this->container['target_id'] === null) {
  406. $invalidProperties[] = "'target_id' can't be null";
  407. }
  408. $allowedValues = $this->getTypeAllowableValues();
  409. if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
  410. $invalidProperties[] = sprintf(
  411. "invalid value '%s' for 'type', must be one of '%s'",
  412. $this->container['type'],
  413. implode("', '", $allowedValues)
  414. );
  415. }
  416. $allowedValues = $this->getSeverityAllowableValues();
  417. if (!is_null($this->container['severity']) && !in_array($this->container['severity'], $allowedValues, true)) {
  418. $invalidProperties[] = sprintf(
  419. "invalid value '%s' for 'severity', must be one of '%s'",
  420. $this->container['severity'],
  421. implode("', '", $allowedValues)
  422. );
  423. }
  424. return $invalidProperties;
  425. }
  426. /**
  427. * Validate all the properties in the model
  428. * return true if all passed
  429. *
  430. * @return bool True if all properties are valid
  431. */
  432. public function valid()
  433. {
  434. return count($this->listInvalidProperties()) === 0;
  435. }
  436. /**
  437. * Gets target_type
  438. *
  439. * @return string
  440. */
  441. public function getTargetType()
  442. {
  443. return $this->container['target_type'];
  444. }
  445. /**
  446. * Sets target_type
  447. *
  448. * @param string $target_type 挂靠对象的类型
  449. *
  450. * @return self
  451. */
  452. public function setTargetType($target_type)
  453. {
  454. if (is_null($target_type)) {
  455. throw new \InvalidArgumentException('non-nullable target_type cannot be null');
  456. }
  457. $allowedValues = $this->getTargetTypeAllowableValues();
  458. if (!in_array($target_type, $allowedValues, true)) {
  459. throw new \InvalidArgumentException(
  460. sprintf(
  461. "Invalid value '%s' for 'target_type', must be one of '%s'",
  462. $target_type,
  463. implode("', '", $allowedValues)
  464. )
  465. );
  466. }
  467. $this->container['target_type'] = $target_type;
  468. return $this;
  469. }
  470. /**
  471. * Gets target_id
  472. *
  473. * @return string
  474. */
  475. public function getTargetId()
  476. {
  477. return $this->container['target_id'];
  478. }
  479. /**
  480. * Sets target_id
  481. *
  482. * @param string $target_id 挂靠对象的 uuid
  483. *
  484. * @return self
  485. */
  486. public function setTargetId($target_id)
  487. {
  488. if (is_null($target_id)) {
  489. throw new \InvalidArgumentException('non-nullable target_id cannot be null');
  490. }
  491. $this->container['target_id'] = $target_id;
  492. return $this;
  493. }
  494. /**
  495. * Gets type
  496. *
  497. * @return string|null
  498. */
  499. public function getType()
  500. {
  501. return $this->container['type'];
  502. }
  503. /**
  504. * Sets type
  505. *
  506. * @param string|null $type 类型
  507. *
  508. * @return self
  509. */
  510. public function setType($type)
  511. {
  512. if (is_null($type)) {
  513. throw new \InvalidArgumentException('non-nullable type cannot be null');
  514. }
  515. $allowedValues = $this->getTypeAllowableValues();
  516. if (!in_array($type, $allowedValues, true)) {
  517. throw new \InvalidArgumentException(
  518. sprintf(
  519. "Invalid value '%s' for 'type', must be one of '%s'",
  520. $type,
  521. implode("', '", $allowedValues)
  522. )
  523. );
  524. }
  525. $this->container['type'] = $type;
  526. return $this;
  527. }
  528. /**
  529. * Gets title
  530. *
  531. * @return string|null
  532. */
  533. public function getTitle()
  534. {
  535. return $this->container['title'];
  536. }
  537. /**
  538. * Sets title
  539. *
  540. * @param string|null $title 标题,最长 256 字符;评论线程必填(glossary 填术语词头),批注可省
  541. *
  542. * @return self
  543. */
  544. public function setTitle($title)
  545. {
  546. if (is_null($title)) {
  547. throw new \InvalidArgumentException('non-nullable title cannot be null');
  548. }
  549. $this->container['title'] = $title;
  550. return $this;
  551. }
  552. /**
  553. * Gets content
  554. *
  555. * @return string|null
  556. */
  557. public function getContent()
  558. {
  559. return $this->container['content'];
  560. }
  561. /**
  562. * Sets content
  563. *
  564. * @param string|null $content 正文(markdown);批注必填
  565. *
  566. * @return self
  567. */
  568. public function setContent($content)
  569. {
  570. if (is_null($content)) {
  571. throw new \InvalidArgumentException('non-nullable content cannot be null');
  572. }
  573. $this->container['content'] = $content;
  574. return $this;
  575. }
  576. /**
  577. * Gets severity
  578. *
  579. * @return string|null
  580. */
  581. public function getSeverity()
  582. {
  583. return $this->container['severity'];
  584. }
  585. /**
  586. * Sets severity
  587. *
  588. * @param string|null $severity 严重程度
  589. *
  590. * @return self
  591. */
  592. public function setSeverity($severity)
  593. {
  594. if (is_null($severity)) {
  595. throw new \InvalidArgumentException('non-nullable severity cannot be null');
  596. }
  597. $allowedValues = $this->getSeverityAllowableValues();
  598. if (!in_array($severity, $allowedValues, true)) {
  599. throw new \InvalidArgumentException(
  600. sprintf(
  601. "Invalid value '%s' for 'severity', must be one of '%s'",
  602. $severity,
  603. implode("', '", $allowedValues)
  604. )
  605. );
  606. }
  607. $this->container['severity'] = $severity;
  608. return $this;
  609. }
  610. /**
  611. * Gets pos_start
  612. *
  613. * @return int|null
  614. */
  615. public function getPosStart()
  616. {
  617. return $this->container['pos_start'];
  618. }
  619. /**
  620. * Sets pos_start
  621. *
  622. * @param int|null $pos_start 锚点在句子文本中的起始偏移(只限 note / commentary / issue / glossary)
  623. *
  624. * @return self
  625. */
  626. public function setPosStart($pos_start)
  627. {
  628. if (is_null($pos_start)) {
  629. throw new \InvalidArgumentException('non-nullable pos_start cannot be null');
  630. }
  631. $this->container['pos_start'] = $pos_start;
  632. return $this;
  633. }
  634. /**
  635. * Gets pos_end
  636. *
  637. * @return int|null
  638. */
  639. public function getPosEnd()
  640. {
  641. return $this->container['pos_end'];
  642. }
  643. /**
  644. * Sets pos_end
  645. *
  646. * @param int|null $pos_end 锚点的结束偏移,批注插在这里(只限 note / commentary / issue / glossary)
  647. *
  648. * @return self
  649. */
  650. public function setPosEnd($pos_end)
  651. {
  652. if (is_null($pos_end)) {
  653. throw new \InvalidArgumentException('non-nullable pos_end cannot be null');
  654. }
  655. $this->container['pos_end'] = $pos_end;
  656. return $this;
  657. }
  658. /**
  659. * Gets quote_exact
  660. *
  661. * @return string|null
  662. */
  663. public function getQuoteExact()
  664. {
  665. return $this->container['quote_exact'];
  666. }
  667. /**
  668. * Sets quote_exact
  669. *
  670. * @param string|null $quote_exact 锚定的原文片段(只限 note / commentary / issue / glossary)
  671. *
  672. * @return self
  673. */
  674. public function setQuoteExact($quote_exact)
  675. {
  676. if (is_null($quote_exact)) {
  677. throw new \InvalidArgumentException('non-nullable quote_exact cannot be null');
  678. }
  679. $this->container['quote_exact'] = $quote_exact;
  680. return $this;
  681. }
  682. /**
  683. * Gets quote_prefix
  684. *
  685. * @return string|null
  686. */
  687. public function getQuotePrefix()
  688. {
  689. return $this->container['quote_prefix'];
  690. }
  691. /**
  692. * Sets quote_prefix
  693. *
  694. * @param string|null $quote_prefix 锚定片段前的上下文,用于重新定位(只限 note / commentary / issue / glossary)
  695. *
  696. * @return self
  697. */
  698. public function setQuotePrefix($quote_prefix)
  699. {
  700. if (is_null($quote_prefix)) {
  701. throw new \InvalidArgumentException('non-nullable quote_prefix cannot be null');
  702. }
  703. $this->container['quote_prefix'] = $quote_prefix;
  704. return $this;
  705. }
  706. /**
  707. * Gets quote_suffix
  708. *
  709. * @return string|null
  710. */
  711. public function getQuoteSuffix()
  712. {
  713. return $this->container['quote_suffix'];
  714. }
  715. /**
  716. * Sets quote_suffix
  717. *
  718. * @param string|null $quote_suffix 锚定片段后的上下文,用于重新定位(只限 note / commentary / issue / glossary)
  719. *
  720. * @return self
  721. */
  722. public function setQuoteSuffix($quote_suffix)
  723. {
  724. if (is_null($quote_suffix)) {
  725. throw new \InvalidArgumentException('non-nullable quote_suffix cannot be null');
  726. }
  727. $this->container['quote_suffix'] = $quote_suffix;
  728. return $this;
  729. }
  730. /**
  731. * Gets tpl_id
  732. *
  733. * @return string|null
  734. */
  735. public function getTplId()
  736. {
  737. return $this->container['tpl_id'];
  738. }
  739. /**
  740. * Sets tpl_id
  741. *
  742. * @param string|null $tpl_id 话题模板(文章)的 uuid
  743. *
  744. * @return self
  745. */
  746. public function setTplId($tpl_id)
  747. {
  748. if (is_null($tpl_id)) {
  749. throw new \InvalidArgumentException('non-nullable tpl_id cannot be null');
  750. }
  751. $this->container['tpl_id'] = $tpl_id;
  752. return $this;
  753. }
  754. /**
  755. * Gets notify
  756. *
  757. * @return bool|null
  758. */
  759. public function getNotify()
  760. {
  761. return $this->container['notify'];
  762. }
  763. /**
  764. * Sets notify
  765. *
  766. * @param bool|null $notify 是否发通知(批注不发)
  767. *
  768. * @return self
  769. */
  770. public function setNotify($notify)
  771. {
  772. if (is_null($notify)) {
  773. throw new \InvalidArgumentException('non-nullable notify cannot be null');
  774. }
  775. $this->container['notify'] = $notify;
  776. return $this;
  777. }
  778. /**
  779. * Returns true if offset exists. False otherwise.
  780. *
  781. * @param integer|string $offset Offset
  782. *
  783. * @return boolean
  784. */
  785. public function offsetExists(mixed $offset): bool
  786. {
  787. return isset($this->container[$offset]);
  788. }
  789. /**
  790. * Gets offset.
  791. *
  792. * @param integer|string $offset Offset
  793. *
  794. * @return mixed|null
  795. */
  796. #[\ReturnTypeWillChange]
  797. public function offsetGet(mixed $offset)
  798. {
  799. return $this->container[$offset] ?? null;
  800. }
  801. /**
  802. * Sets value based on offset.
  803. *
  804. * @param int|null $offset Offset
  805. * @param mixed $value Value to be set
  806. *
  807. * @return void
  808. */
  809. public function offsetSet($offset, $value): void
  810. {
  811. if (is_null($offset)) {
  812. $this->container[] = $value;
  813. } else {
  814. $this->container[$offset] = $value;
  815. }
  816. }
  817. /**
  818. * Unsets offset.
  819. *
  820. * @param integer|string $offset Offset
  821. *
  822. * @return void
  823. */
  824. public function offsetUnset(mixed $offset): void
  825. {
  826. unset($this->container[$offset]);
  827. }
  828. /**
  829. * Serializes the object to a value that can be serialized natively by json_encode().
  830. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  831. *
  832. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  833. * of any type other than a resource.
  834. */
  835. #[\ReturnTypeWillChange]
  836. public function jsonSerialize()
  837. {
  838. return ObjectSerializer::sanitizeForSerialization($this);
  839. }
  840. /**
  841. * Gets the string presentation of the object
  842. *
  843. * @return string
  844. */
  845. public function __toString()
  846. {
  847. return json_encode(
  848. ObjectSerializer::sanitizeForSerialization($this),
  849. JSON_PRETTY_PRINT
  850. );
  851. }
  852. /**
  853. * Gets a header-safe presentation of the object
  854. *
  855. * @return string
  856. */
  857. public function toHeaderValue()
  858. {
  859. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  860. }
  861. }