GetApiV3TipitakaReadingChannel200ResponseMeta.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <?php
  2. /**
  3. * GetApiV3TipitakaReadingChannel200ResponseMeta
  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.9.28
  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. * GetApiV3TipitakaReadingChannel200ResponseMeta 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 GetApiV3TipitakaReadingChannel200ResponseMeta 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_tipitaka_reading_channel__200_response_meta';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'page_size' => 'int',
  54. 'page_size_unit' => 'string',
  55. 'next_cursor' => 'string',
  56. 'total' => 'int',
  57. 'remaining' => 'int'
  58. ];
  59. /**
  60. * Array of property to format mappings. Used for (de)serialization
  61. *
  62. * @var string[]
  63. * @phpstan-var array<string, string|null>
  64. * @psalm-var array<string, string|null>
  65. */
  66. protected static $openAPIFormats = [
  67. 'page_size' => null,
  68. 'page_size_unit' => null,
  69. 'next_cursor' => null,
  70. 'total' => null,
  71. 'remaining' => null
  72. ];
  73. /**
  74. * Array of nullable properties. Used for (de)serialization
  75. *
  76. * @var boolean[]
  77. */
  78. protected static array $openAPINullables = [
  79. 'page_size' => false,
  80. 'page_size_unit' => false,
  81. 'next_cursor' => false,
  82. 'total' => false,
  83. 'remaining' => false
  84. ];
  85. /**
  86. * If a nullable field gets set to null, insert it here
  87. *
  88. * @var boolean[]
  89. */
  90. protected array $openAPINullablesSetToNull = [];
  91. /**
  92. * Array of property to type mappings. Used for (de)serialization
  93. *
  94. * @return array
  95. */
  96. public static function openAPITypes()
  97. {
  98. return self::$openAPITypes;
  99. }
  100. /**
  101. * Array of property to format mappings. Used for (de)serialization
  102. *
  103. * @return array
  104. */
  105. public static function openAPIFormats()
  106. {
  107. return self::$openAPIFormats;
  108. }
  109. /**
  110. * Array of nullable properties
  111. *
  112. * @return array
  113. */
  114. protected static function openAPINullables(): array
  115. {
  116. return self::$openAPINullables;
  117. }
  118. /**
  119. * Array of nullable field names deliberately set to null
  120. *
  121. * @return boolean[]
  122. */
  123. private function getOpenAPINullablesSetToNull(): array
  124. {
  125. return $this->openAPINullablesSetToNull;
  126. }
  127. /**
  128. * Setter - Array of nullable field names deliberately set to null
  129. *
  130. * @param boolean[] $openAPINullablesSetToNull
  131. */
  132. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  133. {
  134. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  135. }
  136. /**
  137. * Checks if a property is nullable
  138. *
  139. * @param string $property
  140. * @return bool
  141. */
  142. public static function isNullable(string $property): bool
  143. {
  144. return self::openAPINullables()[$property] ?? false;
  145. }
  146. /**
  147. * Checks if a nullable property is set to null.
  148. *
  149. * @param string $property
  150. * @return bool
  151. */
  152. public function isNullableSetToNull(string $property): bool
  153. {
  154. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  155. }
  156. /**
  157. * Array of attributes where the key is the local name,
  158. * and the value is the original name
  159. *
  160. * @var string[]
  161. */
  162. protected static $attributeMap = [
  163. 'page_size' => 'page_size',
  164. 'page_size_unit' => 'page_size_unit',
  165. 'next_cursor' => 'next_cursor',
  166. 'total' => 'total',
  167. 'remaining' => 'remaining'
  168. ];
  169. /**
  170. * Array of attributes to setter functions (for deserialization of responses)
  171. *
  172. * @var string[]
  173. */
  174. protected static $setters = [
  175. 'page_size' => 'setPageSize',
  176. 'page_size_unit' => 'setPageSizeUnit',
  177. 'next_cursor' => 'setNextCursor',
  178. 'total' => 'setTotal',
  179. 'remaining' => 'setRemaining'
  180. ];
  181. /**
  182. * Array of attributes to getter functions (for serialization of requests)
  183. *
  184. * @var string[]
  185. */
  186. protected static $getters = [
  187. 'page_size' => 'getPageSize',
  188. 'page_size_unit' => 'getPageSizeUnit',
  189. 'next_cursor' => 'getNextCursor',
  190. 'total' => 'getTotal',
  191. 'remaining' => 'getRemaining'
  192. ];
  193. /**
  194. * Array of attributes where the key is the local name,
  195. * and the value is the original name
  196. *
  197. * @return array
  198. */
  199. public static function attributeMap()
  200. {
  201. return self::$attributeMap;
  202. }
  203. /**
  204. * Array of attributes to setter functions (for deserialization of responses)
  205. *
  206. * @return array
  207. */
  208. public static function setters()
  209. {
  210. return self::$setters;
  211. }
  212. /**
  213. * Array of attributes to getter functions (for serialization of requests)
  214. *
  215. * @return array
  216. */
  217. public static function getters()
  218. {
  219. return self::$getters;
  220. }
  221. /**
  222. * The original name of the model.
  223. *
  224. * @return string
  225. */
  226. public function getModelName()
  227. {
  228. return self::$openAPIModelName;
  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('page_size', $data ?? [], null);
  245. $this->setIfExists('page_size_unit', $data ?? [], null);
  246. $this->setIfExists('next_cursor', $data ?? [], null);
  247. $this->setIfExists('total', $data ?? [], null);
  248. $this->setIfExists('remaining', $data ?? [], null);
  249. }
  250. /**
  251. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  252. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  253. * $this->openAPINullablesSetToNull array
  254. *
  255. * @param string $variableName
  256. * @param array $fields
  257. * @param mixed $defaultValue
  258. */
  259. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  260. {
  261. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  262. $this->openAPINullablesSetToNull[] = $variableName;
  263. }
  264. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  265. }
  266. /**
  267. * Show all the invalid properties with reasons.
  268. *
  269. * @return array invalid properties with reasons
  270. */
  271. public function listInvalidProperties()
  272. {
  273. $invalidProperties = [];
  274. return $invalidProperties;
  275. }
  276. /**
  277. * Validate all the properties in the model
  278. * return true if all passed
  279. *
  280. * @return bool True if all properties are valid
  281. */
  282. public function valid()
  283. {
  284. return count($this->listInvalidProperties()) === 0;
  285. }
  286. /**
  287. * Gets page_size
  288. *
  289. * @return int|null
  290. */
  291. public function getPageSize()
  292. {
  293. return $this->container['page_size'];
  294. }
  295. /**
  296. * Sets page_size
  297. *
  298. * @param int|null $page_size 每块大小(按 unit 计)
  299. *
  300. * @return self
  301. */
  302. public function setPageSize($page_size)
  303. {
  304. if (is_null($page_size)) {
  305. throw new \InvalidArgumentException('non-nullable page_size cannot be null');
  306. }
  307. $this->container['page_size'] = $page_size;
  308. return $this;
  309. }
  310. /**
  311. * Gets page_size_unit
  312. *
  313. * @return string|null
  314. */
  315. public function getPageSizeUnit()
  316. {
  317. return $this->container['page_size_unit'];
  318. }
  319. /**
  320. * Sets page_size_unit
  321. *
  322. * @param string|null $page_size_unit 每块大小的单位:para 或 byte
  323. *
  324. * @return self
  325. */
  326. public function setPageSizeUnit($page_size_unit)
  327. {
  328. if (is_null($page_size_unit)) {
  329. throw new \InvalidArgumentException('non-nullable page_size_unit cannot be null');
  330. }
  331. $this->container['page_size_unit'] = $page_size_unit;
  332. return $this;
  333. }
  334. /**
  335. * Gets next_cursor
  336. *
  337. * @return string|null
  338. */
  339. public function getNextCursor()
  340. {
  341. return $this->container['next_cursor'];
  342. }
  343. /**
  344. * Sets next_cursor
  345. *
  346. * @param string|null $next_cursor 下一块的游标,原样传回 after;为 null 表示取完
  347. *
  348. * @return self
  349. */
  350. public function setNextCursor($next_cursor)
  351. {
  352. if (is_null($next_cursor)) {
  353. throw new \InvalidArgumentException('non-nullable next_cursor cannot be null');
  354. }
  355. $this->container['next_cursor'] = $next_cursor;
  356. return $this;
  357. }
  358. /**
  359. * Gets total
  360. *
  361. * @return int|null
  362. */
  363. public function getTotal()
  364. {
  365. return $this->container['total'];
  366. }
  367. /**
  368. * Sets total
  369. *
  370. * @param int|null $total 过滤范围内已翻译的段落总数。仅在带了 book 过滤时出现
  371. *
  372. * @return self
  373. */
  374. public function setTotal($total)
  375. {
  376. if (is_null($total)) {
  377. throw new \InvalidArgumentException('non-nullable total cannot be null');
  378. }
  379. $this->container['total'] = $total;
  380. return $this;
  381. }
  382. /**
  383. * Gets remaining
  384. *
  385. * @return int|null
  386. */
  387. public function getRemaining()
  388. {
  389. return $this->container['remaining'];
  390. }
  391. /**
  392. * Sets remaining
  393. *
  394. * @param int|null $remaining 本块之后过滤范围内还剩多少段。仅在带了 book 过滤时出现
  395. *
  396. * @return self
  397. */
  398. public function setRemaining($remaining)
  399. {
  400. if (is_null($remaining)) {
  401. throw new \InvalidArgumentException('non-nullable remaining cannot be null');
  402. }
  403. $this->container['remaining'] = $remaining;
  404. return $this;
  405. }
  406. /**
  407. * Returns true if offset exists. False otherwise.
  408. *
  409. * @param integer|string $offset Offset
  410. *
  411. * @return boolean
  412. */
  413. public function offsetExists(mixed $offset): bool
  414. {
  415. return isset($this->container[$offset]);
  416. }
  417. /**
  418. * Gets offset.
  419. *
  420. * @param integer|string $offset Offset
  421. *
  422. * @return mixed|null
  423. */
  424. #[\ReturnTypeWillChange]
  425. public function offsetGet(mixed $offset)
  426. {
  427. return $this->container[$offset] ?? null;
  428. }
  429. /**
  430. * Sets value based on offset.
  431. *
  432. * @param int|null $offset Offset
  433. * @param mixed $value Value to be set
  434. *
  435. * @return void
  436. */
  437. public function offsetSet($offset, $value): void
  438. {
  439. if (is_null($offset)) {
  440. $this->container[] = $value;
  441. } else {
  442. $this->container[$offset] = $value;
  443. }
  444. }
  445. /**
  446. * Unsets offset.
  447. *
  448. * @param integer|string $offset Offset
  449. *
  450. * @return void
  451. */
  452. public function offsetUnset(mixed $offset): void
  453. {
  454. unset($this->container[$offset]);
  455. }
  456. /**
  457. * Serializes the object to a value that can be serialized natively by json_encode().
  458. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  459. *
  460. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  461. * of any type other than a resource.
  462. */
  463. #[\ReturnTypeWillChange]
  464. public function jsonSerialize()
  465. {
  466. return ObjectSerializer::sanitizeForSerialization($this);
  467. }
  468. /**
  469. * Gets the string presentation of the object
  470. *
  471. * @return string
  472. */
  473. public function __toString()
  474. {
  475. return json_encode(
  476. ObjectSerializer::sanitizeForSerialization($this),
  477. JSON_PRETTY_PRINT
  478. );
  479. }
  480. /**
  481. * Gets a header-safe presentation of the object
  482. *
  483. * @return string
  484. */
  485. public function toHeaderValue()
  486. {
  487. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  488. }
  489. }