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\Transactions;
12:
13: class Client extends \NxSys\Library\Clients\Brex\API\Transactions\Runtime\Client\Client
14: {
15: /**
16: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
17: *
18: * @return \NxSys\Library\Clients\Brex\API\Transactions\Model\CardAccount[]|\Psr\Http\Message\ResponseInterface|null
19: *
20: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCardAccountsBadRequestException
21: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCardAccountsUnauthorizedException
22: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCardAccountsForbiddenException
23: */
24: public function listCardAccounts(string $fetch = self::FETCH_OBJECT)
25: {
26: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Transactions\Endpoint\ListCardAccounts(), $fetch);
27: }
28:
29: /**
30: This endpoint lists all finalized statements for the primary card account.
31:
32: *
33: * @param array $queryParameters {
34: *
35: * @var string $cursor
36: * @var int $limit
37: * }
38: *
39: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
40: *
41: * @return \NxSys\Library\Clients\Brex\API\Transactions\Model\PageStatement|\Psr\Http\Message\ResponseInterface|null
42: *
43: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListPrimaryCardStatementsBadRequestException
44: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListPrimaryCardStatementsUnauthorizedException
45: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListPrimaryCardStatementsForbiddenException
46: */
47: public function listPrimaryCardStatements(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
48: {
49: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Transactions\Endpoint\ListPrimaryCardStatements($queryParameters), $fetch);
50: }
51:
52: /**
53: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
54: *
55: * @return \NxSys\Library\Clients\Brex\API\Transactions\Model\PageCashAccount|\Psr\Http\Message\ResponseInterface|null
56: *
57: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListAccountsBadRequestException
58: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListAccountsUnauthorizedException
59: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListAccountsForbiddenException
60: */
61: public function listAccounts(string $fetch = self::FETCH_OBJECT)
62: {
63: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Transactions\Endpoint\ListAccounts(), $fetch);
64: }
65:
66: /**
67: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
68: *
69: * @return \NxSys\Library\Clients\Brex\API\Transactions\Model\CashAccount|\Psr\Http\Message\ResponseInterface|null
70: *
71: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\GetPrimaryAccountBadRequestException
72: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\GetPrimaryAccountUnauthorizedException
73: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\GetPrimaryAccountForbiddenException
74: */
75: public function getPrimaryAccount(string $fetch = self::FETCH_OBJECT)
76: {
77: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Transactions\Endpoint\GetPrimaryAccount(), $fetch);
78: }
79:
80: /**
81: This endpoint returns the cash account associated with the provided ID with its status.
82:
83: *
84: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
85: *
86: * @return \NxSys\Library\Clients\Brex\API\Transactions\Model\CashAccount|\Psr\Http\Message\ResponseInterface|null
87: *
88: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\GetAccountBadRequestException
89: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\GetAccountUnauthorizedException
90: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\GetAccountForbiddenException
91: */
92: public function getAccount(string $id, string $fetch = self::FETCH_OBJECT)
93: {
94: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Transactions\Endpoint\GetAccount($id), $fetch);
95: }
96:
97: /**
98: This endpoint lists all finalized statements for the cash account by ID.
99:
100: *
101: * @param array $queryParameters {
102: *
103: * @var string $cursor
104: * @var int $limit
105: * }
106: *
107: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
108: *
109: * @return \NxSys\Library\Clients\Brex\API\Transactions\Model\PageStatement|\Psr\Http\Message\ResponseInterface|null
110: *
111: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashStatementsBadRequestException
112: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashStatementsUnauthorizedException
113: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashStatementsForbiddenException
114: */
115: public function listCashStatements(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
116: {
117: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Transactions\Endpoint\ListCashStatements($id, $queryParameters), $fetch);
118: }
119:
120: /**
121: This endpoint lists all settled transactions for the primary card account.
122: Regular users may only fetch their own "PURCHASE","REFUND" and "CHARGEBACK" settled transactions.
123:
124: *
125: * @param array $queryParameters {
126: *
127: * @var string $cursor
128: * @var int $limit
129: * @var array $user_ids
130: * @var string $posted_at_start
131: * @var array $expand[]
132: * }
133: *
134: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
135: *
136: * @return \NxSys\Library\Clients\Brex\API\Transactions\Model\PageCardTransaction|\Psr\Http\Message\ResponseInterface|null
137: *
138: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListPrimaryCardTransactionsBadRequestException
139: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListPrimaryCardTransactionsUnauthorizedException
140: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListPrimaryCardTransactionsForbiddenException
141: */
142: public function listPrimaryCardTransactions(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
143: {
144: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Transactions\Endpoint\ListPrimaryCardTransactions($queryParameters), $fetch);
145: }
146:
147: /**
148: This endpoint lists all transactions for the cash account with the selected ID.
149:
150: *
151: * @param array $queryParameters {
152: *
153: * @var string $cursor
154: * @var int $limit
155: * @var string $posted_at_start
156: Shows only transactions with a `posted_at_date` on or after this date-time. This parameter is the date-time notation as defined by [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6)
157:
158: * }
159: *
160: * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
161: *
162: * @return \NxSys\Library\Clients\Brex\API\Transactions\Model\PageCashTransaction|\Psr\Http\Message\ResponseInterface|null
163: *
164: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashTransactionsBadRequestException
165: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashTransactionsUnauthorizedException
166: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashTransactionsForbiddenException
167: */
168: public function listCashTransactions(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
169: {
170: return $this->executeEndpoint(new \NxSys\Library\Clients\Brex\API\Transactions\Endpoint\ListCashTransactions($id, $queryParameters), $fetch);
171: }
172:
173: public static function create($httpClient = null, array $additionalPlugins = [], array $additionalNormalizers = [])
174: {
175: if (null === $httpClient) {
176: $httpClient = \Http\Discovery\Psr18ClientDiscovery::find();
177: $plugins = [];
178: $uri = \Http\Discovery\Psr17FactoryDiscovery::findUrlFactory()->createUri('https://platform.brexapis.com');
179: $plugins[] = new \Http\Client\Common\Plugin\AddHostPlugin($uri);
180: if (count($additionalPlugins) > 0) {
181: $plugins = array_merge($plugins, $additionalPlugins);
182: }
183: $httpClient = new \Http\Client\Common\PluginClient($httpClient, $plugins);
184: }
185: $requestFactory = \Http\Discovery\Psr17FactoryDiscovery::findRequestFactory();
186: $streamFactory = \Http\Discovery\Psr17FactoryDiscovery::findStreamFactory();
187: $normalizers = [new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer(), new \NxSys\Library\Clients\Brex\API\Transactions\Normalizer\JaneObjectNormalizer()];
188: if (count($additionalNormalizers) > 0) {
189: $normalizers = array_merge($normalizers, $additionalNormalizers);
190: }
191: $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]))]);
192:
193: return new static($httpClient, $requestFactory, $serializer, $streamFactory);
194: }
195: }
196: