PostApiV3PasswordResetsRequest.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <?php
  2. /**
  3. * PostApiV3PasswordResetsRequest
  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.8
  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. * PostApiV3PasswordResetsRequest 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 PostApiV3PasswordResetsRequest 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_password_resets_request';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'email' => 'string',
  54. 'lang' => 'string'
  55. ];
  56. /**
  57. * Array of property to format mappings. Used for (de)serialization
  58. *
  59. * @var string[]
  60. * @phpstan-var array<string, string|null>
  61. * @psalm-var array<string, string|null>
  62. */
  63. protected static $openAPIFormats = [
  64. 'email' => null,
  65. 'lang' => null
  66. ];
  67. /**
  68. * Array of nullable properties. Used for (de)serialization
  69. *
  70. * @var boolean[]
  71. */
  72. protected static array $openAPINullables = [
  73. 'email' => false,
  74. 'lang' => false
  75. ];
  76. /**
  77. * If a nullable field gets set to null, insert it here
  78. *
  79. * @var boolean[]
  80. */
  81. protected array $openAPINullablesSetToNull = [];
  82. /**
  83. * Array of property to type mappings. Used for (de)serialization
  84. *
  85. * @return array
  86. */
  87. public static function openAPITypes()
  88. {
  89. return self::$openAPITypes;
  90. }
  91. /**
  92. * Array of property to format mappings. Used for (de)serialization
  93. *
  94. * @return array
  95. */
  96. public static function openAPIFormats()
  97. {
  98. return self::$openAPIFormats;
  99. }
  100. /**
  101. * Array of nullable properties
  102. *
  103. * @return array
  104. */
  105. protected static function openAPINullables(): array
  106. {
  107. return self::$openAPINullables;
  108. }
  109. /**
  110. * Array of nullable field names deliberately set to null
  111. *
  112. * @return boolean[]
  113. */
  114. private function getOpenAPINullablesSetToNull(): array
  115. {
  116. return $this->openAPINullablesSetToNull;
  117. }
  118. /**
  119. * Setter - Array of nullable field names deliberately set to null
  120. *
  121. * @param boolean[] $openAPINullablesSetToNull
  122. */
  123. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  124. {
  125. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  126. }
  127. /**
  128. * Checks if a property is nullable
  129. *
  130. * @param string $property
  131. * @return bool
  132. */
  133. public static function isNullable(string $property): bool
  134. {
  135. return self::openAPINullables()[$property] ?? false;
  136. }
  137. /**
  138. * Checks if a nullable property is set to null.
  139. *
  140. * @param string $property
  141. * @return bool
  142. */
  143. public function isNullableSetToNull(string $property): bool
  144. {
  145. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  146. }
  147. /**
  148. * Array of attributes where the key is the local name,
  149. * and the value is the original name
  150. *
  151. * @var string[]
  152. */
  153. protected static $attributeMap = [
  154. 'email' => 'email',
  155. 'lang' => 'lang'
  156. ];
  157. /**
  158. * Array of attributes to setter functions (for deserialization of responses)
  159. *
  160. * @var string[]
  161. */
  162. protected static $setters = [
  163. 'email' => 'setEmail',
  164. 'lang' => 'setLang'
  165. ];
  166. /**
  167. * Array of attributes to getter functions (for serialization of requests)
  168. *
  169. * @var string[]
  170. */
  171. protected static $getters = [
  172. 'email' => 'getEmail',
  173. 'lang' => 'getLang'
  174. ];
  175. /**
  176. * Array of attributes where the key is the local name,
  177. * and the value is the original name
  178. *
  179. * @return array
  180. */
  181. public static function attributeMap()
  182. {
  183. return self::$attributeMap;
  184. }
  185. /**
  186. * Array of attributes to setter functions (for deserialization of responses)
  187. *
  188. * @return array
  189. */
  190. public static function setters()
  191. {
  192. return self::$setters;
  193. }
  194. /**
  195. * Array of attributes to getter functions (for serialization of requests)
  196. *
  197. * @return array
  198. */
  199. public static function getters()
  200. {
  201. return self::$getters;
  202. }
  203. /**
  204. * The original name of the model.
  205. *
  206. * @return string
  207. */
  208. public function getModelName()
  209. {
  210. return self::$openAPIModelName;
  211. }
  212. public const LANG_EN = 'en';
  213. public const LANG_EN_US = 'en-US';
  214. public const LANG_ZH_HANS = 'zh-Hans';
  215. public const LANG_ZH_HANT = 'zh-Hant';
  216. /**
  217. * Gets allowable values of the enum
  218. *
  219. * @return string[]
  220. */
  221. public function getLangAllowableValues()
  222. {
  223. return [
  224. self::LANG_EN,
  225. self::LANG_EN_US,
  226. self::LANG_ZH_HANS,
  227. self::LANG_ZH_HANT,
  228. ];
  229. }
  230. /**
  231. * Associative array for storing property values
  232. *
  233. * @var mixed[]
  234. */
  235. protected $container = [];
  236. /**
  237. * Constructor
  238. *
  239. * @param mixed[]|null $data Associated array of property values
  240. * initializing the model
  241. */
  242. public function __construct(?array $data = null)
  243. {
  244. $this->setIfExists('email', $data ?? [], null);
  245. $this->setIfExists('lang', $data ?? [], null);
  246. }
  247. /**
  248. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  249. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  250. * $this->openAPINullablesSetToNull array
  251. *
  252. * @param string $variableName
  253. * @param array $fields
  254. * @param mixed $defaultValue
  255. */
  256. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  257. {
  258. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  259. $this->openAPINullablesSetToNull[] = $variableName;
  260. }
  261. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  262. }
  263. /**
  264. * Show all the invalid properties with reasons.
  265. *
  266. * @return array invalid properties with reasons
  267. */
  268. public function listInvalidProperties()
  269. {
  270. $invalidProperties = [];
  271. if ($this->container['email'] === null) {
  272. $invalidProperties[] = "'email' can't be null";
  273. }
  274. $allowedValues = $this->getLangAllowableValues();
  275. if (!is_null($this->container['lang']) && !in_array($this->container['lang'], $allowedValues, true)) {
  276. $invalidProperties[] = sprintf(
  277. "invalid value '%s' for 'lang', must be one of '%s'",
  278. $this->container['lang'],
  279. implode("', '", $allowedValues)
  280. );
  281. }
  282. return $invalidProperties;
  283. }
  284. /**
  285. * Validate all the properties in the model
  286. * return true if all passed
  287. *
  288. * @return bool True if all properties are valid
  289. */
  290. public function valid()
  291. {
  292. return count($this->listInvalidProperties()) === 0;
  293. }
  294. /**
  295. * Gets email
  296. *
  297. * @return string
  298. */
  299. public function getEmail()
  300. {
  301. return $this->container['email'];
  302. }
  303. /**
  304. * Sets email
  305. *
  306. * @param string $email 账号邮箱
  307. *
  308. * @return self
  309. */
  310. public function setEmail($email)
  311. {
  312. if (is_null($email)) {
  313. throw new \InvalidArgumentException('non-nullable email cannot be null');
  314. }
  315. $this->container['email'] = $email;
  316. return $this;
  317. }
  318. /**
  319. * Gets lang
  320. *
  321. * @return string|null
  322. */
  323. public function getLang()
  324. {
  325. return $this->container['lang'];
  326. }
  327. /**
  328. * Sets lang
  329. *
  330. * @param string|null $lang 邮件语言,没有对应模板的回落 en
  331. *
  332. * @return self
  333. */
  334. public function setLang($lang)
  335. {
  336. if (is_null($lang)) {
  337. throw new \InvalidArgumentException('non-nullable lang cannot be null');
  338. }
  339. $allowedValues = $this->getLangAllowableValues();
  340. if (!in_array($lang, $allowedValues, true)) {
  341. throw new \InvalidArgumentException(
  342. sprintf(
  343. "Invalid value '%s' for 'lang', must be one of '%s'",
  344. $lang,
  345. implode("', '", $allowedValues)
  346. )
  347. );
  348. }
  349. $this->container['lang'] = $lang;
  350. return $this;
  351. }
  352. /**
  353. * Returns true if offset exists. False otherwise.
  354. *
  355. * @param integer|string $offset Offset
  356. *
  357. * @return boolean
  358. */
  359. public function offsetExists(mixed $offset): bool
  360. {
  361. return isset($this->container[$offset]);
  362. }
  363. /**
  364. * Gets offset.
  365. *
  366. * @param integer|string $offset Offset
  367. *
  368. * @return mixed|null
  369. */
  370. #[\ReturnTypeWillChange]
  371. public function offsetGet(mixed $offset)
  372. {
  373. return $this->container[$offset] ?? null;
  374. }
  375. /**
  376. * Sets value based on offset.
  377. *
  378. * @param int|null $offset Offset
  379. * @param mixed $value Value to be set
  380. *
  381. * @return void
  382. */
  383. public function offsetSet($offset, $value): void
  384. {
  385. if (is_null($offset)) {
  386. $this->container[] = $value;
  387. } else {
  388. $this->container[$offset] = $value;
  389. }
  390. }
  391. /**
  392. * Unsets offset.
  393. *
  394. * @param integer|string $offset Offset
  395. *
  396. * @return void
  397. */
  398. public function offsetUnset(mixed $offset): void
  399. {
  400. unset($this->container[$offset]);
  401. }
  402. /**
  403. * Serializes the object to a value that can be serialized natively by json_encode().
  404. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  405. *
  406. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  407. * of any type other than a resource.
  408. */
  409. #[\ReturnTypeWillChange]
  410. public function jsonSerialize()
  411. {
  412. return ObjectSerializer::sanitizeForSerialization($this);
  413. }
  414. /**
  415. * Gets the string presentation of the object
  416. *
  417. * @return string
  418. */
  419. public function __toString()
  420. {
  421. return json_encode(
  422. ObjectSerializer::sanitizeForSerialization($this),
  423. JSON_PRETTY_PRINT
  424. );
  425. }
  426. /**
  427. * Gets a header-safe presentation of the object
  428. *
  429. * @return string
  430. */
  431. public function toHeaderValue()
  432. {
  433. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  434. }
  435. }