antares_get_data/README.md

70 lines
2.0 KiB
Markdown

<div align="center">
# Antares -> Octopus 8
<img src="./docs/images/antares.png" alt="antares logo" height="100"/>
<img src="./docs/images/cross.png" alt="cross" width="50"/>
<img src="./docs/images/Octopus8.ico" alt="octopus lgog" height="100"/>
Rust utility to fetch product data from Antares B2B and export it to .xslx which can be imported by Octopus 8.
</div>
## Quick Start
Linux / MacOS:
```bash
cp .env.example .env
# Edit .env with your credentials and output path
cargo build --release
./target/release/antares_get_data
```
Windows:
```batch
copy .env.example .env
REM Edit .env with your credentials and output path
cargo build --release
./target/release/antares_get_data.exe
```
## Configuration
`.env` file:
```env
URL=https://b2b.antares.hu/YOUR_BASE_URI_HERE
ANTARES_USERCODE=given_usercode
ANTARES_PASSWORD=given_password
OUT=out\\test.xlsx
```
`OUT` can be:
- Directory: `out` → creates `out/antares.xlsx`
- File path: `exports/data.xlsx` → creates file there
- Must be `.xlsx` extension if file path
## How It Works
1. Load credentials from `.env`
2. Fetch product data from Antares B2B API (600s timeout)
3. Save raw JSON to `antares.json`
4. Export filtered data to Excel
5. Log all operations to `log/YYYY-MM-DD.log`
## Excel Output
8 columns with selective field mapping and row filtering:
| Column | Source |
|--------|--------|
| BESZCIKKSZAM | [cikkszam](./src/template/antares.rs#L22) (required) |
| GYCIKKSZAM | [cikkszam](./src/template/antares.rs#L22) |
| BESZCIKKNEV | [cikk_megnevezes](./src/template/antares.rs#L20) or [cikk_megnevezes_rovid](./src/template/antares.rs#L21) (required) |
| GYARTO | "EGYEB" (const) |
| CIKKAZON | [vonalkod](./src/template/antares.rs#L33) |
| KESZLET | [szabad_keszlet](./src/template/antares.rs#L29) |
| ME | [mennyisegi_egyseg_kod](./src/template/antares.rs#L24) |
| EGYSEGAR | [netto_kisker_ar](./src/template/antares.rs#L26) or "Alap ár" [jellemzo](./src/template/antares.rs#39).[jellemzo_nev](./src/template/antares.rs#L41) |
Rows skipped if `BESZCIKKSZAM` or `BESZCIKKNEV` missing!