Coverage for packages/clopos/src/integrify/clopos/client.py: 95%

90 statements  

« prev     ^ index     » next       coverage.py v7.16.0, created at 2026-10-19 02:39 +0000

1from collections.abc import Coroutine 

2from datetime import date, datetime 

3from typing import TYPE_CHECKING, Any, Generic, Literal, overload 

4 

5from integrify.api import APIClient, _Async, _Mode, _Sync 

6from integrify.clopos import env 

7from integrify.clopos.handlers import ( 

8 AuthHandler, 

9 CloseReceiptHandler, 

10 CreateCustomerHandler, 

11 CreateOrderHandler, 

12 GetByIDHandler, 

13 GetCategoriesHandler, 

14 GetCategoryByIDHandler, 

15 GetCustomersHandler, 

16 GetOrderByIDHandler, 

17 GetOrdersHandler, 

18 GetPaginatedDataHandler, 

19 GetProductByIDHandler, 

20 GetProductsHandler, 

21 GetReceiptsHandler, 

22 GetReceiptStockOperationsHandler, 

23 GetStationsHandler, 

24 GetStopListHandler, 

25 UpdateClosedReceiptHandler, 

26 UpdateOrderHandler, 

27) 

28from integrify.clopos.schemas.auth.response import AuthResponse 

29from integrify.clopos.schemas.categories.object import Category 

30from integrify.clopos.schemas.common.response import ( 

31 ObjectListResponse, 

32 ObjectResponse, 

33) 

34from integrify.clopos.schemas.customers.object import Customer, Group 

35from integrify.clopos.schemas.customers.request import CustomerFilter 

36from integrify.clopos.schemas.enums import ( 

37 CategoryType, 

38 Gender, 

39 OrderStatus, 

40) 

41from integrify.clopos.schemas.orders.object import Order, OrderPayloadIn 

42from integrify.clopos.schemas.price_lists.object import PriceList, PriceListPrice 

43from integrify.clopos.schemas.products.object import Product, StopList 

44from integrify.clopos.schemas.products.request import GetProducstRequestFilter, StopListFilter 

45from integrify.clopos.schemas.receipts.object import ( 

46 Receipt, 

47 ReceiptStockOperation, 

48) 

49from integrify.clopos.schemas.receipts.request import PaymentMethodIn 

50from integrify.clopos.schemas.sales.object import PaymentMethod, SaleType 

51from integrify.clopos.schemas.stations.object import Station 

52from integrify.clopos.schemas.users.object import User 

53from integrify.clopos.schemas.venues.object import Venue 

54from integrify.schemas import APIResponse 

55from integrify.utils import UNSET, Unset 

56 

57__all__ = ['CloposClientClass', 'CloposRequest', 'CloposAsyncRequest'] 

58 

59 

60class CloposClientClass(APIClient, Generic[_Mode]): 

61 """Base class for CloposClient""" 

62 

63 def __init__( 

64 self, 

65 name='Clopos', 

66 base_url: str | None = env.API.BASE_URL, 

67 default_handler=None, 

68 sync: bool = True, 

69 dry: bool = False, 

70 ): 

71 super().__init__(name, base_url, default_handler, sync, dry) 

72 

73 self.add_url('auth', env.API.AUTH, verb='POST') 

74 self.add_handler('auth', AuthHandler) 

75 

76 self.add_url('get_venues', env.API.VENUES, verb='GET') 

77 self.add_handler('get_venues', GetPaginatedDataHandler(Venue)) 

78 

79 self.add_url('get_users', env.API.USERS, verb='GET') 

80 self.add_handler('get_users', GetPaginatedDataHandler(User)) 

81 self.add_url('get_user_by_id', env.API.USER_BY_ID, verb='GET') 

82 self.add_handler('get_user_by_id', GetByIDHandler(User)) 

83 

84 self.add_url('get_customers', env.API.CUSTOMERS, verb='GET') 

85 self.add_handler('get_customers', GetCustomersHandler) 

86 self.add_url('get_customer_by_id', env.API.CUSTOMER_BY_ID, verb='GET') 

87 self.add_handler('get_customer_by_id', GetByIDHandler(Customer)) 

88 self.add_url('create_customer', env.API.CUSTOMERS, verb='POST') 

89 self.add_handler('create_customer', CreateCustomerHandler) 

90 self.add_url('get_customer_groups', env.API.CUSTOMER_GROUPS, verb='GET') 

91 self.add_handler('get_customer_groups', GetPaginatedDataHandler(Group)) 

92 

93 self.add_url('get_categories', env.API.CATEGORIES, verb='GET') 

94 self.add_handler('get_categories', GetCategoriesHandler) 

95 self.add_url('get_category_by_id', env.API.CATEGORY_BY_ID, verb='GET') 

96 self.add_handler('get_category_by_id', GetCategoryByIDHandler) 

97 

98 self.add_url('get_stations', env.API.STATIONS, verb='GET') 

99 self.add_handler('get_stations', GetStationsHandler) 

100 self.add_url('get_station_by_id', env.API.STATION_BY_ID, verb='GET') 

101 self.add_handler('get_station_by_id', GetByIDHandler(Station)) 

102 

103 self.add_url('get_products', env.API.PRODUCTS, verb='GET') 

104 self.add_handler('get_products', GetProductsHandler) 

105 self.add_url('get_product_by_id', env.API.PRODUCT_BY_ID, verb='GET') 

106 self.add_handler('get_product_by_id', GetProductByIDHandler) 

107 self.add_url('get_stop_list', env.API.STOP_LIST, verb='GET') 

108 self.add_handler('get_stop_list', GetStopListHandler) 

109 

110 self.add_url('get_sale_types', env.API.SALE_TYPES, verb='GET') 

111 self.add_handler('get_sale_types', GetPaginatedDataHandler(SaleType)) 

112 self.add_url('get_payment_methods', env.API.PAYMENT_METHODS, verb='GET') 

113 self.add_handler('get_payment_methods', GetPaginatedDataHandler(PaymentMethod)) 

114 

115 self.add_url('get_orders', env.API.ORDERS, verb='GET') 

116 self.add_handler('get_orders', GetOrdersHandler) 

117 self.add_url('get_order_by_id', env.API.ORDER_BY_ID, verb='GET') 

118 self.add_handler('get_order_by_id', GetOrderByIDHandler) 

119 self.add_url('create_order', env.API.ORDERS, verb='POST') 

120 self.add_handler('create_order', CreateOrderHandler) 

121 self.add_url('update_order', env.API.ORDER_BY_ID, verb='PUT') 

122 self.add_handler('update_order', UpdateOrderHandler) 

123 

124 self.add_url('get_receipts', env.API.RECEIPTS, verb='GET') 

125 self.add_handler('get_receipts', GetReceiptsHandler) 

126 self.add_url('get_receipt_by_id', env.API.RECEIPT_BY_ID, verb='GET') 

127 self.add_handler('get_receipt_by_id', GetByIDHandler(Receipt)) 

128 self.add_url('update_closed_receipt', env.API.RECEIPT_BY_ID, verb='PATCH') 

129 self.add_handler('update_closed_receipt', UpdateClosedReceiptHandler) 

