PostApiV3AgentChargesRequest.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <?php
  2. /**
  3. * PostApiV3AgentChargesRequest
  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.11.12
  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. * PostApiV3AgentChargesRequest 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 PostApiV3AgentChargesRequest 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_agent_charges_request';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $openAPITypes = [
  53. 'run_id' => 'string',
  54. 'thread_id' => 'string',
  55. 'deep' => 'bool',
  56. 'device_id' => 'string',
  57. 'client_ip' => 'string'
  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. 'run_id' => null,
  68. 'thread_id' => null,
  69. 'deep' => null,
  70. 'device_id' => null,
  71. 'client_ip' => null
  72. ];
  73. /**
  74. * Array of nullable properties. Used for (de)serialization
  75. *
  76. * @var boolean[]
  77. */
  78. protected static array $openAPINullables = [
  79. 'run_id' => false,
  80. 'thread_id' => false,
  81. 'deep' => false,
  82. 'device_id' => false,
  83. 'client_ip' => 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. 'run_id' => 'run_id',
  164. 'thread_id' => 'thread_id',
  165. 'deep' => 'deep',
  166. 'device_id' => 'device_id',
  167. 'client_ip' => 'client_ip'
  168. ];
  169. /**
  170. * Array of attributes to setter functions (for deserialization of responses)
  171. *
  172. * @var string[]
  173. */
  174. protected static $setters = [
  175. 'run_id' => 'setRunId',
  176. 'thread_id' => 'setThreadId',
  177. 'deep' => 'setDeep',
  178. 'device_id' => 'setDeviceId',
  179. 'client_ip' => 'setClientIp'
  180. ];
  181. /**
  182. * Array of attributes to getter functions (for serialization of requests)
  183. *
  184. * @var string[]
  185. */
  186. protected static $getters = [
  187. 'run_id' => 'getRunId',
  188. 'thread_id' => 'getThreadId',
  189. 'deep' => 'getDeep',
  190. 'device_id' => 'getDeviceId',
  191. 'client_ip' => 'getClientIp'
  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('run_id', $data ?? [], null);
  245. $this->setIfExists('thread_id', $data ?? [], null);
  246. $this->setIfExists('deep', $data ?? [], false);
  247. $this->setIfExists('device_id', $data ?? [], null);
  248. $this->setIfExists('client_ip', $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. if ($this->container['run_id'] === null) {
  275. $invalidProperties[] = "'run_id' can't be null";
  276. }
  277. return $invalidProperties;
  278. }
  279. /**
  280. * Validate all the properties in the model
  281. * return true if all passed
  282. *
  283. * @return bool True if all properties are valid
  284. */
  285. public function valid()
  286. {
  287. return count($this->listInvalidProperties()) === 0;
  288. }
  289. /**
  290. * Gets run_id
  291. *
  292. * @return string
  293. */
  294. public function getRunId()
  295. {
  296. return $this->container['run_id'];
  297. }
  298. /**
  299. * Sets run_id
  300. *
  301. * @param string $run_id AG-UI runId(uuid)
  302. *
  303. * @return self
  304. */
  305. public function setRunId($run_id)
  306. {
  307. if (is_null($run_id)) {
  308. throw new \InvalidArgumentException('non-nullable run_id cannot be null');
  309. }
  310. $this->container['run_id'] = $run_id;
  311. return $this;
  312. }
  313. /**
  314. * Gets thread_id
  315. *
  316. * @return string|null
  317. */
  318. public function getThreadId()
  319. {
  320. return $this->container['thread_id'];
  321. }
  322. /**
  323. * Sets thread_id
  324. *
  325. * @param string|null $thread_id AG-UI threadId(uuid)。已经属于别的账号时 403,不扣费
  326. *
  327. * @return self
  328. */
  329. public function setThreadId($thread_id)
  330. {
  331. if (is_null($thread_id)) {
  332. throw new \InvalidArgumentException('non-nullable thread_id cannot be null');
  333. }
  334. $this->container['thread_id'] = $thread_id;
  335. return $this;
  336. }
  337. /**
  338. * Gets deep
  339. *
  340. * @return bool|null
  341. */
  342. public function getDeep()
  343. {
  344. return $this->container['deep'];
  345. }
  346. /**
  347. * Sets deep
  348. *
  349. * @param bool|null $deep 是否深度思考(价格不同)
  350. *
  351. * @return self
  352. */
  353. public function setDeep($deep)
  354. {
  355. if (is_null($deep)) {
  356. throw new \InvalidArgumentException('non-nullable deep cannot be null');
  357. }
  358. $this->container['deep'] = $deep;
  359. return $this;
  360. }
  361. /**
  362. * Gets device_id
  363. *
  364. * @return string|null
  365. */
  366. public function getDeviceId()
  367. {
  368. return $this->container['device_id'];
  369. }
  370. /**
  371. * Sets device_id
  372. *
  373. * @param string|null $device_id 设备匿名 id(uuid)。游客必填
  374. *
  375. * @return self
  376. */
  377. public function setDeviceId($device_id)
  378. {
  379. if (is_null($device_id)) {
  380. throw new \InvalidArgumentException('non-nullable device_id cannot be null');
  381. }
  382. $this->container['device_id'] = $device_id;
  383. return $this;
  384. }
  385. /**
  386. * Gets client_ip
  387. *
  388. * @return string|null
  389. */
  390. public function getClientIp()
  391. {
  392. return $this->container['client_ip'];
  393. }
  394. /**
  395. * Sets client_ip
  396. *
  397. * @param string|null $client_ip 客户端 IP。只对游客用于同 IP 上限
  398. *
  399. * @return self
  400. */
  401. public function setClientIp($client_ip)
  402. {
  403. if (is_null($client_ip)) {
  404. throw new \InvalidArgumentException('non-nullable client_ip cannot be null');
  405. }
  406. $this->container['client_ip'] = $client_ip;
  407. return $this;
  408. }
  409. /**
  410. * Returns true if offset exists. False otherwise.
  411. *
  412. * @param integer|string $offset Offset
  413. *
  414. * @return boolean
  415. */
  416. public function offsetExists(mixed $offset): bool
  417. {
  418. return isset($this->container[$offset]);
  419. }
  420. /**
  421. * Gets offset.
  422. *
  423. * @param integer|string $offset Offset
  424. *
  425. * @return mixed|null
  426. */
  427. #[\ReturnTypeWillChange]
  428. public function offsetGet(mixed $offset)
  429. {
  430. return $this->container[$offset] ?? null;
  431. }
  432. /**
  433. * Sets value based on offset.
  434. *
  435. * @param int|null $offset Offset
  436. * @param mixed $value Value to be set
  437. *
  438. * @return void
  439. */
  440. public function offsetSet($offset, $value): void
  441. {
  442. if (is_null($offset)) {
  443. $this->container[] = $value;
  444. } else {
  445. $this->container[$offset] = $value;
  446. }
  447. }
  448. /**
  449. * Unsets offset.
  450. *
  451. * @param integer|string $offset Offset
  452. *
  453. * @return void
  454. */
  455. public function offsetUnset(mixed $offset): void
  456. {
  457. unset($this->container[$offset]);
  458. }
  459. /**
  460. * Serializes the object to a value that can be serialized natively by json_encode().
  461. * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
  462. *
  463. * @return mixed Returns data which can be serialized by json_encode(), which is a value
  464. * of any type other than a resource.
  465. */
  466. #[\ReturnTypeWillChange]
  467. public function jsonSerialize()
  468. {
  469. return ObjectSerializer::sanitizeForSerialization($this);
  470. }
  471. /**
  472. * Gets the string presentation of the object
  473. *
  474. * @return string
  475. */
  476. public function __toString()
  477. {
  478. return json_encode(
  479. ObjectSerializer::sanitizeForSerialization($this),
  480. JSON_PRETTY_PRINT
  481. );
  482. }
  483. /**
  484. * Gets a header-safe presentation of the object
  485. *
  486. * @return string
  487. */
  488. public function toHeaderValue()
  489. {
  490. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  491. }
  492. }