PostApiV3AgentFeedbackRequest.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. <?php
  2. /**
  3. * PostApiV3AgentFeedbackRequest
  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: 1.0.0
  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. * PostApiV3AgentFeedbackRequest 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 PostApiV3AgentFeedbackRequest 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_agent_feedback_request';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'message_id' => 'string',
  54. 'thread_id' => 'string',
  55. 'rating' => 'int',
  56. 'tags' => 'string[]',
  57. 'comment' => 'string',
  58. 'asked' => 'bool',
  59. 'device_id' => 'string',
  60. 'client' => 'string'
  61. ];
  62. /**
  63. * Array of property to format mappings. Used for (de)serialization
  64. *
  65. * @var string[]
  66. * @phpstan-var array<string, string|null>
  67. * @psalm-var array<string, string|null>
  68. */
  69. protected static $openAPIFormats = [
  70. 'message_id' => null,
  71. 'thread_id' => null,
  72. 'rating' => null,
  73. 'tags' => null,
  74. 'comment' => null,
  75. 'asked' => null,
  76. 'device_id' => null,
  77. 'client' => null
  78. ];
  79. /**
  80. * Array of nullable properties. Used for (de)serialization
  81. *
  82. * @var boolean[]
  83. */
  84. protected static array $openAPINullables = [
  85. 'message_id' => false,
  86. 'thread_id' => false,
  87. 'rating' => false,
  88. 'tags' => false,
  89. 'comment' => false,
  90. 'asked' => false,
  91. 'device_id' => false,
  92. 'client' => false
  93. ];
  94. /**
  95. * If a nullable field gets set to null, insert it here
  96. *
  97. * @var boolean[]
  98. */
  99. protected array $openAPINullablesSetToNull = [];
  100. /**
  101. * Array of property to type mappings. Used for (de)serialization
  102. *
  103. * @return array
  104. */
  105. public static function openAPITypes()
  106. {
  107. return self::$openAPITypes;
  108. }
  109. /**
  110. * Array of property to format mappings. Used for (de)serialization
  111. *
  112. * @return array
  113. */
  114. public static function openAPIFormats()
  115. {
  116. return self::$openAPIFormats;
  117. }
  118. /**
  119. * Array of nullable properties
  120. *
  121. * @return array
  122. */
  123. protected static function openAPINullables(): array
  124. {
  125. return self::$openAPINullables;
  126. }
  127. /**
  128. * Array of nullable field names deliberately set to null
  129. *
  130. * @return boolean[]
  131. */
  132. private function getOpenAPINullablesSetToNull(): array
  133. {
  134. return $this->openAPINullablesSetToNull;
  135. }
  136. /**
  137. * Setter - Array of nullable field names deliberately set to null
  138. *
  139. * @param boolean[] $openAPINullablesSetToNull
  140. */
  141. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  142. {
  143. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  144. }
  145. /**
  146. * Checks if a property is nullable
  147. *
  148. * @param string $property
  149. * @return bool
  150. */
  151. public static function isNullable(string $property): bool
  152. {
  153. return self::openAPINullables()[$property] ?? false;
  154. }
  155. /**
  156. * Checks if a nullable property is set to null.
  157. *
  158. * @param string $property
  159. * @return bool
  160. */
  161. public function isNullableSetToNull(string $property): bool
  162. {
  163. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  164. }
  165. /**
  166. * Array of attributes where the key is the local name,
  167. * and the value is the original name
  168. *
  169. * @var string[]
  170. */
  171. protected static $attributeMap = [
  172. 'message_id' => 'message_id',
  173. 'thread_id' => 'thread_id',
  174. 'rating' => 'rating',
  175. 'tags' => 'tags',
  176. 'comment' => 'comment',
  177. 'asked' => 'asked',
  178. 'device_id' => 'device_id',
  179. 'client' => 'client'
  180. ];
  181. /**
  182. * Array of attributes to setter functions (for deserialization of responses)
  183. *
  184. * @var string[]
  185. */
  186. protected static $setters = [
  187. 'message_id' => 'setMessageId',
  188. 'thread_id' => 'setThreadId',
  189. 'rating' => 'setRating',
  190. 'tags' => 'setTags',
  191. 'comment' => 'setComment',
  192. 'asked' => 'setAsked',
  193. 'device_id' => 'setDeviceId',
  194. 'client' => 'setClient'
  195. ];
  196. /**
  197. * Array of attributes to getter functions (for serialization of requests)
  198. *
  199. * @var string[]
  200. */
  201. protected static $getters = [
  202. 'message_id' => 'getMessageId',
  203. 'thread_id' => 'getThreadId',
  204. 'rating' => 'getRating',
  205. 'tags' => 'getTags',
  206. 'comment' => 'getComment',
  207. 'asked' => 'getAsked',
  208. 'device_id' => 'getDeviceId',
  209. 'client' => 'getClient'
  210. ];
  211. /**
  212. * Array of attributes where the key is the local name,
  213. * and the value is the original name
  214. *
  215. * @return array
  216. */
  217. public static function attributeMap()
  218. {
  219. return self::$attributeMap;
  220. }
  221. /**
  222. * Array of attributes to setter functions (for deserialization of responses)
  223. *
  224. * @return array
  225. */
  226. public static function setters()
  227. {
  228. return self::$setters;
  229. }
  230. /**
  231. * Array of attributes to getter functions (for serialization of requests)
  232. *
  233. * @return array
  234. */
  235. public static function getters()
  236. {
  237. return self::$getters;
  238. }
  239. /**
  240. * The original name of the model.
  241. *
  242. * @return string
  243. */
  244. public function getModelName()
  245. {
  246. return self::$openAPIModelName;
  247. }
  248. public const CLIENT_MOBILE = 'mobile';
  249. public const CLIENT_WEB = 'web';
  250. /**
  251. * Gets allowable values of the enum
  252. *
  253. * @return string[]
  254. */
  255. public function getClientAllowableValues()
  256. {
  257. return [
  258. self::CLIENT_MOBILE,
  259. self::CLIENT_WEB,
  260. ];
  261. }
  262. /**
  263. * Associative array for storing property values
  264. *
  265. * @var mixed[]
  266. */
  267. protected $container = [];
  268. /**
  269. * Constructor
  270. *
  271. * @param mixed[]|null $data Associated array of property values
  272. * initializing the model
  273. */
  274. public function __construct(?array $data = null)
  275. {
  276. $this->setIfExists('message_id', $data ?? [], null);
  277. $this->setIfExists('thread_id', $data ?? [], null);
  278. $this->setIfExists('rating', $data ?? [], null);
  279. $this->setIfExists('tags', $data ?? [], null);
  280. $this->setIfExists('comment', $data ?? [], null);
  281. $this->setIfExists('asked', $data ?? [], null);
  282. $this->setIfExists('device_id', $data ?? [], null);
  283. $this->setIfExists('client', $data ?? [], null);
  284. }
  285. /**
  286. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  287. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  288. * $this->openAPINullablesSetToNull array
  289. *
  290. * @param string $variableName
  291. * @param array $fields
  292. * @param mixed $defaultValue
  293. */
  294. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  295. {
  296. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  297. $this->openAPINullablesSetToNull[] = $variableName;
  298. }
  299. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  300. }
  301. /**
  302. * Show all the invalid properties with reasons.
  303. *
  304. * @return array invalid properties with reasons
  305. */
  306. public function listInvalidProperties()
  307. {
  308. $invalidProperties = [];
  309. if ($this->container['message_id'] === null) {
  310. $invalidProperties[] = "'message_id' can't be null";
  311. }
  312. if ($this->container['rating'] === null) {
  313. $invalidProperties[] = "'rating' can't be null";
  314. }
  315. $allowedValues = $this->getClientAllowableValues();
  316. if (!is_null($this->container['client']) && !in_array($this->container['client'], $allowedValues, true)) {
  317. $invalidProperties[] = sprintf(
  318. "invalid value '%s' for 'client', must be one of '%s'",
  319. $this->container['client'],
  320. implode("', '", $allowedValues)
  321. );
  322. }
  323. return $invalidProperties;
  324. }
  325. /**
  326. * Validate all the properties in the model
  327. * return true if all passed
  328. *
  329. * @return bool True if all properties are valid
  330. */
  331. public function valid()
  332. {
  333. return count($this->listInvalidProperties()) === 0;
  334. }
  335. /**
  336. * Gets message_id
  337. *
  338. * @return string
  339. */
  340. public function getMessageId()
  341. {
  342. return $this->container['message_id'];
  343. }
  344. /**
  345. * Sets message_id
  346. *
  347. * @param string $message_id AG-UI 回答消息 id
  348. *
  349. * @return self
  350. */
  351. public function setMessageId($message_id)
  352. {
  353. if (is_null($message_id)) {
  354. throw new \InvalidArgumentException('non-nullable message_id cannot be null');
  355. }
  356. $this->container['message_id'] = $message_id;
  357. return $this;
  358. }
  359. /**
  360. * Gets thread_id
  361. *
  362. * @return string|null
  363. */
  364. public function getThreadId()
  365. {
  366. return $this->container['thread_id'];
  367. }
  368. /**
  369. * Sets thread_id
  370. *
  371. * @param string|null $thread_id 会话 id(uuid)
  372. *
  373. * @return self
  374. */
  375. public function setThreadId($thread_id)
  376. {
  377. if (is_null($thread_id)) {
  378. throw new \InvalidArgumentException('non-nullable thread_id cannot be null');
  379. }
  380. $this->container['thread_id'] = $thread_id;
  381. return $this;
  382. }
  383. /**
  384. * Gets rating
  385. *
  386. * @return int
  387. */
  388. public function getRating()
  389. {
  390. return $this->container['rating'];
  391. }
  392. /**
  393. * Sets rating
  394. *
  395. * @param int $rating 1 赞 / -1 踩(只能是这两个值)
  396. *
  397. * @return self
  398. */
  399. public function setRating($rating)
  400. {
  401. if (is_null($rating)) {
  402. throw new \InvalidArgumentException('non-nullable rating cannot be null');
  403. }
  404. $this->container['rating'] = $rating;
  405. return $this;
  406. }
  407. /**
  408. * Gets tags
  409. *
  410. * @return string[]|null
  411. */
  412. public function getTags()
  413. {
  414. return $this->container['tags'];
  415. }
  416. /**
  417. * Sets tags
  418. *
  419. * @param string[]|null $tags 点赞标签或点踩原因
  420. *
  421. * @return self
  422. */
  423. public function setTags($tags)
  424. {
  425. if (is_null($tags)) {
  426. throw new \InvalidArgumentException('non-nullable tags cannot be null');
  427. }
  428. $this->container['tags'] = $tags;
  429. return $this;
  430. }
  431. /**
  432. * Gets comment
  433. *
  434. * @return string|null
  435. */
  436. public function getComment()
  437. {
  438. return $this->container['comment'];
  439. }
  440. /**
  441. * Sets comment
  442. *
  443. * @param string|null $comment 选了 other 时的文字说明,最长 1000 字
  444. *
  445. * @return self
  446. */
  447. public function setComment($comment)
  448. {
  449. if (is_null($comment)) {
  450. throw new \InvalidArgumentException('non-nullable comment cannot be null');
  451. }
  452. $this->container['comment'] = $comment;
  453. return $this;
  454. }
  455. /**
  456. * Gets asked
  457. *
  458. * @return bool|null
  459. */
  460. public function getAsked()
  461. {
  462. return $this->container['asked'];
  463. }
  464. /**
  465. * Sets asked
  466. *
  467. * @param bool|null $asked 是否主动询问问出来的
  468. *
  469. * @return self
  470. */
  471. public function setAsked($asked)
  472. {
  473. if (is_null($asked)) {
  474. throw new \InvalidArgumentException('non-nullable asked cannot be null');
  475. }
  476. $this->container['asked'] = $asked;
  477. return $this;
  478. }
  479. /**
  480. * Gets device_id
  481. *
  482. * @return string|null
  483. */
  484. public function getDeviceId()
  485. {
  486. return $this->container['device_id'];
  487. }
  488. /**
  489. * Sets device_id
  490. *
  491. * @param string|null $device_id 设备匿名 id(uuid)。未登录时必填
  492. *
  493. * @return self
  494. */
  495. public function setDeviceId($device_id)
  496. {
  497. if (is_null($device_id)) {
  498. throw new \InvalidArgumentException('non-nullable device_id cannot be null');
  499. }
  500. $this->container['device_id'] = $device_id;
  501. return $this;
  502. }
  503. /**
  504. * Gets client
  505. *
  506. * @return string|null
  507. */
  508. public function getClient()
  509. {
  510. return $this->container['client'];
  511. }
  512. /**
  513. * Sets client
  514. *
  515. * @param string|null $client 客户端
  516. *
  517. * @return self
  518. */
  519. public function setClient($client)
  520. {
  521. if (is_null($client)) {
  522. throw new \InvalidArgumentException('non-nullable client cannot be null');
  523. }
  524. $allowedValues = $this->getClientAllowableValues();
  525. if (!in_array($client, $allowedValues, true)) {
  526. throw new \InvalidArgumentException(
  527. sprintf(
  528. "Invalid value '%s' for 'client', must be one of '%s'",
  529. $client,
  530. implode("', '", $allowedValues)
  531. )
  532. );
  533. }
  534. $this->container['client'] = $client;
  535. return $this;
  536. }
  537. /**
  538. * Returns true if offset exists. False otherwise.
  539. *
  540. * @param integer|string $offset Offset
  541. *
  542. * @return boolean
  543. */
  544. public function offsetExists(mixed $offset): bool
  545. {
  546. return isset($this->container[$offset]);
  547. }
  548. /**
  549. * Gets offset.
  550. *
  551. * @param integer|string $offset Offset
  552. *
  553. * @return mixed|null
  554. */
  555. #[\ReturnTypeWillChange]
  556. public function offsetGet(mixed $offset)
  557. {
  558. return $this->container[$offset] ?? null;
  559. }
  560. /**
  561. * Sets value based on offset.
  562. *
  563. * @param int|null $offset Offset
  564. * @param mixed $value Value to be set
  565. *
  566. * @return void
  567. */
  568. public function offsetSet($offset, $value): void
  569. {
  570. if (is_null($offset)) {
  571. $this->container[] = $value;
  572. } else {
  573. $this->container[$offset] = $value;
  574. }
  575. }
  576. /**
  577. * Unsets offset.
  578. *
  579. * @param integer|string $offset Offset
  580. *
  581. * @return void
  582. */
  583. public function offsetUnset(mixed $offset): void
  584. {
  585. unset($this->container[$offset]);
  586. }
  587. /**
  588. * Serializes the object to a value that can be serialized natively by json_encode().
  589. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  590. *
  591. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  592. * of any type other than a resource.
  593. */
  594. #[\ReturnTypeWillChange]
  595. public function jsonSerialize()
  596. {
  597. return ObjectSerializer::sanitizeForSerialization($this);
  598. }
  599. /**
  600. * Gets the string presentation of the object
  601. *
  602. * @return string
  603. */
  604. public function __toString()
  605. {
  606. return json_encode(
  607. ObjectSerializer::sanitizeForSerialization($this),
  608. JSON_PRETTY_PRINT
  609. );
  610. }
  611. /**
  612. * Gets a header-safe presentation of the object
  613. *
  614. * @return string
  615. */
  616. public function toHeaderValue()
  617. {
  618. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  619. }
  620. }