130 self.add_url('close_receipt', env.API.RECEIPT_CLOSE, verb='POST') 

131 self.add_handler('close_receipt', CloseReceiptHandler) 

132 self.add_url('get_receipt_stock_operations', env.API.RECEIPT_STOCK_OPERATIONS, verb='GET') 

133 self.add_handler('get_receipt_stock_operations', GetReceiptStockOperationsHandler) 

134 

135 self.add_url('get_price_lists', env.API.PRICE_LISTS, verb='GET') 

136 self.add_handler('get_price_lists', GetPaginatedDataHandler(PriceList)) 

137 self.add_url('get_price_list_prices', env.API.PRICE_LIST_PRICES, verb='GET') 

138 self.add_handler('get_price_list_prices', GetPaginatedDataHandler(PriceListPrice)) 

139 

140 def _build_request_lambda(self, func, url, verb, handler): 

141 # No headers needed in auth 

142 if url.endswith(env.API.AUTH): 

143 return super()._build_request_lambda(func, url, verb, handler) 

144 

145 return lambda *args, headers, **kwds: func( 

146 url, 

147 verb, 

148 handler, 

149 *(arg for arg in args if arg is not UNSET), 

150 headers=headers, 

151 **{k: v for k, v in kwds.items() if v is not UNSET}, 

152 ) 

153 

154 if TYPE_CHECKING: 

155 # pylint: disable=all 

156 @overload 

157 def auth( 

158 self: 'CloposClientClass[_Sync]', 

159 client_id: Unset[str] = UNSET, 

160 client_secret: Unset[str] = UNSET, 

161 brand: Unset[str] = UNSET, 

162 integrator_id: Unset[str] = UNSET, 

163 ) -> APIResponse[AuthResponse]: 

164 """Exchange your client credentials for a short-lived access token that authorizes all other API requests. 

165 

166 

167 **Endpoint**: `POST /open-api/v2/auth` 

168 

169 Example: 

170 ```python 

171 from integrify.clopos import CloposClient 

172 

173 CloposClient.auth( 

174 client_id='eNUKI04aYJRU6TBhh5bwUrvmEORgQoxM', 

175 client_secret='dqYkWUpDjzvKOgbP3ar8tSNKJbwMyYe1V5R7DHClfSNYkap5C5XxRA6PmzoPv1I2', 

176 brand='openapitest', 

177 integrator_id='1' 

178 ) 

179 

180 # Or if you have set the environment variables 

181 CloposClient.auth(headers={'x-token': 'token'}) 

182 ``` 

183 

184 **Response format: [`AuthResponse`][integrify.clopos.schemas.auth.response.AuthResponse]** 

185 

186 This request returns you a token for subsequent API calls which is valid for one hour. 

187 

188 Args: 

189 client_id: Client ID provided by Clopos. Can be set in environment variable `CLOPOS_CLIENT_ID` 

190 client_secret: Client secret provided by Clopos. Can be set in environment variable `CLOPOS_CLIENT_SECRET` 

191 brand: Brand you want to authenticate. Can be set in environment variable `CLOPOS_BRAND` 

192 integrator_id: Integrator ID provided by Clopos. Can be set in environment variable `CLOPOS_INTEGRATOR_ID` 

193 """ # noqa: E501 

194 

195 @overload 

196 def auth( 

197 self: 'CloposClientClass[_Async]', 

198 client_id: Unset[str] = UNSET, 

199 client_secret: Unset[str] = UNSET, 

200 brand: Unset[str] = UNSET, 

201 integrator_id: Unset[str] = UNSET, 

202 ) -> Coroutine[Any, Any, APIResponse[AuthResponse]]: ... 

203 def auth(self, *args: Any, **kwds: Any) -> Any: ... 

204 

205 @overload 

206 def get_venues( 

207 self: 'CloposClientClass[_Sync]', 

208 page: Unset[int] = UNSET, 

209 limit: Unset[int] = UNSET, 

210 *, 

211 headers: Unset[dict[str, str]] = UNSET, 

212 ) -> APIResponse[ObjectListResponse[Venue]]: 

213 """Allows you to quickly retrieve active branches connected to your brand to initiate location-based operations. 

214 

215 **Endpoint**: `GET /open-api/venues` 

216 

217 Example: 

218 ```python 

219 from integrify.clopos import CloposClient 

220 

221 CloposClient.get_venues(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

222 

223 # Or if you have set the environment variables 

224 CloposClient.get_venues(headers={'x-token': 'token'}) 

225 ``` 

226 

227 **Response format: [`ObjectListResponse[Venue]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

228 

229 Args: 

230 page: Page number for pagination (starts at 1) 

231 limit: Maximum number of objects to return (1-100) 

232 headers: Headers for request 

233 ``` 

234 """ # noqa: E501 

235 

236 @overload 

237 def get_venues( 

238 self: 'CloposClientClass[_Async]', 

239 page: Unset[int] = UNSET, 

240 limit: Unset[int] = UNSET, 

241 *, 

242 headers: Unset[dict[str, str]] = UNSET, 

243 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[Venue]]]: ... 

244 def get_venues(self, *args: Any, **kwds: Any) -> Any: ... 

245 

246 @overload 

247 def get_users( 

248 self: 'CloposClientClass[_Sync]', 

249 page: Unset[int] = UNSET, 

250 limit: Unset[int] = UNSET, 

251 *, 

252 headers: Unset[dict[str, str]] = UNSET, 

253 ) -> APIResponse[ObjectListResponse[User]]: 

254 """Use this endpoint to inspect staff accounts, roles, and access levels across your venues. 

255 

256 **Endpoint**: `GET /open-api/users` 

257 

258 Example: 

259 ```python 

260 from integrify.clopos import CloposClient 

261 

262 CloposClient.get_users(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

263 

264 # Or if you have set the environment variables 

265 CloposClient.get_users(headers={'x-token': 'token'}) 

266 ``` 

267 

268 **Response format: [`ObjectListResponse[User]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

269 

270 Args: 

271 page: Page number for pagination (starts at 1) 

272 limit: Maximum number of objects to return (1-100) 

273 headers: Headers for request 

274 ``` 

275 """ # noqa: E501 

276 

277 @overload 

278 def get_users( 

279 self: 'CloposClientClass[_Async]', 

280 page: Unset[int] = UNSET, 

281 limit: Unset[int] = UNSET, 

282 *, 

283 headers: Unset[dict[str, str]] = UNSET, 

284 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[User]]]: ... 

285 def get_users(self, *args: Any, **kwds: Any) -> Any: ... 

286 

287 @overload 

288 def get_user_by_id( 

289 self: 'CloposClientClass[_Sync]', 

290 id: int, 

291 *, 

292 headers: Unset[dict[str, str]] = UNSET, 

293 ) -> APIResponse[ObjectResponse[User]]: 

294 """Retrieve a specific user by their unique identifier. 

295 

296 **Endpoint**: `GET /open-api/users/{id}` 

297 

298 Example: 

299 ```python 

300 from integrify.clopos import CloposClient 

301 

302 CloposClient.get_user_by_id(1, headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

303 

304 # Or if you have set the environment variables 

305 CloposClient.get_user_by_id(id=1, headers={'x-token': 'token'}) 

306 ``` 

307 

308 **Response format: [`ObjectResponse[User]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

309 

310 Args: 

311 id: User ID 

312 headers: Headers for request 

313 ``` 

314 """ # noqa: E501 

