# Realvia Real Estate Plugin for WordPress

### Introduction

This plugin is used to import real estate ads from the Realvia API and display them on the website. On the plugin options page, you will find the key to use along with the request for authentication. Data format get from [documentation](https://dev.realvia.sk/doc/export/index.php).

---
### API endpoint

#### [POST] - YOUR_WEBSITE_URL/wp-json/realvia/v1/export
```
{
    "auth_key": "", // key from the plugin options page (not needed update the key if you disable and enable plugin)
    "action": "", // create | update | delete
    "Office": {...},
    "Broker": {...},
    "Advert": {...}
}
```

### Shortcodes, functions

```[realvia_real_states]``` - Display all real states on the page (default interface)

```realvia_get_real_estates($options)``` - return array with all real states (options is array. can be limit (number), offset(number), order(asc/desc), active(1/0))

```realvia_get_real_estate_by_id($source_id)``` - return real estate by source_id

### Classes

#### RealviaAdvert

```getTransaction()``` - The transaction type of the advert (integer).

```getTitle()``` - The title of the advert (string).

```getDescription()``` - The description of the advert (string).

```getStreetNumber()``` - The street number of the property (nullable string).

```getRealEstateState()``` - The state of the real estate (integer).

```getPosition()``` - The position of the property (nullable integer).

```getLocation()``` - The location of the property (array).

```getImages()``` - An array of images associated with the property.

```getExtra()``` - An array of extra parameters for the property.

```getFloor()``` - The floor number of the property (nullable integer).

```getRoomsCount()``` - The number of rooms in the property (nullable integer, defaults to 0 if null).

```getStoreArea()``` - The storage area of the property (nullable float).

```getYearOfConstruction()``` - The year the property was constructed (nullable integer).

```getUsableArea()``` - The usable area of the property (float).

```getBuildingArea()``` - The building area of the property (float).

```getLandArea()``` - The land area of the property (float).

```getPrice()``` - The price of the property (float).

```getUnits()``` - The measurement units for the property (integer).

```getNoteToPrice()``` - A note related to the price (nullable string).

```isPriceByAgreement()``` - Whether the price is by agreement (boolean).

```getCurrency()``` - The currency of the price (integer).

```getPowerCosts()``` - The power costs associated with the property (nullable float).

```getNumberOfOverheadFloors()``` - The number of overhead floors (nullable integer).

```getNumberOfSublevels()``` - The number of sublevels (nullable integer).

```getOrientationText($language = 'sk')``` - The number of sublevels (nullable integer).

```getBuildingTypeText($language = 'sk')``` - The number of sublevels (nullable integer).

```getHeatingSystemText($language = 'sk')``` - The number of sublevels (nullable integer).

```getLoggiaExist()``` - The number of sublevels (nullable integer).

```getCellarExist()``` - The number of sublevels (nullable integer).

```toArray()``` - The number of sublevels (nullable integer).

#### RealviaBroker

```getSourceId()``` - The unique source ID of the broker (string).

```getFirstName()``` - The first name of the broker (string).

```getLastName()``` - The last name of the broker (string).

```getPhone()``` - The phone number of the broker (string).

```getEmail()``` - The email address of the broker (string).

```getDegreeBefore()``` - The title before the broker's name (string).

```getDegreeAfter()``` - The title after the broker's name (string).

```isDeleted()``` - The deleted status of the broker (boolean).

```setSourceId($source_id)``` - Sets the unique source ID of the broker.

```setFirstName($first_name)``` - Sets the first name of the broker.

```setLastName($last_name)``` - Sets the last name of the broker.

```setPhone($phone)``` - Sets the phone number of the broker.

```setEmail($email)``` - Sets the email address of the broker.

```setDegreeBefore($degree_before)``` - Sets the title before the broker's name.

```setDegreeAfter($degree_after)``` - Sets the title after the broker's name.

```setDeleted($deleted)``` - Sets the deleted status of the broker.

```toArray()``` - An associative array representation of the broker's attributes.

#### RealviaOffice

```getSourceId()``` - The unique source ID of the office (string).

```getName()``` - The name of the office (string).

```getPhone()``` - The phone number of the office (string).

```getEmail()``` - The email address of the office (string).

```getCity()``` - The city where the office is located (string).

```getZip()``` - The ZIP code of the office's location (string).

```getStreet()``` - The street name of the office's location (string).

```getStreetNumber()``` - The street number of the office's location (string).

```getContactPerson()``` - The contact person for the office (nullable string).

```setSourceId($source_id)``` - Sets the unique source ID of the office.

```setName($name)``` - Sets the name of the office.

```setPhone($phone)``` - Sets the phone number of the office.

```setEmail($email)``` - Sets the email address of the office.
```setCity($city)``` - Sets the city where the office is located.

```setZip($zip)``` - Sets the ZIP code of the office's location.

```setStreet($street)``` - Sets the street name of the office's location.

```setStreetNumber($street_number)``` - Sets the street number of the office's location.

```setContactPerson($contact_person)``` - Sets the contact person for the office.

```toArray()``` - An associative array representation of the office's attributes.
