GetApiV3Me200ResponseData.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. <?php
  2. /**
  3. * GetApiV3Me200ResponseData
  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. * GetApiV3Me200ResponseData 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 GetApiV3Me200ResponseData 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 = 'get_api_v3_me_200_response_data';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'id' => 'string',
  54. 'nick_name' => 'string',
  55. 'user_name' => 'string',
  56. 'real_name' => 'string',
  57. 'sn' => 'int',
  58. 'avatar' => 'string',
  59. 'roles' => 'string[]',
  60. 'email' => '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. 'id' => null,
  71. 'nick_name' => null,
  72. 'user_name' => null,
  73. 'real_name' => null,
  74. 'sn' => null,
  75. 'avatar' => null,
  76. 'roles' => null,
  77. 'email' => null
  78. ];
  79. /**
  80. * Array of nullable properties. Used for (de)serialization
  81. *
  82. * @var boolean[]
  83. */
  84. protected static array $openAPINullables = [
  85. 'id' => false,
  86. 'nick_name' => false,
  87. 'user_name' => false,
  88. 'real_name' => false,
  89. 'sn' => false,
  90. 'avatar' => true,
  91. 'roles' => false,
  92. 'email' => 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. 'id' => 'id',
  173. 'nick_name' => 'nickName',
  174. 'user_name' => 'userName',
  175. 'real_name' => 'realName',
  176. 'sn' => 'sn',
  177. 'avatar' => 'avatar',
  178. 'roles' => 'roles',
  179. 'email' => 'email'
  180. ];
  181. /**
  182. * Array of attributes to setter functions (for deserialization of responses)
  183. *
  184. * @var string[]
  185. */
  186. protected static $setters = [
  187. 'id' => 'setId',
  188. 'nick_name' => 'setNickName',
  189. 'user_name' => 'setUserName',
  190. 'real_name' => 'setRealName',
  191. 'sn' => 'setSn',
  192. 'avatar' => 'setAvatar',
  193. 'roles' => 'setRoles',
  194. 'email' => 'setEmail'
  195. ];
  196. /**
  197. * Array of attributes to getter functions (for serialization of requests)
  198. *
  199. * @var string[]
  200. */
  201. protected static $getters = [
  202. 'id' => 'getId',
  203. 'nick_name' => 'getNickName',
  204. 'user_name' => 'getUserName',
  205. 'real_name' => 'getRealName',
  206. 'sn' => 'getSn',
  207. 'avatar' => 'getAvatar',
  208. 'roles' => 'getRoles',
  209. 'email' => 'getEmail'
  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. /**
  249. * Associative array for storing property values
  250. *
  251. * @var mixed[]
  252. */
  253. protected $container = [];
  254. /**
  255. * Constructor
  256. *
  257. * @param mixed[]|null $data Associated array of property values
  258. * initializing the model
  259. */
  260. public function __construct(?array $data = null)
  261. {
  262. $this->setIfExists('id', $data ?? [], null);
  263. $this->setIfExists('nick_name', $data ?? [], null);
  264. $this->setIfExists('user_name', $data ?? [], null);
  265. $this->setIfExists('real_name', $data ?? [], null);
  266. $this->setIfExists('sn', $data ?? [], null);
  267. $this->setIfExists('avatar', $data ?? [], null);
  268. $this->setIfExists('roles', $data ?? [], null);
  269. $this->setIfExists('email', $data ?? [], null);
  270. }
  271. /**
  272. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  273. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  274. * $this->openAPINullablesSetToNull array
  275. *
  276. * @param string $variableName
  277. * @param array $fields
  278. * @param mixed $defaultValue
  279. */
  280. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  281. {
  282. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  283. $this->openAPINullablesSetToNull[] = $variableName;
  284. }
  285. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  286. }
  287. /**
  288. * Show all the invalid properties with reasons.
  289. *
  290. * @return array invalid properties with reasons
  291. */
  292. public function listInvalidProperties()
  293. {
  294. $invalidProperties = [];
  295. return $invalidProperties;
  296. }
  297. /**
  298. * Validate all the properties in the model
  299. * return true if all passed
  300. *
  301. * @return bool True if all properties are valid
  302. */
  303. public function valid()
  304. {
  305. return count($this->listInvalidProperties()) === 0;
  306. }
  307. /**
  308. * Gets id
  309. *
  310. * @return string|null
  311. */
  312. public function getId()
  313. {
  314. return $this->container['id'];
  315. }
  316. /**
  317. * Sets id
  318. *
  319. * @param string|null $id id
  320. *
  321. * @return self
  322. */
  323. public function setId($id)
  324. {
  325. if (is_null($id)) {
  326. throw new \InvalidArgumentException('non-nullable id cannot be null');
  327. }
  328. $this->container['id'] = $id;
  329. return $this;
  330. }
  331. /**
  332. * Gets nick_name
  333. *
  334. * @return string|null
  335. */
  336. public function getNickName()
  337. {
  338. return $this->container['nick_name'];
  339. }
  340. /**
  341. * Sets nick_name
  342. *
  343. * @param string|null $nick_name nick_name
  344. *
  345. * @return self
  346. */
  347. public function setNickName($nick_name)
  348. {
  349. if (is_null($nick_name)) {
  350. throw new \InvalidArgumentException('non-nullable nick_name cannot be null');
  351. }
  352. $this->container['nick_name'] = $nick_name;
  353. return $this;
  354. }
  355. /**
  356. * Gets user_name
  357. *
  358. * @return string|null
  359. */
  360. public function getUserName()
  361. {
  362. return $this->container['user_name'];
  363. }
  364. /**
  365. * Sets user_name
  366. *
  367. * @param string|null $user_name user_name
  368. *
  369. * @return self
  370. */
  371. public function setUserName($user_name)
  372. {
  373. if (is_null($user_name)) {
  374. throw new \InvalidArgumentException('non-nullable user_name cannot be null');
  375. }
  376. $this->container['user_name'] = $user_name;
  377. return $this;
  378. }
  379. /**
  380. * Gets real_name
  381. *
  382. * @return string|null
  383. */
  384. public function getRealName()
  385. {
  386. return $this->container['real_name'];
  387. }
  388. /**
  389. * Sets real_name
  390. *
  391. * @param string|null $real_name real_name
  392. *
  393. * @return self
  394. */
  395. public function setRealName($real_name)
  396. {
  397. if (is_null($real_name)) {
  398. throw new \InvalidArgumentException('non-nullable real_name cannot be null');
  399. }
  400. $this->container['real_name'] = $real_name;
  401. return $this;
  402. }
  403. /**
  404. * Gets sn
  405. *
  406. * @return int|null
  407. */
  408. public function getSn()
  409. {
  410. return $this->container['sn'];
  411. }
  412. /**
  413. * Sets sn
  414. *
  415. * @param int|null $sn sn
  416. *
  417. * @return self
  418. */
  419. public function setSn($sn)
  420. {
  421. if (is_null($sn)) {
  422. throw new \InvalidArgumentException('non-nullable sn cannot be null');
  423. }
  424. $this->container['sn'] = $sn;
  425. return $this;
  426. }
  427. /**
  428. * Gets avatar
  429. *
  430. * @return string|null
  431. */
  432. public function getAvatar()
  433. {
  434. return $this->container['avatar'];
  435. }
  436. /**
  437. * Sets avatar
  438. *
  439. * @param string|null $avatar avatar
  440. *
  441. * @return self
  442. */
  443. public function setAvatar($avatar)
  444. {
  445. if (is_null($avatar)) {
  446. array_push($this->openAPINullablesSetToNull, 'avatar');
  447. } else {
  448. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  449. $index = array_search('avatar', $nullablesSetToNull);
  450. if ($index !== FALSE) {
  451. unset($nullablesSetToNull[$index]);
  452. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  453. }
  454. }
  455. $this->container['avatar'] = $avatar;
  456. return $this;
  457. }
  458. /**
  459. * Gets roles
  460. *
  461. * @return string[]|null
  462. */
  463. public function getRoles()
  464. {
  465. return $this->container['roles'];
  466. }
  467. /**
  468. * Sets roles
  469. *
  470. * @param string[]|null $roles roles
  471. *
  472. * @return self
  473. */
  474. public function setRoles($roles)
  475. {
  476. if (is_null($roles)) {
  477. throw new \InvalidArgumentException('non-nullable roles cannot be null');
  478. }
  479. $this->container['roles'] = $roles;
  480. return $this;
  481. }
  482. /**
  483. * Gets email
  484. *
  485. * @return string|null
  486. */
  487. public function getEmail()
  488. {
  489. return $this->container['email'];
  490. }
  491. /**
  492. * Sets email
  493. *
  494. * @param string|null $email email
  495. *
  496. * @return self
  497. */
  498. public function setEmail($email)
  499. {
  500. if (is_null($email)) {
  501. throw new \InvalidArgumentException('non-nullable email cannot be null');
  502. }
  503. $this->container['email'] = $email;
  504. return $this;
  505. }
  506. /**
  507. * Returns true if offset exists. False otherwise.
  508. *
  509. * @param integer|string $offset Offset
  510. *
  511. * @return boolean
  512. */
  513. public function offsetExists(mixed $offset): bool
  514. {
  515. return isset($this->container[$offset]);
  516. }
  517. /**
  518. * Gets offset.
  519. *
  520. * @param integer|string $offset Offset
  521. *
  522. * @return mixed|null
  523. */
  524. #[\ReturnTypeWillChange]
  525. public function offsetGet(mixed $offset)
  526. {
  527. return $this->container[$offset] ?? null;
  528. }
  529. /**
  530. * Sets value based on offset.
  531. *
  532. * @param int|null $offset Offset
  533. * @param mixed $value Value to be set
  534. *
  535. * @return void
  536. */
  537. public function offsetSet($offset, $value): void
  538. {
  539. if (is_null($offset)) {
  540. $this->container[] = $value;
  541. } else {
  542. $this->container[$offset] = $value;
  543. }
  544. }
  545. /**
  546. * Unsets offset.
  547. *
  548. * @param integer|string $offset Offset
  549. *
  550. * @return void
  551. */
  552. public function offsetUnset(mixed $offset): void
  553. {
  554. unset($this->container[$offset]);
  555. }
  556. /**
  557. * Serializes the object to a value that can be serialized natively by json_encode().
  558. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  559. *
  560. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  561. * of any type other than a resource.
  562. */
  563. #[\ReturnTypeWillChange]
  564. public function jsonSerialize()
  565. {
  566. return ObjectSerializer::sanitizeForSerialization($this);
  567. }
  568. /**
  569. * Gets the string presentation of the object
  570. *
  571. * @return string
  572. */
  573. public function __toString()
  574. {
  575. return json_encode(
  576. ObjectSerializer::sanitizeForSerialization($this),
  577. JSON_PRETTY_PRINT
  578. );
  579. }
  580. /**
  581. * Gets a header-safe presentation of the object
  582. *
  583. * @return string
  584. */
  585. public function toHeaderValue()
  586. {
  587. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  588. }
  589. }