315 

316 @overload 

317 def get_user_by_id( 

318 self: 'CloposClientClass[_Async]', 

319 id: int, 

320 *, 

321 headers: Unset[dict[str, str]] = UNSET, 

322 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[User]]]: ... 

323 def get_user_by_id(self, *args: Any, **kwds: Any) -> Any: ... 

324 

325 @overload 

326 def get_customers( 

327 self: 'CloposClientClass[_Sync]', 

328 page: Unset[int] = 1, 

329 limit: Unset[int] = 20, 

330 with_: Unset[list[str]] = UNSET, 

331 filters: Unset[list[CustomerFilter]] = UNSET, 

332 *, 

333 headers: Unset[dict[str, str]] = UNSET, 

334 ) -> APIResponse[ObjectListResponse[Customer]]: 

335 """Retrieve all customers with optional search, pagination, filtering, and relationship inclusion 

336 

337 **Endpoint**: `GET /open-api/customers` 

338 

339 Example: 

340 ```python 

341 from integrify.clopos import CloposClient 

342 

343 CloposClient.get_customers(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

344 

345 # Or if you have set the environment variables 

346 CloposClient.get_customers(headers={'x-token': 'token'}) 

347 ``` 

348 

349 **Response format: [`ObjectListResponse[Customer]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

350 

351 Args: 

352 page: Page number for pagination (starts at 1) 

353 limit: Maximum number of objects to return (1-100) 

354 with_: Include related data in the response. Supported values: `group`, `balance`, cashback_balance. You can include multiple with parameters. 

355 filters: List of filters to apply in format {'by': 'name'|'phones'|'group_id', 'value': str} 

356 headers: Headers for request 

357 ``` 

358 """ # noqa: E501 

359 

360 @overload 

361 def get_customers( 

362 self: 'CloposClientClass[_Async]', 

363 page: Unset[int] = 1, 

364 limit: Unset[int] = 20, 

365 with_: Unset[list[str]] = UNSET, 

366 filters: Unset[list[CustomerFilter]] = UNSET, 

367 *, 

368 headers: Unset[dict[str, str]] = UNSET, 

369 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[Customer]]]: ... 

370 def get_customers(self, *args: Any, **kwds: Any) -> Any: ... 

371 

372 @overload 

373 def get_customer_by_id( 

374 self: 'CloposClientClass[_Sync]', 

375 id: int, 

376 *, 

377 headers: Unset[dict[str, str]] = UNSET, 

378 ) -> APIResponse[ObjectResponse[Customer]]: 

379 """Retrieve a specific customer by their unique identifier. 

380 

381 **Endpoint**: `GET /open-api/customers/{id}` 

382 

383 Example: 

384 ```python 

385 from integrify.clopos import CloposClient 

386 

387 CloposClient.get_customer_by_id(1, headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

388 

389 # Or if you have set the environment variables 

390 CloposClient.get_customer_by_id(id=1, headers={'x-token': 'token'}) 

391 ``` 

392 

393 **Response format: [`ObjectResponse[Customer]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

394 

395 Args: 

396 id: Customer ID 

397 headers: Headers for request 

398 ``` 

399 """ # noqa: E501 

400 

401 @overload 

402 def get_customer_by_id( 

403 self: 'CloposClientClass[_Async]', 

404 id: int, 

405 *, 

406 headers: Unset[dict[str, str]] = UNSET, 

407 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[Customer]]]: ... 

408 def get_customer_by_id(self, *args: Any, **kwds: Any) -> Any: ... 

409 

410 @overload 

411 def create_customer( 

412 self: 'CloposClientClass[_Sync]', 

413 name: str, 

414 email: Unset[str] = UNSET, 

415 phone: Unset[str] = UNSET, 

416 code: Unset[str] = UNSET, 

417 cid: Unset[str] = UNSET, 

418 description: Unset[str] = UNSET, 

419 group_id: Unset[int] = UNSET, 

420 gender: Unset[Gender] = UNSET, 

421 date_of_birth: Unset[str | date] = UNSET, 

422 header: Unset[dict[str, str]] = UNSET, 

423 ) -> APIResponse[ObjectResponse[Customer]]: 

424 """Create a new customer with contact information and group assignment 

425 

426 **Endpoint**: `POST /open-api/customers` 

427 

428 Example: 

429 ```python 

430 from integrify.clopos import CloposClient 

431 

432 CloposClient.create_customer(name='John Doe', email='random@example.com', headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

433 

434 # Or if you have set the environment variables 

435 CloposClient.create_customer(name='John Doe', email='random@example.com', headers={'x-token': 'token'}) 

436 ``` 

437 

438 **Response format: [`ObjectResponse[Customer]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

439 

440 Args: 

441 name: Customer name 

442 email: Customer email 

443 phone: Customer phone (must be unique) 

444 code: Customer code (must be unique) 

445 cid: Customer CID 

446 description: Customer description 

447 group_id: Customer group ID 

448 gender: Customer gender 

449 date_of_birth: Customer date of birth in format YYYY-MM-DD 

450 header: Headers for request 

451 ``` 

452 """ # noqa: E501 

453 

454 @overload 

455 def create_customer( 

456 self: 'CloposClientClass[_Async]', 

457 name: str, 

458 email: Unset[str] = UNSET, 

459 phone: Unset[str] = UNSET, 

460 code: Unset[str] = UNSET, 

461 cid: Unset[str] = UNSET, 

462 description: Unset[str] = UNSET, 

463 group_id: Unset[int] = UNSET, 

464 gender: Unset[Gender] = UNSET, 

465 date_of_birth: Unset[str | date] = UNSET, 

466 header: Unset[dict[str, str]] = UNSET, 

467 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[Customer]]]: ... 

468 def create_customer(self, *args: Any, **kwds: Any) -> Any: ... 

469 

470 @overload 

471 def get_customer_groups( 

472 self: 'CloposClientClass[_Sync]', 

473 page: Unset[int] = UNSET, 

474 limit: Unset[int] = UNSET, 

475 *, 

476 headers: Unset[dict[str, str]] = UNSET, 

477 ) -> APIResponse[ObjectListResponse[Group]]: 

478 """Retrieve a list of all customer groups with pagination support. 

479 

480 **Endpoint**: `GET /open-api/customer-groups` 

481 

482 Example: 

483 ```python 

484 from integrify.clopos import CloposClient 

485 

486 CloposClient.get_customer_groups(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

487 

488 # Or if you have set the environment variables 

489 CloposClient.get_customer_groups(headers={'x-token': 'token'}) 

490 ``` 

491 

492 **Response format: [`ObjectListResponse[Group]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

493 

494 Args: 

495 page: Page number for pagination (starts at 1) 

496 limit: Maximum number of objects to return (1-100) 

497 headers: Headers for request 

498 ``` 

499 """ # noqa: E501 

500 

501 @overload 

502 def get_customer_groups( 

503 self: 'CloposClientClass[_Async]', 

504 page: Unset[int] = UNSET, 

505 limit: Unset[int] = UNSET, 

506 *, 

507 headers: Unset[dict[str, str]] = UNSET, 

508 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[Group]]]: ... 

