Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Cache - Renew in CronJob #928

Open
wants to merge 73 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
c18cf13
add function to get Count of Estates for Address
ingoKrOffice Sep 11, 2024
63a4485
remove Logs
ingoKrOffice Sep 11, 2024
2f7428a
fix test and add test for count estates for address
ingoKrOffice Sep 11, 2024
354cb9e
Merge branch 'master' into renew-cache-in-cron
ingoKrOffice Oct 1, 2024
e7260a9
further cache working
ingoKrOffice Oct 1, 2024
e0859c3
merge master
ingoKrOffice Oct 8, 2024
d9fe3a5
add geo-search
ingoKrOffice Oct 10, 2024
41004c2
update gitignore
ingoKrOffice Oct 10, 2024
b85e912
remove Submodule
ingoKrOffice Oct 10, 2024
cedbebf
add SDK
ingoKrOffice Oct 10, 2024
d5ac3c0
fix test
ingoKrOffice Oct 10, 2024
2380afa
fix mocker
ingoKrOffice Oct 10, 2024
b566547
fix tests
ingoKrOffice Oct 11, 2024
77ae020
test
ingoKrOffice Oct 11, 2024
cb254ef
test
ingoKrOffice Oct 11, 2024
1b14818
remove old Method
ingoKrOffice Oct 14, 2024
1ca903b
Merge branch 'renew-cache-in-cron' of github.com:onOffice-Web-Org/oo-…
ingoKrOffice Oct 14, 2024
d84adb6
update wp-tests.sh file from Wordpress
ingoKrOffice Oct 14, 2024
8635ccd
update ubuntu v.
pospisk Oct 14, 2024
c2f7666
fix estate tests
ingoKrOffice Oct 14, 2024
3e13904
Merge branch 'renew-cache-in-cron' of github.com:onOffice-Web-Org/oo-…
ingoKrOffice Oct 14, 2024
38034dc
remove debug msg
ingoKrOffice Oct 14, 2024
c5ff2cc
Merge branch 'master' into renew-cache-in-cron
andernath Oct 15, 2024
c8c8d1f
fix pagination, fix filter
ingoKrOffice Oct 16, 2024
864d3e1
Merge branch 'renew-cache-in-cron' of github.com:onOffice-Web-Org/oo-…
ingoKrOffice Oct 16, 2024
20b5845
fix textsearch 'like'
ingoKrOffice Oct 16, 2024
cef2a64
fix filter of float and date
ingoKrOffice Oct 16, 2024
3a54456
remove error log
ingoKrOffice Oct 16, 2024
54793ef
add geosearch max parameter
ingoKrOffice Oct 17, 2024
ab77f1d
fix filter, if serach array is empty
ingoKrOffice Oct 18, 2024
fb223c9
add option to link addressdetail in property-template
ingoKrOffice Oct 18, 2024
ead87b3
remove unused
ingoKrOffice Oct 18, 2024
000c0f8
fix Test
ingoKrOffice Oct 18, 2024
3273512
option to filter geosearch by country
ingoKrOffice Oct 18, 2024
18eb543
add doc
ingoKrOffice Oct 21, 2024
2412a26
create cache for all wpml languages
ingoKrOffice Oct 21, 2024
8e49e6f
Merge branch 'master' into renew-cache-in-cron
ingoKrOffice Oct 24, 2024
aef39cb
add ImageForWebsite Field
ingoKrOffice Oct 24, 2024
f051e7d
fix sort param
ingoKrOffice Oct 24, 2024
f85821c
conflict master: getBildWebseite, change IMG-Alt to rawRecords
ingoKrOffice Oct 24, 2024
fb04780
fix Test
ingoKrOffice Oct 24, 2024
bd36aaf
Merge branch 'master' into renew-cache-in-cron
ingoKrOffice Oct 28, 2024
2743604
add language to hash, fix op = search
ingoKrOffice Oct 28, 2024
669c451
remove logs
ingoKrOffice Oct 28, 2024
c577d05
remove clearAll
ingoKrOffice Oct 28, 2024
a64e6bb
Merge branch 'master' into renew-cache-in-cron
fredericalpers Oct 28, 2024
1607051
Merge branch 'master' into renew-cache-in-cron
andernath Oct 29, 2024
e0c725b
Merge branch 'master' into renew-cache-in-cron
andernath Oct 29, 2024
82bfd10
fix filter currency
ingoKrOffice Oct 29, 2024
fae0a5a
add default sortby
ingoKrOffice Oct 29, 2024
82f670a
fix boolean search
ingoKrOffice Oct 29, 2024
11e8901
fix sort of Addresslist
ingoKrOffice Oct 29, 2024
3357065
Merge branch 'renew-cache-in-cron' of github.com:onOffice-Web-Org/oo-…
ingoKrOffice Oct 29, 2024
eae2558
fix tests
ingoKrOffice Oct 29, 2024
21108a0
do not use filter in cache
ingoKrOffice Nov 5, 2024
49ae49f
Merge branch 'master' into renew-cache-in-cron
ingoKrOffice Nov 6, 2024
f4fd3ba
set timeout to 2 seconds
ingoKrOffice Nov 6, 2024
8ed05b6
add raw and fieldtypes to formatted cache
ingoKrOffice Nov 6, 2024
8566763
reset ArrayContainer
ingoKrOffice Nov 6, 2024
60ec9b5
fix test
ingoKrOffice Nov 6, 2024
95abfac
small fixes
ingoKrOffice Nov 6, 2024
4e88623
remove images.php
ingoKrOffice Nov 6, 2024
dcb738a
update filter
ingoKrOffice Nov 7, 2024
81df11d
Merge branch 'master' into renew-cache-in-cron
ingoKrOffice Nov 7, 2024
c83722c
fix sorting
ingoKrOffice Nov 11, 2024
8176d48
fix filter varchar
ingoKrOffice Nov 13, 2024
2e8ea4b
remove Annotations
ingoKrOffice Nov 13, 2024
94e8ace
Merge branch 'master' into renew-cache-in-cron
fredericalpers Nov 15, 2024
973f8c8
Merge branch 'master' into renew-cache-in-cron
andernath Nov 18, 2024
ec68b2c
fix sorting, add sortby values to request
ingoKrOffice Dec 11, 2024
d714e09
rename parameters for cache
ingoKrOffice Dec 17, 2024
de0f854
Merge branch 'master' into renew-cache-in-cron
ingoKrOffice Dec 17, 2024
45f2d64
Merge branch 'master' into renew-cache-in-cron
ingoKrOffice Dec 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
operating-system: [ubuntu-20.04]
php-versions: ['7.4', '8.0']
name: Unittest on ${{ matrix.operating-system }} with PHP version ${{ matrix.php-versions }}
steps:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
vendor/
nbproject/
build/
node_modules/
node_modules/
SDK/vendor
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "SDK"]
path = SDK
url = https://github.com/onOfficeGmbH/sdk
1 change: 0 additions & 1 deletion SDK
Submodule SDK deleted from 102921
18 changes: 18 additions & 0 deletions SDK/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

