PostApiV3TipitakaExports200ResponseData.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. <?php
  2. /**
  3. * PostApiV3TipitakaExports200ResponseData
  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. * PostApiV3TipitakaExports200ResponseData 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 PostApiV3TipitakaExports200ResponseData 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_tipitaka_exports_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. 'status' => 'string',
  55. 'format' => 'string',
  56. 'progress' => 'float',
  57. 'message' => 'string',
  58. 'title' => 'string',
  59. 'works' => 'int',
  60. 'filename' => 'string',
  61. 'content_type' => 'string',
  62. 'size' => 'int',
  63. 'ready_at' => 'string',
  64. 'expires_at' => 'string',
  65. 'download_url' => 'string'
  66. ];
  67. /**
  68. * Array of property to format mappings. Used for (de)serialization
  69. *
  70. * @var string[]
  71. * @phpstan-var array<string, string|null>
  72. * @psalm-var array<string, string|null>
  73. */
  74. protected static $openAPIFormats = [
  75. 'id' => null,
  76. 'status' => null,
  77. 'format' => null,
  78. 'progress' => null,
  79. 'message' => null,
  80. 'title' => null,
  81. 'works' => null,
  82. 'filename' => null,
  83. 'content_type' => null,
  84. 'size' => null,
  85. 'ready_at' => null,
  86. 'expires_at' => null,
  87. 'download_url' => null
  88. ];
  89. /**
  90. * Array of nullable properties. Used for (de)serialization
  91. *
  92. * @var boolean[]
  93. */
  94. protected static array $openAPINullables = [
  95. 'id' => false,
  96. 'status' => false,
  97. 'format' => false,
  98. 'progress' => false,
  99. 'message' => true,
  100. 'title' => false,
  101. 'works' => false,
  102. 'filename' => false,
  103. 'content_type' => false,
  104. 'size' => true,
  105. 'ready_at' => true,
  106. 'expires_at' => true,
  107. 'download_url' => true
  108. ];
  109. /**
  110. * If a nullable field gets set to null, insert it here
  111. *
  112. * @var boolean[]
  113. */
  114. protected array $openAPINullablesSetToNull = [];
  115. /**
  116. * Array of property to type mappings. Used for (de)serialization
  117. *
  118. * @return array
  119. */
  120. public static function openAPITypes()
  121. {
  122. return self::$openAPITypes;
  123. }
  124. /**
  125. * Array of property to format mappings. Used for (de)serialization
  126. *
  127. * @return array
  128. */
  129. public static function openAPIFormats()
  130. {
  131. return self::$openAPIFormats;
  132. }
  133. /**
  134. * Array of nullable properties
  135. *
  136. * @return array
  137. */
  138. protected static function openAPINullables(): array
  139. {
  140. return self::$openAPINullables;
  141. }
  142. /**
  143. * Array of nullable field names deliberately set to null
  144. *
  145. * @return boolean[]
  146. */
  147. private function getOpenAPINullablesSetToNull(): array
  148. {
  149. return $this->openAPINullablesSetToNull;
  150. }
  151. /**
  152. * Setter - Array of nullable field names deliberately set to null
  153. *
  154. * @param boolean[] $openAPINullablesSetToNull
  155. */
  156. private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
  157. {
  158. $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
  159. }
  160. /**
  161. * Checks if a property is nullable
  162. *
  163. * @param string $property
  164. * @return bool
  165. */
  166. public static function isNullable(string $property): bool
  167. {
  168. return self::openAPINullables()[$property] ?? false;
  169. }
  170. /**
  171. * Checks if a nullable property is set to null.
  172. *
  173. * @param string $property
  174. * @return bool
  175. */
  176. public function isNullableSetToNull(string $property): bool
  177. {
  178. return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
  179. }
  180. /**
  181. * Array of attributes where the key is the local name,
  182. * and the value is the original name
  183. *
  184. * @var string[]
  185. */
  186. protected static $attributeMap = [
  187. 'id' => 'id',
  188. 'status' => 'status',
  189. 'format' => 'format',
  190. 'progress' => 'progress',
  191. 'message' => 'message',
  192. 'title' => 'title',
  193. 'works' => 'works',
  194. 'filename' => 'filename',
  195. 'content_type' => 'content_type',
  196. 'size' => 'size',
  197. 'ready_at' => 'ready_at',
  198. 'expires_at' => 'expires_at',
  199. 'download_url' => 'download_url'
  200. ];
  201. /**
  202. * Array of attributes to setter functions (for deserialization of responses)
  203. *
  204. * @var string[]
  205. */
  206. protected static $setters = [
  207. 'id' => 'setId',
  208. 'status' => 'setStatus',
  209. 'format' => 'setFormat',
  210. 'progress' => 'setProgress',
  211. 'message' => 'setMessage',
  212. 'title' => 'setTitle',
  213. 'works' => 'setWorks',
  214. 'filename' => 'setFilename',
  215. 'content_type' => 'setContentType',
  216. 'size' => 'setSize',
  217. 'ready_at' => 'setReadyAt',
  218. 'expires_at' => 'setExpiresAt',
  219. 'download_url' => 'setDownloadUrl'
  220. ];
  221. /**
  222. * Array of attributes to getter functions (for serialization of requests)
  223. *
  224. * @var string[]
  225. */
  226. protected static $getters = [
  227. 'id' => 'getId',
  228. 'status' => 'getStatus',
  229. 'format' => 'getFormat',
  230. 'progress' => 'getProgress',
  231. 'message' => 'getMessage',
  232. 'title' => 'getTitle',
  233. 'works' => 'getWorks',
  234. 'filename' => 'getFilename',
  235. 'content_type' => 'getContentType',
  236. 'size' => 'getSize',
  237. 'ready_at' => 'getReadyAt',
  238. 'expires_at' => 'getExpiresAt',
  239. 'download_url' => 'getDownloadUrl'
  240. ];
  241. /**
  242. * Array of attributes where the key is the local name,
  243. * and the value is the original name
  244. *
  245. * @return array
  246. */
  247. public static function attributeMap()
  248. {
  249. return self::$attributeMap;
  250. }
  251. /**
  252. * Array of attributes to setter functions (for deserialization of responses)
  253. *
  254. * @return array
  255. */
  256. public static function setters()
  257. {
  258. return self::$setters;
  259. }
  260. /**
  261. * Array of attributes to getter functions (for serialization of requests)
  262. *
  263. * @return array
  264. */
  265. public static function getters()
  266. {
  267. return self::$getters;
  268. }
  269. /**
  270. * The original name of the model.
  271. *
  272. * @return string
  273. */
  274. public function getModelName()
  275. {
  276. return self::$openAPIModelName;
  277. }
  278. /**
  279. * Associative array for storing property values
  280. *
  281. * @var mixed[]
  282. */
  283. protected $container = [];
  284. /**
  285. * Constructor
  286. *
  287. * @param mixed[]|null $data Associated array of property values
  288. * initializing the model
  289. */
  290. public function __construct(?array $data = null)
  291. {
  292. $this->setIfExists('id', $data ?? [], null);
  293. $this->setIfExists('status', $data ?? [], null);
  294. $this->setIfExists('format', $data ?? [], null);
  295. $this->setIfExists('progress', $data ?? [], null);
  296. $this->setIfExists('message', $data ?? [], null);
  297. $this->setIfExists('title', $data ?? [], null);
  298. $this->setIfExists('works', $data ?? [], null);
  299. $this->setIfExists('filename', $data ?? [], null);
  300. $this->setIfExists('content_type', $data ?? [], null);
  301. $this->setIfExists('size', $data ?? [], null);
  302. $this->setIfExists('ready_at', $data ?? [], null);
  303. $this->setIfExists('expires_at', $data ?? [], null);
  304. $this->setIfExists('download_url', $data ?? [], null);
  305. }
  306. /**
  307. * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
  308. * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
  309. * $this->openAPINullablesSetToNull array
  310. *
  311. * @param string $variableName
  312. * @param array $fields
  313. * @param mixed $defaultValue
  314. */
  315. private function setIfExists(string $variableName, array $fields, $defaultValue): void
  316. {
  317. if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
  318. $this->openAPINullablesSetToNull[] = $variableName;
  319. }
  320. $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
  321. }
  322. /**
  323. * Show all the invalid properties with reasons.
  324. *
  325. * @return array invalid properties with reasons
  326. */
  327. public function listInvalidProperties()
  328. {
  329. $invalidProperties = [];
  330. return $invalidProperties;
  331. }
  332. /**
  333. * Validate all the properties in the model
  334. * return true if all passed
  335. *
  336. * @return bool True if all properties are valid
  337. */
  338. public function valid()
  339. {
  340. return count($this->listInvalidProperties()) === 0;
  341. }
  342. /**
  343. * Gets id
  344. *
  345. * @return string|null
  346. */
  347. public function getId()
  348. {
  349. return $this->container['id'];
  350. }
  351. /**
  352. * Sets id
  353. *
  354. * @param string|null $id id
  355. *
  356. * @return self
  357. */
  358. public function setId($id)
  359. {
  360. if (is_null($id)) {
  361. throw new \InvalidArgumentException('non-nullable id cannot be null');
  362. }
  363. $this->container['id'] = $id;
  364. return $this;
  365. }
  366. /**
  367. * Gets status
  368. *
  369. * @return string|null
  370. */
  371. public function getStatus()
  372. {
  373. return $this->container['status'];
  374. }
  375. /**
  376. * Sets status
  377. *
  378. * @param string|null $status status
  379. *
  380. * @return self
  381. */
  382. public function setStatus($status)
  383. {
  384. if (is_null($status)) {
  385. throw new \InvalidArgumentException('non-nullable status cannot be null');
  386. }
  387. $this->container['status'] = $status;
  388. return $this;
  389. }
  390. /**
  391. * Gets format
  392. *
  393. * @return string|null
  394. */
  395. public function getFormat()
  396. {
  397. return $this->container['format'];
  398. }
  399. /**
  400. * Sets format
  401. *
  402. * @param string|null $format format
  403. *
  404. * @return self
  405. */
  406. public function setFormat($format)
  407. {
  408. if (is_null($format)) {
  409. throw new \InvalidArgumentException('non-nullable format cannot be null');
  410. }
  411. $this->container['format'] = $format;
  412. return $this;
  413. }
  414. /**
  415. * Gets progress
  416. *
  417. * @return float|null
  418. */
  419. public function getProgress()
  420. {
  421. return $this->container['progress'];
  422. }
  423. /**
  424. * Sets progress
  425. *
  426. * @param float|null $progress progress
  427. *
  428. * @return self
  429. */
  430. public function setProgress($progress)
  431. {
  432. if (is_null($progress)) {
  433. throw new \InvalidArgumentException('non-nullable progress cannot be null');
  434. }
  435. $this->container['progress'] = $progress;
  436. return $this;
  437. }
  438. /**
  439. * Gets message
  440. *
  441. * @return string|null
  442. */
  443. public function getMessage()
  444. {
  445. return $this->container['message'];
  446. }
  447. /**
  448. * Sets message
  449. *
  450. * @param string|null $message message
  451. *
  452. * @return self
  453. */
  454. public function setMessage($message)
  455. {
  456. if (is_null($message)) {
  457. array_push($this->openAPINullablesSetToNull, 'message');
  458. } else {
  459. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  460. $index = array_search('message', $nullablesSetToNull);
  461. if ($index !== FALSE) {
  462. unset($nullablesSetToNull[$index]);
  463. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  464. }
  465. }
  466. $this->container['message'] = $message;
  467. return $this;
  468. }
  469. /**
  470. * Gets title
  471. *
  472. * @return string|null
  473. */
  474. public function getTitle()
  475. {
  476. return $this->container['title'];
  477. }
  478. /**
  479. * Sets title
  480. *
  481. * @param string|null $title title
  482. *
  483. * @return self
  484. */
  485. public function setTitle($title)
  486. {
  487. if (is_null($title)) {
  488. throw new \InvalidArgumentException('non-nullable title cannot be null');
  489. }
  490. $this->container['title'] = $title;
  491. return $this;
  492. }
  493. /**
  494. * Gets works
  495. *
  496. * @return int|null
  497. */
  498. public function getWorks()
  499. {
  500. return $this->container['works'];
  501. }
  502. /**
  503. * Sets works
  504. *
  505. * @param int|null $works works
  506. *
  507. * @return self
  508. */
  509. public function setWorks($works)
  510. {
  511. if (is_null($works)) {
  512. throw new \InvalidArgumentException('non-nullable works cannot be null');
  513. }
  514. $this->container['works'] = $works;
  515. return $this;
  516. }
  517. /**
  518. * Gets filename
  519. *
  520. * @return string|null
  521. */
  522. public function getFilename()
  523. {
  524. return $this->container['filename'];
  525. }
  526. /**
  527. * Sets filename
  528. *
  529. * @param string|null $filename filename
  530. *
  531. * @return self
  532. */
  533. public function setFilename($filename)
  534. {
  535. if (is_null($filename)) {
  536. throw new \InvalidArgumentException('non-nullable filename cannot be null');
  537. }
  538. $this->container['filename'] = $filename;
  539. return $this;
  540. }
  541. /**
  542. * Gets content_type
  543. *
  544. * @return string|null
  545. */
  546. public function getContentType()
  547. {
  548. return $this->container['content_type'];
  549. }
  550. /**
  551. * Sets content_type
  552. *
  553. * @param string|null $content_type content_type
  554. *
  555. * @return self
  556. */
  557. public function setContentType($content_type)
  558. {
  559. if (is_null($content_type)) {
  560. throw new \InvalidArgumentException('non-nullable content_type cannot be null');
  561. }
  562. $this->container['content_type'] = $content_type;
  563. return $this;
  564. }
  565. /**
  566. * Gets size
  567. *
  568. * @return int|null
  569. */
  570. public function getSize()
  571. {
  572. return $this->container['size'];
  573. }
  574. /**
  575. * Sets size
  576. *
  577. * @param int|null $size size
  578. *
  579. * @return self
  580. */
  581. public function setSize($size)
  582. {
  583. if (is_null($size)) {
  584. array_push($this->openAPINullablesSetToNull, 'size');
  585. } else {
  586. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  587. $index = array_search('size', $nullablesSetToNull);
  588. if ($index !== FALSE) {
  589. unset($nullablesSetToNull[$index]);
  590. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  591. }
  592. }
  593. $this->container['size'] = $size;
  594. return $this;
  595. }
  596. /**
  597. * Gets ready_at
  598. *
  599. * @return string|null
  600. */
  601. public function getReadyAt()
  602. {
  603. return $this->container['ready_at'];
  604. }
  605. /**
  606. * Sets ready_at
  607. *
  608. * @param string|null $ready_at ready_at
  609. *
  610. * @return self
  611. */
  612. public function setReadyAt($ready_at)
  613. {
  614. if (is_null($ready_at)) {
  615. array_push($this->openAPINullablesSetToNull, 'ready_at');
  616. } else {
  617. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  618. $index = array_search('ready_at', $nullablesSetToNull);
  619. if ($index !== FALSE) {
  620. unset($nullablesSetToNull[$index]);
  621. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  622. }
  623. }
  624. $this->container['ready_at'] = $ready_at;
  625. return $this;
  626. }
  627. /**
  628. * Gets expires_at
  629. *
  630. * @return string|null
  631. */
  632. public function getExpiresAt()
  633. {
  634. return $this->container['expires_at'];
  635. }
  636. /**
  637. * Sets expires_at
  638. *
  639. * @param string|null $expires_at expires_at
  640. *
  641. * @return self
  642. */
  643. public function setExpiresAt($expires_at)
  644. {
  645. if (is_null($expires_at)) {
  646. array_push($this->openAPINullablesSetToNull, 'expires_at');
  647. } else {
  648. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  649. $index = array_search('expires_at', $nullablesSetToNull);
  650. if ($index !== FALSE) {
  651. unset($nullablesSetToNull[$index]);
  652. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  653. }
  654. }
  655. $this->container['expires_at'] = $expires_at;
  656. return $this;
  657. }
  658. /**
  659. * Gets download_url
  660. *
  661. * @return string|null
  662. */
  663. public function getDownloadUrl()
  664. {
  665. return $this->container['download_url'];
  666. }
  667. /**
  668. * Sets download_url
  669. *
  670. * @param string|null $download_url download_url
  671. *
  672. * @return self
  673. */
  674. public function setDownloadUrl($download_url)
  675. {
  676. if (is_null($download_url)) {
  677. array_push($this->openAPINullablesSetToNull, 'download_url');
  678. } else {
  679. $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
  680. $index = array_search('download_url', $nullablesSetToNull);
  681. if ($index !== FALSE) {
  682. unset($nullablesSetToNull[$index]);
  683. $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
  684. }
  685. }
  686. $this->container['download_url'] = $download_url;
  687. return $this;
  688. }
  689. /**
  690. * Returns true if offset exists. False otherwise.
  691. *
  692. * @param integer|string $offset Offset
  693. *
  694. * @return boolean
  695. */
  696. public function offsetExists(mixed $offset): bool
  697. {
  698. return isset($this->container[$offset]);
  699. }
  700. /**
  701. * Gets offset.
  702. *
  703. * @param integer|string $offset Offset
  704. *
  705. * @return mixed|null
  706. */
  707. #[\ReturnTypeWillChange]
  708. public function offsetGet(mixed $offset)
  709. {
  710. return $this->container[$offset] ?? null;
  711. }
  712. /**
  713. * Sets value based on offset.
  714. *
  715. * @param int|null $offset Offset
  716. * @param mixed $value Value to be set
  717. *
  718. * @return void
  719. */
  720. public function offsetSet($offset, $value): void
  721. {
  722. if (is_null($offset)) {
  723. $this->container[] = $value;
  724. } else {
  725. $this->container[$offset] = $value;
  726. }
  727. }
  728. /**
  729. * Unsets offset.
  730. *
  731. * @param integer|string $offset Offset
  732. *
  733. * @return void
  734. */
  735. public function offsetUnset(mixed $offset): void
  736. {
  737. unset($this->container[$offset]);
  738. }
  739. /**
  740. * Serializes the object to a value that can be serialized natively by json_encode().
  741. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  742. *
  743. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  744. * of any type other than a resource.
  745. */
  746. #[\ReturnTypeWillChange]
  747. public function jsonSerialize()
  748. {
  749. return ObjectSerializer::sanitizeForSerialization($this);
  750. }
  751. /**
  752. * Gets the string presentation of the object
  753. *
  754. * @return string
  755. */
  756. public function __toString()
  757. {
  758. return json_encode(
  759. ObjectSerializer::sanitizeForSerialization($this),
  760. JSON_PRETTY_PRINT
  761. );
  762. }
  763. /**
  764. * Gets a header-safe presentation of the object
  765. *
  766. * @return string
  767. */
  768. public function toHeaderValue()
  769. {
  770. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  771. }
  772. }