509 def get_customer_groups(self, *args: Any, **kwds: Any) -> Any: ... 

510 

511 @overload 

512 def get_categories( 

513 self: 'CloposClientClass[_Sync]', 

514 page: Unset[int] = 1, 

515 limit: Unset[int] = 50, 

516 parent_id: Unset[int] = UNSET, 

517 type: Unset[CategoryType] = UNSET, 

518 include_children: Unset[bool] = True, 

519 include_inactive: Unset[bool] = False, 

520 *, 

521 headers: Unset[dict[str, str]] = UNSET, 

522 ) -> APIResponse[ObjectListResponse[Category]]: 

523 """Retrieve product categories along with their hierarchical structure 

524 

525 **Endpoint**: `GET /open-api/categories` 

526 

527 Example: 

528 ```python 

529 from integrify.clopos import CloposClient 

530 

531 CloposClient.get_categories(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

532 

533 # Or if you have set the environment variables 

534 CloposClient.get_categories(headers={'x-token': 'token'}) 

535 ``` 

536 

537 **Response format: [`ObjectListResponse[Category]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

538 

539 Args: 

540 page: Page number for pagination (starts at 1) 

541 limit: Number of categories to return (1-999) 

542 parent_id: Filters records under a specific parent category 

543 type: Category type; PRODUCT, INGREDIENT, ACCOUNTING 

544 include_children: Include child categories in the response 

545 include_inactive: Include inactive categories 

546 headers: Headers for request 

547 ``` 

548 """ # noqa: E501 

549 

550 @overload 

551 def get_categories( 

552 self: 'CloposClientClass[_Async]', 

553 page: Unset[int] = 1, 

554 limit: Unset[int] = 50, 

555 parent_id: Unset[int] = UNSET, 

556 type: Unset[CategoryType] = UNSET, 

557 include_children: Unset[bool] = True, 

558 include_inactive: Unset[bool] = False, 

559 *, 

560 headers: Unset[dict[str, str]] = UNSET, 

561 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[Category]]]: ... 

562 def get_categories(self, *args: Any, **kwds: Any) -> Any: ... 

563 

564 @overload 

565 def get_category_by_id( 

566 self: 'CloposClientClass[_Sync]', 

567 id: int, 

568 *, 

569 headers: Unset[dict[str, str]] = UNSET, 

570 ) -> APIResponse[ObjectResponse[Category]]: 

571 """Retrieve a specific menu category with its hierarchical details 

572 

573 **Endpoint**: `GET /open-api/categories/{id}` 

574 

575 Example: 

576 ```python 

577 from integrify.clopos import CloposClient 

578 

579 CloposClient.get_category_by_id(1, headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

580 

581 # Or if you have set the environment variables 

582 CloposClient.get_category_by_id(id=1, headers={'x-token': 'token'}) 

583 ``` 

584 

585 **Response format: [`ObjectResponse[Category]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

586 

587 Args: 

588 id: Category ID 

589 headers: Headers for request 

590 ``` 

591 """ # noqa: E501 

592 

593 @overload 

594 def get_category_by_id( 

595 self: 'CloposClientClass[_Async]', 

596 id: int, 

597 *, 

598 headers: Unset[dict[str, str]] = UNSET, 

599 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[Category]]]: ... 

600 def get_category_by_id(self, *args: Any, **kwds: Any) -> Any: ... 

601 

602 @overload 

603 def get_stations( 

604 self: 'CloposClientClass[_Sync]', 

605 page: Unset[int] = 1, 

606 limit: Unset[int] = 50, 

607 status: Unset[int] = UNSET, 

608 can_print: Unset[bool] = UNSET, 

609 *, 

610 headers: Unset[dict[str, str]] = UNSET, 

611 ) -> APIResponse[ObjectListResponse[Station]]: 

612 """Retrieve all preparation and service stations 

613 

614 **Endpoint**: `GET /open-api/stations` 

615 

616 Example: 

617 ```python 

618 from integrify.clopos import CloposClient 

619 

620 CloposClient.get_stations(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

621 

622 # Or if you have set the environment variables 

623 CloposClient.get_stations(headers={'x-token': 'token'}) 

624 ``` 

625 

626 **Response format: [`ObjectListResponse[Station]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

627 

628 Args: 

629 page: Page number for pagination (starts at 1) 

630 limit: Maximum number of objects to return (1-200) 

631 status: Filter by station status (`1` = active, `0` = inactive) 

632 can_print: Filter stations that can redirect to a printer. 

633 headers: Headers for request 

634 ``` 

635 """ # noqa: E501 

636 

637 @overload 

638 def get_stations( 

639 self: 'CloposClientClass[_Async]', 

640 page: Unset[int] = 1, 

641 limit: Unset[int] = 50, 

642 status: Unset[int] = UNSET, 

643 can_print: Unset[bool] = UNSET, 

644 *, 

645 headers: Unset[dict[str, str]] = UNSET, 

646 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[Station]]]: ... 

647 def get_stations(self, *args: Any, **kwds: Any) -> Any: ... 

648 

649 @overload 

650 def get_station_by_id( 

651 self: 'CloposClientClass[_Sync]', 

652 id: int, 

653 *, 

654 headers: Unset[dict[str, str]] = UNSET, 

655 ) -> APIResponse[ObjectResponse[Station]]: 

656 """Retrieve a specific preparation or service station 

657 

658 **Endpoint**: `GET /open-api/stations/{id}` 

659 

660 Example: 

661 ```python 

662 from integrify.clopos import CloposClient 

663 

664 CloposClient.get_station_by_id(1, headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

665 

666 # Or if you have set the environment variables 

667 CloposClient.get_station_by_id(id=1, headers={'x-token': 'token'}) 

668 ``` 

669 

670 **Response format: [`ObjectResponse[Station]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

671 

672 Args: 

673 id: Station ID 

674 headers: Headers for request 

675 ``` 

676 """ # noqa: E501 

677 

678 @overload 

679 def get_station_by_id( 

680 self: 'CloposClientClass[_Async]', 

681 id: int, 

682 *, 

683 headers: Unset[dict[str, str]] = UNSET, 

684 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[Station]]]: ... 

685 def get_station_by_id(self, *args: Any, **kwds: Any) -> Any: ... 

686 

687 @overload 

688 def get_products( 

689 self: 'CloposClientClass[_Sync]', 

690 page: Unset[int] = 1, 

691 limit: Unset[int] = 50, 

692 selects: Unset[str | list[str]] = UNSET, 

693 filters: Unset[GetProducstRequestFilter] = UNSET, 

694 *, 

695 headers: Unset[dict[str, str]] = UNSET, 

696 ) -> APIResponse[ObjectListResponse[Product]]: 

697 """Get the product catalog with advanced filtering and pagination. 

698 

699 **Endpoint**: `GET /open-api/products` 

700 

701 Example: 

702 ```python 

703 from integrify.clopos import CloposClient 

704 

705 CloposClient.get_products(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

706 

707 # Or if you have set the environment variables 

708 CloposClient.get_products(headers={'x-token': 'token'}) 

709 ``` 

710 

711 **Response format: [`ObjectListResponse[Product]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

712 

713 Args: 

714 page: Page number for pagination (starts at 1) 

715 limit: Maximum number of objects to return (1-100) 

716 selects: Comma-separated string OR list of fields to include in the response. The fields id, name, and type are always included regardless of this parameter. \ 

717 Example: selects=id,name,type,price,image 

718 filters: 

719 - type: Filters by product type. Possible values: GOODS, DISH, TIMER, PREPARATION, INGREDIENT 

720 - category_id: Lists products belonging to the specified category IDs 

721 - station_id: Retrieves products assigned to the specified station IDs 

722 - tags: Filters for products with the specified tag IDs 

723 - giftable: Filters for products that are ("1") or are not giftable. Possible values: 1, 0, true, false 

724 - discountable: Filters for products that are ("1") or are not discountable. Possible values: 1, 0, true, false 

725 - inventory_behavior: Filters by inventory behavior mode (e.g., "3") 

726 - have_ingredients: Retrieves products that have a recipe/ingredients ("1"). Possible values: 1, 0, true, false 

727 - sold_by_portion: Lists products sold by portion ("1"). Possible values: 1, 0, true, false 

728 - has_variants: Lists products that have variants (modifications) ("1"). Possible values: 1, 0, true, false 

729 - has_modifiers: Retrieves products that have a modifier group (modificator_groups) ("1"). Possible values: 1, 0, true, false 

730 - has_barcode: Retrieves products that have a barcode ("1"). Possible values: 1, 0, true, false 

731 - has_service_charge: Lists products to which a service charge applies ("1"). Possible values: 1, 0, true, false 

732 headers: Headers for request 

733 ``` 

734 """ # noqa: E501 

735 

736 @overload 

737 def get_products( 

738 self: 'CloposClientClass[_Async]', 

739 page: Unset[int] = 1, 

740 limit: Unset[int] = 50, 

741 selects: Unset[str | list[str]] = UNSET, 

742 filters: Unset[GetProducstRequestFilter] = UNSET, 

743 *, 

744 headers: Unset[dict[str, str]] = UNSET, 

745 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[Product]]]: ... 

746 def get_products(self, *args: Any, **kwds: Any) -> Any: ... 

747 

748 @overload 

749 def get_product_by_id( 

750 self: 'CloposClientClass[_Sync]', 

751 id: int, 

752 with_: Unset[list[str]] = UNSET, 

753 *, 

754 headers: Unset[dict[str, str]] = UNSET, 

755 ) -> APIResponse[ObjectResponse[Product]]: 

756 """Retrieve a single product with type-specific details. 

757 

758 **Endpoint**: `GET /open-api/products/{id}` 

759 

760 Example: 

761 ```python 

762 from integrify.clopos import CloposClient 

763 

764 CloposClient.get_product_by_id(1, headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

765 

766 # Or if you have set the environment variables 

767 CloposClient.get_product_by_id(id=1, headers={'x-token': 'token'}) 

768 ``` 

769 

770 **Response format: [`ObjectResponse[Product]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

771 

772 Args: 

773 id: Product ID 

774 with_: Related data selector. Example: taxes, unit, modifications, modificator_groups, recipe, packages, media, tags, setting. You can include multiple with parameters 

775 headers: Headers for request 

776 ``` 

777 """ # noqa: E501 

778 

779 @overload 

780 def get_product_by_id( 

781 self: 'CloposClientClass[_Async]', 

782 id: int, 

783 with_: Unset[list[str]] = UNSET, 

784 *, 

785 headers: Unset[dict[str, str]] = UNSET, 

786 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[Product]]]: ... 

787 def get_product_by_id(self, *args: Any, **kwds: Any) -> Any: ... 

788 

789 @overload 

790 def get_stop_list( 

791 self: 'CloposClientClass[_Sync]', 

792 filters: Unset[list[StopListFilter]] = UNSET, 

793 *, 

794 headers: Unset[dict[str, str]] = UNSET, 

795 ) -> APIResponse[ObjectListResponse[StopList]]: 

796 """Get stop list data for specific products. 

797 

798 You can filter by multiple parameters at once. For that have order of your lists in check. 

799 

800 **Endpoint**: `GET /open-api/products/stop-list` 

801 

802 Example: 

803 ```python 

804 from integrify.clopos import CloposClient 

805 

806 CloposClient.get_stop_list(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

807 

808 # Or if you have set the environment variables 

809 CloposClient.get_stop_list( 

810 filters=[ 

811 {'by': 'id', 'from_': '0', 'to': '100'}, 

812 {'by': 'limit', 'from_': '1', 'to': '10'}, 

813 ] 

814 headers={'x-token': token}, 

815 ) # Filter by id from 0 to 100 AND limit from 1 to 10 

816 ``` 

817 

818 **Response format: [`ObjectListResponse[StopList]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

819 

820 Args: 

821 filters: List of filter options. Each filter is a dict with keys 'by', 'from_', and 'to'. 

822 headers: Headers for request 

823 ``` 

824 """ # noqa: E501 

825 

826 @overload 

827 def get_stop_list( 

828 self: 'CloposClientClass[_Async]', 

829 filters: Unset[list[StopListFilter]] = UNSET, 

830 *, 

831 headers: Unset[dict[str, str]] = UNSET, 

832 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[StopList]]]: ... 

833 def get_stop_list(self, *args: Any, **kwds: Any) -> Any: ... 

834 

835 @overload 

836 def get_sale_types( 

837 self: 'CloposClientClass[_Sync]', 

838 page: Unset[int] = 1, 

839 limit: Unset[int] = 20, 

840 *, 

841 headers: Unset[dict[str, str]] = UNSET, 

842 ) -> APIResponse[ObjectListResponse[SaleType]]: 

843 """Retrieve a list of all available sale types. 

844 

845 **Endpoint**: `GET /open-api/sale-types` 

846 

847 Example: 

848 ```python 

849 from integrify.clopos import CloposClient 

850 

851 CloposClient.get_sale_types(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

852 

853 # Or if you have set the environment variables 

854 CloposClient.get_sale_types(headers={'x-token': 'token'}) 

855 ``` 

856 

857 Used by: 

858 Create Order: provide payload.service.sale_type_id and payload.service.venue_id 

859 Create Receipt: optionally include sale_type_id or meta.sale_type 

860 

861 **Response format: [`ObjectListResponse[SaleType]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

862 

863 Args: 

864 page: Page number for pagination (starts at 1) 

865 limit: Maximum number of objects to return (1-100) 

866 headers: Headers for request 

867 ``` 

868 """ # noqa: E501 

869 

870 @overload 

871 def get_sale_types( 

872 self: 'CloposClientClass[_Async]', 

873 page: Unset[int] = 1, 

874 limit: Unset[int] = 20, 

875 *, 

876 headers: Unset[dict[str, str]] = UNSET, 

877 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[SaleType]]]: ... 

878 def get_sale_types(self, *args: Any, **kwds: Any) -> Any: ... 

879 

880 @overload 

881 def get_payment_methods( 

882 self: 'CloposClientClass[_Sync]', 

883 page: Unset[int] = 1, 

884 limit: Unset[int] = 20, 

885 *, 

886 headers: Unset[dict[str, str]] = UNSET, 

887 ) -> APIResponse[ObjectListResponse[PaymentMethod]]: 

888 """Retrieve a list of all configured payment methods. 

889 

890 **Endpoint**: `GET /open-api/payment-methods` 

891 

892 Example: 

893 ```python 

894 from integrify.clopos import CloposClient 

895 

896 CloposClient.get_payment_methods(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

897 

898 # Or if you have set the environment variables 

899 CloposClient.get_payment_methods(headers={'x-token': 'token'}) 

900 ``` 

901 

902 **Response format: [`ObjectListResponse[PaymentMethod]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

903 

904 Args: 

905 page: Page number for pagination (starts at 1) 

906 limit: Maximum number of objects to return (1-100) 

907 headers: Headers for request 

908 ``` 

909 """ # noqa: E501 

910 

911 @overload 

912 def get_payment_methods( 

913 self: 'CloposClientClass[_Async]', 

914 page: Unset[int] = 1, 

915 limit: Unset[int] = 20, 

916 *, 

917 headers: Unset[dict[str, str]] = UNSET, 

918 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[PaymentMethod]]]: ... 

919 def get_payment_methods(self, *args: Any, **kwds: Any) -> Any: ... 

920 

921 @overload 

922 def get_orders( 

923 self: 'CloposClientClass[_Sync]', 

924 page: Unset[int] = 1, 

925 limit: Unset[int] = 20, 

926 status: Unset[OrderStatus] = UNSET, 

927 *, 

928 headers: Unset[dict[str, str]] = UNSET, 

929 ) -> APIResponse[ObjectListResponse[Order]]: 

930 """Retrieve orders with replicable filters and status-based searches 

931 

932 **Endpoint**: `GET /open-api/orders` 

933 

934 Example: 

935 ```python 

936 from integrify.clopos import CloposClient 

937 

938 CloposClient.get_orders(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

939 

940 # Or if you have set the environment variables 

941 CloposClient.get_orders(headers={'x-token': 'token'}) 

942 ``` 

943 

944 **Response format: [`ObjectListResponse[Order]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

945 

946 Args: 

947 page: Page number for pagination (starts at 1) 

948 limit: Maximum number of objects to return (1-100) 

949 status: Filter by order status 

950 headers: Headers for request 

951 ``` 

952 """ # noqa: E501 

953 

954 @overload 

955 def get_orders( 

956 self: 'CloposClientClass[_Async]', 

957 page: Unset[int] = 1, 

958 limit: Unset[int] = 20, 

959 status: Unset[OrderStatus] = UNSET, 

960 *, 

961 headers: Unset[dict[str, str]] = UNSET, 

962 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[Order]]]: ... 

963 def get_orders(self, *args: Any, **kwds: Any) -> Any: ... 

964 

965 @overload 

966 def get_order_by_id( 

967 self: 'CloposClientClass[_Sync]', 

968 id: int, 

969 with_: Unset[Literal['receipt:id', 'service_notification_id', 'status']] = UNSET, 

970 *, 

971 headers: Unset[dict[str, str]] = UNSET, 

972 ) -> APIResponse[ObjectResponse[Order]]: 

973 """Retrieve a single order with status, customer, and line item details. 

974 

975 **Endpoint**: `GET /open-api/orders/{id}` 

976 

977 Example: 

978 ```python 

979 from integrify.clopos import CloposClient 

980 

981 CloposClient.get_order_by_id(1, headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

982 

983 # Or if you have set the environment variables 

984 CloposClient.get_order_by_id(id=1, headers={'x-token': 'token'}) 

985 ``` 

986 

987 **Response format: [`ObjectResponse[Order]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

988 

989 Args: 

990 id: Order ID 

991 with_: Include related resources in the response. Currently supported: receipt:id,service_notification_id,status. \ 

992 When included, the data.receipt field will be present in the response (or null if no receipt exists for the order). 

993 headers: Headers for request 

994 ``` 

995 """ # noqa: E501 

996 

997 @overload 

998 def get_order_by_id( 

999 self: 'CloposClientClass[_Async]', 

1000 id: int, 

1001 with_: Unset[Literal['receipt:id', 'service_notification_id', 'status']] = UNSET, 

1002 *, 

1003 headers: Unset[dict[str, str]] = UNSET, 

1004 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[Order]]]: ... 

1005 def get_order_by_id(self, *args: Any, **kwds: Any) -> Any: ... 

1006 

1007 @overload 

1008 def create_order( 

1009 self: 'CloposClientClass[_Sync]', 

1010 customer_id: int, 

1011 payload: OrderPayloadIn, 

1012 meta: Unset[dict] = UNSET, 

1013 *, 

1014 headers: Unset[dict[str, str]] = UNSET, 

1015 ) -> APIResponse[ObjectResponse[Order]]: 

1016 """Create a new order with product line items and customer information 

1017 

1018 **Endpoint**: `POST /open-api/orders` 

1019 

1020 Example: 

1021 ```python 

1022 from integrify.clopos import CloposClient 

1023 

1024 data = { 

1025 'customer_id': 1, 

1026 'payload': { 

1027 'service': { 

1028 'sale_type_id': 2, 

1029 'sale_type_name': 'Delivery', 

1030 'venue_id': 1, 

1031 'venue_name': 'Main', 

1032 }, 

1033 'customer': { 

1034 'id': 9, 

1035 'name': 'Rahid Akhundzada', 

1036 'customer_discount_type': 1, 

1037 'phone': '+994705401040', 

1038 }, 

1039 'products': [ 

1040 { 

1041 'product_id': 1, 

1042 'count': 1, 

1043 'product_modificators': [ 

1044 {'modificator_id': 187, 'count': 1}, 

1045 {'modificator_id': 201, 'count': 1}, 

1046 ], 

1047 'meta': { 

1048 'price': 0, 

1049 'order_product': { 

1050 'product': { 

1051 'id': 1, 

1052 'name': 'Mega Dürüm Menü Alana Çiğ Köfte Dürüm', 

1053 'category_id': 1, 

1054 'station_id': 1, 

1055 'price': 0, 

1056 }, 

1057 'count': 1, 

1058 'status': 'completed', 

1059 'product_modificators': [ 

1060 {'modificator_id': 187, 'count': 1}, 

1061 {'modificator_id': 201, 'count': 1}, 

1062 ], 

1063 'product_hash': 'MTExODcsMTEyMDE=', 

1064 }, 

1065 }, 

1066 } 

1067 ], 

1068 }, 

1069 'meta': { 

1070 'comment': '', 

1071 'discount': {'discount_type': 1, 'discount_value': 10}, 

1072 'orderTotal': '16.2000', 

1073 'apply_service_charge': True, 

1074 'customer_discount_type': 1, 

1075 'service_charge_value': 0, 

1076 }, 

1077 } 

1078 

1079 CloposClient.create_order(**data, headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

1080 

1081 # Or if you have set the environment variables 

1082 CloposClient.create_order(**data, headers={'x-token': 'token'}) 

1083 ``` 

1084 

1085 **Response format: [`ObjectResponse[Order]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

1086 

1087 Prerequisites: 

1088 - The top-level customer_id must be provided. 

1089 - Service context is required in payload.service: 

1090 - sale_type_id — a valid sale type ID from List Sale Types 

1091 - sale_type_name — human-readable sale type name 

1092 - venue_id and venue_name — the venue where the order will be fulfilled 

1093 - Product and modifier identifiers must exist in the POS catalog. Include the meta.order_product data returned by catalog APIs for accurate reconciliation. 

1094 - Totals and discounts are recalculated by the platform; send the raw values shown to operators. 

1095 

1096 Args: 

1097 customer_id: Customer ID 

1098 payload: Order payload 

1099 meta: Meta object 

1100 headers: Headers for request 

1101 ``` 

1102 """ # noqa: E501 