## 0.2.0 (2020-02-24)

* Fix description of composer command in README (#10 by @mrcodefinger)
* Add Travis to CI pipeline (#22 by @dkaisers, #7 by @legionth)
* Adding PHP-CS-Fixer as development dependency (#19 by @legionth)
* Move example to examples folder (#20 by @legionth)
* Introduced PHPUnit (#11, #12, #13, #14, #15, #16, #18 by @legionth)
* Rename SDK folder to src folder and update autoloader according to changes (#9 by @legionth)
* Added PSR-4 Autoloader via composer (#6 by @legionth)

## 0.1.0 (2020-02-12)

* Improve documentation of the README and create CONTRIBUTING document
for developers (#2 and #3 by @legionth)
* Add composer.json to identify dependencies and adding the repository
to packagist.org (#1 and #4 by @legionth)
59 changes: 59 additions & 0 deletions SDK/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Contributing

When contributing to this service,
please open an issue via the
[GitHub issues page](https://github.com/onOfficeGmbH/sdk/issues)
or send a mail to `[email protected]`
before making a change.

## Bugs

Bugs must be reported via the
[GitHub issues page](https://github.com/onOfficeGmbH/sdk/issues).

Bug fixes and improvements can be provided via a
[Pull Request](https://github.com/onOfficeGmbH/sdk/pulls).

A fix that introduces a change in behavior is considered a
[breaking change](#breaking-changes).

## Features

Features and Breaking Changes must be discussed with the
maintainers of this repository.

A feature that introduces a change in existing behavior is considered a
[breaking change](#breaking-changes).

## Breaking Changes

A breaking change must be discussed with the maintainers.
The list of maintainers can be found [here](https://github.com/orgs/onOfficeGmbH/people)

## Pull Request Process

* Update the `README.md` with details of changes to the interface, classes or
general behaviour.
* Contact one of the maintainers in the Pull Request.
The list of maintainers can be found [here](https://github.com/orgs/onOfficeGmbH/people)
* Every Pull Request with actual code changes has to add or adapt unit and/or integration tests.
Please see [Running the Tests](#running-the-tests) down below.
* Create a meaningful title for the Pull Request that addresses the topic.
* The Pull Request must pass the CI integration.
Be aware of the currently supported PHP versions and optimize your code according
to the supported versions.
* Keep the Pull Request as small as possible.
Avoid unnecessary changes to speed up the review process.
* Write readable and understandable code.
Try always to create the best possible solution.
* Use readable and understandable commit messages, so the reviewer can understand the
intention of each commit.

## Running the Tests

The tests of this project consist on two [test suites](https://phpunit.readthedocs.io/en/9.5/organizing-tests.html).
These are named _unit_ and _integration_ for unit tests and integration tests, respectively.
Running the unit tests should be no harder that running
`./vendor/bin/phpunit --testsuite unit`, while executing the integration tests requires the binaries `faketime` and `ncat`
to be in the `$PATH`. The integration tests can be run by typing
`./vendor/bin/phpunit --testsuite integration`.
17 changes: 17 additions & 0 deletions SDK/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
The MIT License (MIT)
Copyright (c) 2019 onOffice Software AG

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
181 changes: 181 additions & 0 deletions SDK/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# onOffice-SDK
[![PHP Composer](https://github.com/onOfficeGmbH/sdk/actions/workflows/php.yml/badge.svg)](https://github.com/onOfficeGmbH/sdk/actions/workflows/php.yml)

This project is the official PHP API client for the
[onOffice API](https://apidoc.onoffice.de/)
supported by the onOffice GmbH.

* **The HTTP protocol** is used to communicate with the API.
* An **Access Token** and **TLS connection** are used to ensure a **secure**
communication with the API.
* The intention is to have **lightweight** client that can be used in other environments

**Table of Contents**
* [Quickstart Example](#quickstart-example)
* [Usage](#usage)
* [Client](#client)
* [Parameters](#parameters)
* [Request](#request)
* [Response](#response)
* [API Documentation](#api-documentation)
* [Install](#install)
* [Contributing](#contributing)
* [License](#license)

## Quickstart Example

```php
$sdk = new onOfficeSDK();
$sdk->setApiVersion('stable');

$parametersReadEstate = [
'data' => [
'Id',
'kaufpreis',
'lage',
],
'listlimit' => 10,
'sortby' => [
'kaufpreis' => 'ASC',
'warmmiete' => 'ASC',
],
'filter' => [
'kaufpreis' => [
['op' => '>', 'val' => 300000],
],
'status' => [
['op' => '=', 'val' => 1],
],
],
];

$handleReadEstate = $sdk->callGeneric(onOfficeSDK::ACTION_ID_READ, 'estate', $parametersReadEstate);

$sdk->sendRequests('put the token here', 'and secret here');

var_export($sdk->getResponseArray($handleReadEstate));
```

Checkout the [examples folder](/examples/) to see a possible implementation of
this client.

## Usage

### Client

The `onOfficeSDK` is responsible for creating HTTP Requests and
receiving HTTP Responses from the official API

```php
$sdk = new onOfficeSDK();
$sdk->setApiVersion('stable');
```

Make sure that the correct API version is used for your client.
By default this value is set to `stable`.

### Parameters

The parameters are transferred as JSON in the HTTP Request.
The client uses the official
[PHP array notation](https://www.php.net/manual/en/book.json.php)
before transforming the array to JSON.

```php
$parametersReadEstate = [
'data' => [
'Id',
'kaufpreis',
'lage',
],
'listlimit' => 10,
'sortby' => [
'kaufpreis' => 'ASC',
'warmmiete' => 'ASC',
],
'filter' => [
'kaufpreis' => [
['op' => '>', 'val' => 300000],
],
'status' => [
['op' => '=', 'val' => 1],
],
],
];
```

### Request

To create a request to the API an `ACTION_ID` is needed.
The class `onOfficeSDK` defines several constants,
that can be used, so there is no need to copy these `ACTION_IDs`.

A token and secret are needed to send a request to the API.
Check out the [official API documentation](#api-documentation)
for information on how to acquire these credentials.

```php
$handleReadEstate = $sdk->callGeneric(onOfficeSDK::ACTION_ID_READ, 'estate', $parametersReadEstate);

$sdk->sendRequests('put the token here', 'and secret here');
```

The return value of `onOfficeSDK::callGeneric` is used to identify the
equivalent response value.
`onOfficeSDK::callGeneric` can be called multiple times before sending
the request to the API via `onOfficeSDK::sendRequests`.


### Response

Use the method `onOfficeSDK::getResponseArray` to fetch the response data for a request.
To identify the response of the request, use the value returned by `onOfficeSDK::callGeneric`.
```php
var_export($sdk->getResponseArray($handleReadEstate));
```

The response will be a PHP array.

### Difference between `call` and `callGeneric`

This library will provide two general methods to create the calls to the onOffice API.

* `callGeneric` is used to create simple calls e.g.
[Estate searches](https://apidoc.onoffice.de/actions/datensatz-lesen/objekte/)
or
[reading addresses](https://apidoc.onoffice.de/actions/datensatz-lesen/adressen/)
* `call` can be used more specific for special API Requests.
Some API Request need some more information like `identifier`, `resourceId` and `resourceType`
to be processed.
These can be calls like [Estate files](https://apidoc.onoffice.de/actions/informationen-abfragen/objektdateien/)
or [Editing Addresses](https://apidoc.onoffice.de/actions/datensatz-bearbeiten/addresses/)

Check the [API documentation](#api-documentation) for more information.

## API Documentation

The API client is developed for the latest version of the official API.
Additional information about the API can be [found here](https://apidoc.onoffice.de/).

## Install

The recommended way to install this library is through Composer.
[New to Composer?](https://getcomposer.org/)

This will install the latest supported version:

```
$ composer require onoffice/sdk:^0.2.0
```
See also the [CHANGELOG](/CHANGELOG.md)
for details about version upgrades.

## Contributing

You want to contribute? Great!

Check out our [contribution rules](/CONTRIBUTING.md) and get started!

## License

This project is licensed under the MIT License. See [LICENSE document](/LICENSE).
24 changes: 24 additions & 0 deletions SDK/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "onoffice/sdk",
"description": "Official client to communicate with the onOffice API",
"license": "MIT",
"require": {
"ext-json": "*",
"ext-curl": "*"
},
"autoload": {
"psr-4": {
"onOffice\\SDK\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\onOffice\\SDK\\": "tests"
}
},
"require-dev": {
"phpunit/phpunit": "^6",
"friendsofphp/php-cs-fixer": "^2.16",
"symfony/process": "^3.4.37"
}
}
Loading
Loading