PostApiV3UsersRequest.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. <?php
  2. /**
  3. * PostApiV3UsersRequest
  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. * PostApiV3UsersRequest 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 PostApiV3UsersRequest 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_users_request';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'invite' => 'string',
  54. 'username' => 'string',
  55. 'nickname' => 'string',
  56. 'password' => 'string',
  57. 'password_confirmation' => 'string',
  58. 'lang' => 'string'
  59. ];
  60. /**
  61. * Array of property to format mappings. Used for (de)serialization
  62. *
  63. * @var string[]
  64. * @phpstan-var array<string, string|null>
  65. * @psalm-var array<string, string|null>
  66. */
  67. protected static $openAPIFormats = [
  68. 'invite' => null,
  69. 'username' => null,
  70. 'nickname' => null,
  71. 'password' => null,
  72. 'password_confirmation' => null,
  73. 'lang' => null
  74. ];
  75. /**
  76. * Array of nullable properties. Used for (de)serialization
  77. *
  78. * @var boolean[]
  79. */
  80. protected static array $openAPINullables = [
  81. 'invite' => false,
  82. 'username' => false,
  83. 'nickname' => false,
  84. 'password' => false,
  85. 'password_confirmation' => false,
  86. 'lang' => false
  87. ];
  88. /**
  89. * If a nullable field gets set to null, insert it here
  90. *
  91. * @var boolean[]
  92. */
  93. protected array $openAPINullablesSetToNull = [];
  94. /**
  95. * Array of property to type mappings. Used for (de)serialization
  96. *
  97. * @return array
  98. */
  99. public static function openAPITypes()
  100. {
  101. return self::$openAPITypes;
  102. }
  103. /**
  104. * Array of property to format mappings. Used for (de)serialization
  105. *
  106. * @return array
  107. */
  108. public static function openAPIFormats()
  109. {
  110. return self::$openAPIFormats;
  111. }
  112. /**
  113. * Array of nullable properties
  114. *
  115. * @return array
  116. */
  117. protected static function openAPINullables(): array
  118. {
  119. return self::$openAPINullables;
  120. }
  121. /**
  122. * Array of nullable field names deliberately set to null
  123. *
  124. * @return boolean[]
  125. */
  126. private function getOpenAPINullablesSetToNull(): array
  127. {
  128. return $this->openAPINullablesSetToNull;
  129. }
  130. /**
  131. * Setter - Array of nullable field names deliberately set to null
  132. *
  133. * @param boolean[] $openAPINullablesSetToNull
  134. */
  135. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  136. {
  137. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  138. }
  139. /**
  140. * Checks if a property is nullable
  141. *
  142. * @param string $property
  143. * @return bool
  144. */
  145. public static function isNullable(string $property): bool
  146. {
  147. return self::openAPINullables()[$property] ?? false;
  148. }
  149. /**
  150. * Checks if a nullable property is set to null.
  151. *
  152. * @param string $property
  153. * @return bool
  154. */
  155. public function isNullableSetToNull(string $property): bool
  156. {
  157. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  158. }
  159. /**
  160. * Array of attributes where the key is the local name,
  161. * and the value is the original name
  162. *
  163. * @var string[]
  164. */
  165. protected static $attributeMap = [
  166. 'invite' => 'invite',
  167. 'username' => 'username',
  168. 'nickname' => 'nickname',
  169. 'password' => 'password',
  170. 'password_confirmation' => 'password_confirmation',
  171. 'lang' => 'lang'
  172. ];
  173. /**
  174. * Array of attributes to setter functions (for deserialization of responses)
  175. *
  176. * @var string[]
  177. */
  178. protected static $setters = [
  179. 'invite' => 'setInvite',
  180. 'username' => 'setUsername',
  181. 'nickname' => 'setNickname',
  182. 'password' => 'setPassword',
  183. 'password_confirmation' => 'setPasswordConfirmation',
  184. 'lang' => 'setLang'
  185. ];
  186. /**
  187. * Array of attributes to getter functions (for serialization of requests)
  188. *
  189. * @var string[]
  190. */
  191. protected static $getters = [
  192. 'invite' => 'getInvite',
  193. 'username' => 'getUsername',
  194. 'nickname' => 'getNickname',
  195. 'password' => 'getPassword',
  196. 'password_confirmation' => 'getPasswordConfirmation',
  197. 'lang' => 'getLang'
  198. ];
  199. /**
  200. * Array of attributes where the key is the local name,
  201. * and the value is the original name
  202. *
  203. * @return array
  204. */
  205. public static function attributeMap()
  206. {
  207. return self::$attributeMap;
  208. }
  209. /**
  210. * Array of attributes to setter functions (for deserialization of responses)
  211. *
  212. * @return array
  213. */
  214. public static function setters()
  215. {
  216. return self::$setters;
  217. }
  218. /**
  219. * Array of attributes to getter functions (for serialization of requests)
  220. *
  221. * @return array
  222. */
  223. public static function getters()
  224. {
  225. return self::$getters;
  226. }
  227. /**
  228. * The original name of the model.
  229. *
  230. * @return string
  231. */
  232. public function getModelName()
  233. {
  234. return self::$openAPIModelName;
  235. }
  236. /**
  237. * Associative array for storing property values
  238. *
  239. * @var mixed[]
  240. */
  241. protected $container = [];
  242. /**
  243. * Constructor
  244. *
  245. * @param mixed[]|null $data Associated array of property values
  246. * initializing the model
  247. */
  248. public function __construct(?array $data = null)
  249. {
  250. $this->setIfExists('invite', $data ?? [], null);
  251. $this->setIfExists('username', $data ?? [], null);
  252. $this->setIfExists('nickname', $data ?? [], null);
  253. $this->setIfExists('password', $data ?? [], null);
  254. $this->setIfExists('password_confirmation', $data ?? [], null);
  255. $this->setIfExists('lang', $data ?? [], null);
  256. }
  257. /**
  258. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  259. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  260. * $this->openAPINullablesSetToNull array
  261. *
  262. * @param string $variableName
  263. * @param array $fields
  264. * @param mixed $defaultValue
  265. */
  266. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  267. {
  268. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  269. $this->openAPINullablesSetToNull[] = $variableName;
  270. }
  271. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  272. }
  273. /**
  274. * Show all the invalid properties with reasons.
  275. *
  276. * @return array invalid properties with reasons
  277. */
  278. public function listInvalidProperties()
  279. {
  280. $invalidProperties = [];
  281. if ($this->container['invite'] === null) {
  282. $invalidProperties[] = "'invite' can't be null";
  283. }
  284. if ($this->container['username'] === null) {
  285. $invalidProperties[] = "'username' can't be null";
  286. }
  287. if ($this->container['password'] === null) {
  288. $invalidProperties[] = "'password' can't be null";
  289. }
  290. if ($this->container['password_confirmation'] === null) {
  291. $invalidProperties[] = "'password_confirmation' can't be null";
  292. }
  293. if ($this->container['lang'] === null) {
  294. $invalidProperties[] = "'lang' can't be null";
  295. }
  296. return $invalidProperties;
  297. }
  298. /**
  299. * Validate all the properties in the model
  300. * return true if all passed
  301. *
  302. * @return bool True if all properties are valid
  303. */
  304. public function valid()
  305. {
  306. return count($this->listInvalidProperties()) === 0;
  307. }
  308. /**
  309. * Gets invite
  310. *
  311. * @return string
  312. */
  313. public function getInvite()
  314. {
  315. return $this->container['invite'];
  316. }
  317. /**
  318. * Sets invite
  319. *
  320. * @param string $invite 注册邀请的 uuid
  321. *
  322. * @return self
  323. */
  324. public function setInvite($invite)
  325. {
  326. if (is_null($invite)) {
  327. throw new \InvalidArgumentException('non-nullable invite cannot be null');
  328. }
  329. $this->container['invite'] = $invite;
  330. return $this;
  331. }
  332. /**
  333. * Gets username
  334. *
  335. * @return string
  336. */
  337. public function getUsername()
  338. {
  339. return $this->container['username'];
  340. }
  341. /**
  342. * Sets username
  343. *
  344. * @param string $username 用户名,6–32 位字母、数字、下划线
  345. *
  346. * @return self
  347. */
  348. public function setUsername($username)
  349. {
  350. if (is_null($username)) {
  351. throw new \InvalidArgumentException('non-nullable username cannot be null');
  352. }
  353. $this->container['username'] = $username;
  354. return $this;
  355. }
  356. /**
  357. * Gets nickname
  358. *
  359. * @return string|null
  360. */
  361. public function getNickname()
  362. {
  363. return $this->container['nickname'];
  364. }
  365. /**
  366. * Sets nickname
  367. *
  368. * @param string|null $nickname 昵称,不传或空白时用 username
  369. *
  370. * @return self
  371. */
  372. public function setNickname($nickname)
  373. {
  374. if (is_null($nickname)) {
  375. throw new \InvalidArgumentException('non-nullable nickname cannot be null');
  376. }
  377. $this->container['nickname'] = $nickname;
  378. return $this;
  379. }
  380. /**
  381. * Gets password
  382. *
  383. * @return string
  384. */
  385. public function getPassword()
  386. {
  387. return $this->container['password'];
  388. }
  389. /**
  390. * Sets password
  391. *
  392. * @param string $password 密码,6–32 位
  393. *
  394. * @return self
  395. */
  396. public function setPassword($password)
  397. {
  398. if (is_null($password)) {
  399. throw new \InvalidArgumentException('non-nullable password cannot be null');
  400. }
  401. $this->container['password'] = $password;
  402. return $this;
  403. }
  404. /**
  405. * Gets password_confirmation
  406. *
  407. * @return string
  408. */
  409. public function getPasswordConfirmation()
  410. {
  411. return $this->container['password_confirmation'];
  412. }
  413. /**
  414. * Sets password_confirmation
  415. *
  416. * @param string $password_confirmation 再输一次密码
  417. *
  418. * @return self
  419. */
  420. public function setPasswordConfirmation($password_confirmation)
  421. {
  422. if (is_null($password_confirmation)) {
  423. throw new \InvalidArgumentException('non-nullable password_confirmation cannot be null');
  424. }
  425. $this->container['password_confirmation'] = $password_confirmation;
  426. return $this;
  427. }
  428. /**
  429. * Gets lang
  430. *
  431. * @return string
  432. */
  433. public function getLang()
  434. {
  435. return $this->container['lang'];
  436. }
  437. /**
  438. * Sets lang
  439. *
  440. * @param string $lang 常用译文语言,用作 draft channel 的语言
  441. *
  442. * @return self
  443. */
  444. public function setLang($lang)
  445. {
  446. if (is_null($lang)) {
  447. throw new \InvalidArgumentException('non-nullable lang cannot be null');
  448. }
  449. $this->container['lang'] = $lang;
  450. return $this;
  451. }
  452. /**
  453. * Returns true if offset exists. False otherwise.
  454. *
  455. * @param integer|string $offset Offset
  456. *
  457. * @return boolean
  458. */
  459. public function offsetExists(mixed $offset): bool
  460. {
  461. return isset($this->container[$offset]);
  462. }
  463. /**
  464. * Gets offset.
  465. *
  466. * @param integer|string $offset Offset
  467. *
  468. * @return mixed|null
  469. */
  470. #[\ReturnTypeWillChange]
  471. public function offsetGet(mixed $offset)
  472. {
  473. return $this->container[$offset] ?? null;
  474. }
  475. /**
  476. * Sets value based on offset.
  477. *
  478. * @param int|null $offset Offset
  479. * @param mixed $value Value to be set
  480. *
  481. * @return void
  482. */
  483. public function offsetSet($offset, $value): void
  484. {
  485. if (is_null($offset)) {
  486. $this->container[] = $value;
  487. } else {
  488. $this->container[$offset] = $value;
  489. }
  490. }
  491. /**
  492. * Unsets offset.
  493. *
  494. * @param integer|string $offset Offset
  495. *
  496. * @return void
  497. */
  498. public function offsetUnset(mixed $offset): void
  499. {
  500. unset($this->container[$offset]);
  501. }
  502. /**
  503. * Serializes the object to a value that can be serialized natively by json_encode().
  504. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  505. *
  506. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  507. * of any type other than a resource.
  508. */
  509. #[\ReturnTypeWillChange]
  510. public function jsonSerialize()
  511. {
  512. return ObjectSerializer::sanitizeForSerialization($this);
  513. }
  514. /**
  515. * Gets the string presentation of the object
  516. *
  517. * @return string
  518. */
  519. public function __toString()
  520. {
  521. return json_encode(
  522. ObjectSerializer::sanitizeForSerialization($this),
  523. JSON_PRETTY_PRINT
  524. );
  525. }
  526. /**
  527. * Gets a header-safe presentation of the object
  528. *
  529. * @return string
  530. */
  531. public function toHeaderValue()
  532. {
  533. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  534. }
  535. }