1103 

1104 @overload 

1105 def create_order( 

1106 self: 'CloposClientClass[_Async]', 

1107 customer_id: int, 

1108 payload: OrderPayloadIn, 

1109 meta: Unset[dict] = UNSET, 

1110 *, 

1111 headers: Unset[dict[str, str]] = UNSET, 

1112 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[Order]]]: ... 

1113 def create_order(self, *args: Any, **kwds: Any) -> Any: ... 

1114 

1115 @overload 

1116 def update_order( 

1117 self: 'CloposClientClass[_Sync]', 

1118 id: int, 

1119 status: OrderStatus, 

1120 *, 

1121 headers: Unset[dict[str, str]] = UNSET, 

1122 ) -> APIResponse[ObjectResponse[Order]]: 

1123 """Update the status of an existing order 

1124 

1125 **Endpoint**: `PUT /open-api/orders/{id}` 

1126 

1127 Example: 

1128 ```python 

1129 from integrify.clopos import CloposClient 

1130 from integrify.clopos.schemas.enums import OrderStatus 

1131 

1132 CloposClient.update_order(id=1, OrderStatus.IGNORE, headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

1133 

1134 # Or if you have set the environment variables 

1135 CloposClient.update_order(id=1, status=OrderStatus.IGNORE) 

1136 ``` 

1137 

1138 **Response format: [`ObjectResponse[Order]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

1139 

1140 Args: 

1141 id: Order ID 

1142 status: Order status to update 

1143 headers: Headers for request 

1144 ``` 

1145 """ # noqa: E501 

1146 

1147 @overload 

1148 def update_order( 

1149 self: 'CloposClientClass[_Async]', 

1150 id: int, 

1151 status: OrderStatus, 

1152 *, 

1153 headers: Unset[dict[str, str]] = UNSET, 

1154 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[Order]]]: ... 

1155 def update_order(self, *args: Any, **kwds: Any) -> Any: ... 

1156 

1157 @overload 

1158 def get_receipts( 

1159 self: 'CloposClientClass[_Sync]', 

1160 page: Unset[int] = 1, 

1161 limit: Unset[int] = 50, 

1162 sort_by: Unset[str] = 'created_at', 

1163 sort_order: Unset[int] = -1, 

1164 date_from: Unset[str | datetime] = UNSET, 

1165 date_to: Unset[str | datetime] = UNSET, 

1166 *, 

1167 headers: Unset[dict[str, str]] = UNSET, 

1168 ) -> APIResponse[ObjectListResponse[Receipt]]: 

1169 """Retrieve all receipts with support for filters and sorting 

1170 

1171 **Endpoint**: `GET /open-api/receipts` 

1172 

1173 Example: 

1174 ```python 

1175 from integrify.clopos import CloposClient 

1176 

1177 CloposClient.get_receipts(headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

1178 

1179 # Or if you have set the environment variables 

1180 CloposClient.get_receipts(headers={'x-token': 'token'}) 

1181 ``` 

1182 

1183 **Response format: [`ObjectListResponse[Receipt]`][integrify.clopos.schemas.common.response.ObjectListResponse]** 

1184 

1185 Args: 

1186 page: Page number for pagination (starts at 1) 

1187 limit: Maximum number of objects to return (1-200) 

1188 sort_by: Primary sort field 

1189 sort_order: Primary sort direction (1 = ascending, -1 = descending) 

1190 date_from: Start date (inclusive) in YYYY-MM-DD format 

1191 date_to: End date (inclusive) in YYYY-MM-DD format 

1192 headers: Headers for request 

1193 ``` 

1194 """ # noqa: E501 

1195 

1196 @overload 

1197 def get_receipts( 

1198 self: 'CloposClientClass[_Async]', 

1199 page: Unset[int] = 1, 

1200 limit: Unset[int] = 50, 

1201 sort_by: Unset[str] = 'created_at', 

1202 sort_order: Unset[int] = -1, 

1203 date_from: Unset[str | datetime] = UNSET, 

1204 date_to: Unset[str | datetime] = UNSET, 

1205 *, 

1206 headers: Unset[dict[str, str]] = UNSET, 

1207 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[Receipt]]]: ... 

1208 def get_receipts(self, *args: Any, **kwds: Any) -> Any: ... 

1209 

1210 @overload 

1211 def get_receipt_by_id( 

1212 self: 'CloposClientClass[_Sync]', 

1213 id: int, 

1214 *, 

1215 headers: Unset[dict[str, str]] = UNSET, 

1216 ) -> APIResponse[ObjectResponse[Receipt]]: 

1217 """Retrieve the full details of a specific receipt 

1218 

1219 **Endpoint**: `GET /open-api/receipts/{id}` 

1220 

1221 Example: 

1222 ```python 

1223 from integrify.clopos import CloposClient 

1224 

1225 CloposClient.get_receipt_by_id(1, headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

1226 

1227 # Or if you have set the environment variables 

1228 CloposClient.get_receipt_by_id(id=1, headers={'x-token': 'token'}) 

1229 ``` 

1230 

1231 **Response format: [`ObjectResponse[Receipt]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

1232 

1233 Args: 

1234 id: Receipt ID 

1235 headers: Headers for request 

1236 ``` 

1237 """ # noqa: E501 

1238 

1239 @overload 

1240 def get_receipt_by_id( 

1241 self: 'CloposClientClass[_Async]', 

1242 id: int, 

1243 *, 

1244 headers: Unset[dict[str, str]] = UNSET, 

1245 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[Receipt]]]: ... 

1246 def get_receipt_by_id(self, *args: Any, **kwds: Any) -> Any: ... 

1247 

1248 @overload 

1249 def update_closed_receipt( 

1250 self: 'CloposClientClass[_Sync]', 

1251 id: int, 

1252 order_status: Unset[OrderStatus] = UNSET, 

1253 order_number: Unset[str] = UNSET, 

1254 fiscal_id: Unset[str] = UNSET, 

1255 lock: Unset[bool] = UNSET, 

1256 *, 

1257 headers: Unset[dict[str, str]] = UNSET, 

1258 ) -> APIResponse[ObjectResponse[Receipt]]: 

