1: <?php
2:
3: declare(strict_types=1);
4:
5: /*
6: * This file has been auto generated by Jane,
7: *
8: * Do no edit it directly.
9: */
10:
11: namespace NxSys\Library\Clients\Brex\API\Budgets;
12:
13: class Client extends \NxSys\Library\Clients\Brex\API\Budgets\Runtime\Client\Client
14: {
15: /**
16: Lists Budgets belonging to this account
17:
18: *
19: * @param array $queryParameters {
20: *
21: * @var string $cursor
22: * @var int $limit
23: * }
24: *
25: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
26: *
27: * @return \NxSys\Library\Clients\Brex\API\Budgets\Model\PageBudget|\Psr\Http\Message\ResponseInterface|null
28: *
29: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\ListBudgetsBadRequestException
30: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\ListBudgetsUnauthorizedException
31: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\ListBudgetsForbiddenException
32: */
33: public function listBudgets(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
34: {
35: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Budgets\Endpoint\ListBudgets($queryParameters), $fetch);
36: }
37:
38: /**
39: Creates a Budget
40:
41: *
42: * @param \NxSys\Library\Clients\Brex\API\Budgets\Model\CreateBudgetRequest $requestBody
43: * @param array $headerParameters {
44: *
45: * @var string $Idempotency-Key
46: * }
47: *
48: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
49: *
50: * @return \NxSys\Library\Clients\Brex\API\Budgets\Model\Budget|\Psr\Http\Message\ResponseInterface|null
51: *
52: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\CreateBudgetBadRequestException
53: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\CreateBudgetUnauthorizedException
54: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\CreateBudgetForbiddenException
55: */
56: public function createBudget(Model\CreateBudgetRequest $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT)
57: {
58: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Budgets\Endpoint\CreateBudget($requestBody, $headerParameters), $fetch);
59: }
60:
61: /**
62: Retrieves a Budget by ID
63:
64: *
65: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
66: *
67: * @return \NxSys\Library\Clients\Brex\API\Budgets\Model\Budget|\Psr\Http\Message\ResponseInterface|null
68: *
69: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\GetBudgetByIdBadRequestException
70: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\GetBudgetByIdUnauthorizedException
71: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\GetBudgetByIdForbiddenException
72: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\GetBudgetByIdNotFoundException
73: */
74: public function getBudgetById(string $id, string $fetch = self::FETCH_OBJECT)
75: {
76: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Budgets\Endpoint\GetBudgetById($id), $fetch);
77: }
78:
79: /**
80: Updates a Budget
81:
82: *
83: * @param \NxSys\Library\Clients\Brex\API\Budgets\Model\UpdateBudgetRequest $requestBody
84: * @param array $headerParameters {
85: *
86: * @var string $Idempotency-Key
87: * }
88: *
89: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
90: *
91: * @return \NxSys\Library\Clients\Brex\API\Budgets\Model\Budget|\Psr\Http\Message\ResponseInterface|null
92: *
93: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\UpdateBudgetBadRequestException
94: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\UpdateBudgetUnauthorizedException
95: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\UpdateBudgetForbiddenException
96: * @throws \NxSys\Library\Clients\Brex\API\Budgets\Exception\UpdateBudgetNotFoundException
97: */
98: public function updateBudget(string $id, Model\UpdateBudgetRequest $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT)
99: {
100: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Budgets\Endpoint\UpdateBudget($id, $requestBody, $headerParameters), $fetch);
101: }
102:
103: public static function create($httpClient = null, array $additionalPlugins = [], array $additionalNormalizers = [])
104: {
105: if (null === $httpClient) {
106: $httpClient = \Http\Discovery\Psr18ClientDiscovery::find();
107: $plugins = [];
108: $uri = \Http\Discovery\Psr17FactoryDiscovery::findUrlFactory()->createUri('https://platform.brexapis.com');
109: $plugins[] = new \Http\Client\Common\Plugin\AddHostPlugin($uri);
110: if (count($additionalPlugins) > 0) {
111: $plugins = array_merge($plugins, $additionalPlugins);
112: }
113: $httpClient = new \Http\Client\Common\PluginClient($httpClient, $plugins);
114: }
115: $requestFactory = \Http\Discovery\Psr17FactoryDiscovery::findRequestFactory();
116: $streamFactory = \Http\Discovery\Psr17FactoryDiscovery::findStreamFactory();
117: $normalizers = [new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer(), new \NxSys\Library\Clients\Brex\API\Budgets\Normalizer\JaneObjectNormalizer()];
118: if (count($additionalNormalizers) > 0) {
119: $normalizers = array_merge($normalizers, $additionalNormalizers);
120: }
121: $serializer = new \Symfony\Component\Serializer\Serializer($normalizers, [new \Symfony\Component\Serializer\Encoder\JsonEncoder(new \Symfony\Component\Serializer\Encoder\JsonEncode(), new \Symfony\Component\Serializer\Encoder\JsonDecode(['json_decode_associative' => true]))]);
122:
123: return new static($httpClient, $requestFactory, $serializer, $streamFactory);
124: }
125: }
126: