PostApiV3GroupsRequest.php 11 KB

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