1259 """Update specific fields of a receipt using the PATCH method. Only the provided fields will be updated; all other fields remain unchanged. 

1260 

1261 **Endpoint**: `PATCH /open-api/receipts/{id}` 

1262 

1263 Example: 

1264 ```python 

1265 from integrify.clopos import CloposClient 

1266 

1267 CloposClient.update_closed_receipt(1, order_status='NEW', headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

1268 

1269 # Or if you have set the environment variables 

1270 CloposClient.update_closed_receipt(id=1, order_status='NEW', headers={'x-token': 'token'}) 

1271 ``` 

1272 

1273 **Response format: [`ObjectResponse[Receipt]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

1274 

1275 Args: 

1276 id: Receipt ID 

1277 order_status: New order status. Valid values: "NEW", "SCHEDULED", "IN_PROGRESS", "READY", "PICKED_UP", "COMPLETED", "CANCELLED" 

1278 order_number: Order number identifier (e.g., "RPO-00001") 

1279 fiscal_id: Fiscal receipt identifier 

1280 lock: Lock status of the receipt 

1281 headers: Headers for request 

1282 """ # noqa: E501 

1283 

1284 @overload 

1285 def update_closed_receipt( 

1286 self: 'CloposClientClass[_Async]', 

1287 id: int, 

1288 order_status: Unset[OrderStatus] = UNSET, 

1289 order_number: Unset[str] = UNSET, 

1290 fiscal_id: Unset[str] = UNSET, 

1291 lock: Unset[bool] = UNSET, 

1292 *, 

1293 headers: Unset[dict[str, str]] = UNSET, 

1294 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[Receipt]]]: ... 

1295 def update_closed_receipt(self, *args: Any, **kwds: Any) -> Any: ... 

1296 

1297 @overload 

1298 def close_receipt( 

1299 self: 'CloposClientClass[_Sync]', 

1300 id: int, 

1301 cid: str, 

1302 payment_methods: list[PaymentMethodIn], 

1303 closed_at: str, 

1304 *, 

1305 headers: Unset[dict[str, str]] = UNSET, 

1306 ) -> APIResponse[ObjectResponse[Receipt]]: 

1307 """Comprehensively update a receipt using the PUT method. This method allows you to update multiple fields at once and can also be used to close receipts. 

1308 

1309 Critical Requirements: 

1310 - The cid and id fields must not change. If different values are sent, the system will treat it as a new receipt and return an error. 

1311 - All fields in the request body must be provided (full receipt object update). 

1312 

1313 **Endpoint**: `PUT /open-api/receipts/{id}` 

1314 

1315 Example: 

1316 ```python 

1317 from integrify.clopos import CloposClient 

1318 

1319 CloposClient.update_closed_receipt(1, order_status='NEW', headers={'x-brand': 'openapitest', 'x-venue': '1', 'x-token': 'token'}) 

1320 

1321 # Or if you have set the environment variables 

1322 CloposClient.update_closed_receipt(id=1, order_status='NEW', headers={'x-token': 'token'}) 

1323 ``` 

1324 

1325 **Response format: [`ObjectResponse[Receipt]`][integrify.clopos.schemas.common.response.ObjectResponse]** 

1326 

1327 Args: 

1328 id: Receipt ID. **Must match the path parameter** - cannot be changed. 

1329 cid: Client identifier. **Must match the existing receipt's CID** - cannot be changed. 

1330 payment_methods: List of payment methods with amounts 

1331 closed_at: Closing timestamp in format "YYYY-MM-DD HH:mm:ss". Must be greater than created_at. 

1332 headers: Headers for request 

1333 """ # noqa: E501 

1334 

1335 @overload 

1336 def close_receipt( 

1337 self: 'CloposClientClass[_Async]', 

1338 id: int, 

1339 cid: str, 

1340 payment_methods: list[PaymentMethodIn], 

1341 closed_at: str, 

1342 *, 

1343 headers: Unset[dict[str, str]] = UNSET, 

1344 ) -> Coroutine[Any, Any, APIResponse[ObjectResponse[Receipt]]]: ... 

1345 def close_receipt(self, *args: Any, **kwds: Any) -> Any: ... 

1346 

1347 @overload 

1348 def get_receipt_stock_operations( 

1349 self: 'CloposClientClass[_Sync]', 

1350 id: int, 

1351 *, 

1352 headers: Unset[dict[str, str]] = UNSET, 

1353 ) -> APIResponse[ObjectListResponse[ReceiptStockOperation]]: 

1354 """Retrieve the stock deductions (operations) generated by a receipt. 

1355 

1356 **Endpoint**: `GET /open-api/v2/receipts/{id}/stock-operations` 

1357 

1358 Args: 

1359 id: The receipt ID (path parameter). 

1360 """ # noqa: E501 

1361 

1362 @overload 

1363 def get_receipt_stock_operations( 

1364 self: 'CloposClientClass[_Async]', 

1365 id: int, 

1366 *, 

1367 headers: Unset[dict[str, str]] = UNSET, 

1368 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[ReceiptStockOperation]]]: ... 

1369 def get_receipt_stock_operations(self, *args: Any, **kwds: Any) -> Any: ... 

1370 

1371 @overload 

1372 def get_price_lists( 

1373 self: 'CloposClientClass[_Sync]', 

1374 page: Unset[int] = UNSET, 

1375 limit: Unset[int] = UNSET, 

1376 *, 

1377 headers: Unset[dict[str, str]] = UNSET, 

1378 ) -> APIResponse[ObjectListResponse[PriceList]]: 

1379 """Retrieve all configured price lists. 

1380 

1381 **Endpoint**: `GET /open-api/v2/price-lists` 

1382 

1383 Args: 

1384 page: Page number for pagination. 

1385 limit: Number of items per page (1-999). 

1386 """ # noqa: E501 

1387 

1388 @overload 

1389 def get_price_lists( 

1390 self: 'CloposClientClass[_Async]', 

1391 page: Unset[int] = UNSET, 

1392 limit: Unset[int] = UNSET, 

1393 *, 

1394 headers: Unset[dict[str, str]] = UNSET, 

1395 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[PriceList]]]: ... 

1396 def get_price_lists(self, *args: Any, **kwds: Any) -> Any: ... 

1397 

1398 @overload 

1399 def get_price_list_prices( 

1400 self: 'CloposClientClass[_Sync]', 

1401 page: Unset[int] = UNSET, 

1402 limit: Unset[int] = UNSET, 

1403 *, 

1404 headers: Unset[dict[str, str]] = UNSET, 

1405 ) -> APIResponse[ObjectListResponse[PriceListPrice]]: 

1406 """Retrieve individual product prices within price lists. 

1407 

1408 **Endpoint**: `GET /open-api/v2/price-lists/prices` 

1409 

1410 Args: 

1411 page: Page number for pagination. 

1412 limit: Number of items per page (1-999). 

1413 """ # noqa: E501 

1414 

1415 @overload 

1416 def get_price_list_prices( 

1417 self: 'CloposClientClass[_Async]', 

1418 page: Unset[int] = UNSET, 

1419 limit: Unset[int] = UNSET, 

1420 *, 

1421 headers: Unset[dict[str, str]] = UNSET, 

1422 ) -> Coroutine[Any, Any, APIResponse[ObjectListResponse[PriceListPrice]]]: ... 

1423 def get_price_list_prices(self, *args: Any, **kwds: Any) -> Any: ... 

1424 

1425 

1426CloposRequest: 'CloposClientClass[_Sync]' = CloposClientClass(sync=True) 

1427CloposAsyncRequest: 'CloposClientClass[_Async]' = CloposClientClass(sync=False)