Compare commits
324 commits
Author | SHA1 | Date | |
---|---|---|---|
|
531d0ee931 | ||
|
562d1e4cd0 | ||
fc78e5897b | |||
|
0a862dd86b | ||
5a3547894a | |||
1d05f3efeb | |||
831ed64871 | |||
502a0c8641 | |||
4a99094294 | |||
|
c379815f76 | ||
27e9e8eaa5 | |||
|
c21a89c761 | ||
068a9d0e0b | |||
|
1881dd3499 | ||
|
47edbda927 | ||
|
91c3ca8ce5 | ||
|
6d05a1af3f | ||
|
16cdc6ce49 | ||
cdca2b6d6d | |||
|
ecaac435cc | ||
|
e3cc485873 | ||
4880ed9930 | |||
7b393e961b | |||
3a3d00aeb8 | |||
60624dad9b | |||
121dcebb32 | |||
|
80396691dd | ||
|
3d5e3e92e6 | ||
|
6130b265fe | ||
|
da8ce13736 | ||
|
1c6ebd819f | ||
|
a7d071af28 | ||
544d16186f | |||
|
dc9e0a5b39 | ||
5b04bd9d8a | |||
|
ca1650d8d9 | ||
54ce958c76 | |||
|
be71f22c65 | ||
|
a7cffe45da | ||
8b677de616 | |||
|
0ef461e504 | ||
|
7d65407c7c | ||
|
ccbff3aba3 | ||
71a3a66724 | |||
|
36bf34b511 | ||
ca955cd49f | |||
|
a2bac7dcd0 | ||
bc5d044282 | |||
|
0298a1ad58 | ||
|
b7ae093cc4 | ||
f04a352126 | |||
|
e3877587bb | ||
fda9208de2 | |||
5bb006588b | |||
759c1ee5a8 | |||
18f5b8c196 | |||
312dfeffd7 | |||
7a4d755f83 | |||
f53f545c22 | |||
8ced4dc8a1 | |||
49844e50d6 | |||
0d747fa1e7 | |||
232c22a557 | |||
4de6a3b798 | |||
82f110d0d0 | |||
|
7cf7cbf467 | ||
|
3927344dde | ||
72636563ff | |||
|
37e9ca0110 | ||
af8a79379b | |||
|
a2d7035655 | ||
|
0fce4a49db | ||
|
f37434af17 | ||
|
2310b3b825 | ||
|
f926b59e36 | ||
fe18dce66a | |||
3054974756 | |||
|
a7bb610a0a | ||
725209296c | |||
|
a682ce606a | ||
|
5223d0e9f6 | ||
|
2d0ed4c149 | ||
454a5fac26 | |||
c10f2d3d47 | |||
|
37069e8cdd | ||
|
ef7d5cba25 | ||
b497e37c8e | |||
19f2b3dcd1 | |||
974b0cc8ef | |||
|
b6afd33906 | ||
|
2b02c0e116 | ||
|
6515e39144 | ||
|
a68705055c | ||
|
bb5a205cd1 | ||
|
8476f8946e | ||
fa0e8a7075 | |||
a87630a72b | |||
|
06e34486ac | ||
|
aa3c99fa6d | ||
|
86d280ba47 | ||
|
a42ddcc337 | ||
|
847fbd0bd0 | ||
|
47741acd28 | ||
|
bc820d0a69 | ||
|
12d8381b80 | ||
|
5e2c947f27 | ||
|
b0080ff23c | ||
|
186b44b0d4 | ||
f75a653a7d | |||
c47b6d2bb4 | |||
9a56566a7f | |||
ccd3c07872 | |||
d960d43053 | |||
|
bbb9af3ac0 | ||
040cb49d29 | |||
|
66690ac5dd | ||
|
1c68383869 | ||
fc62d95dbb | |||
df9d1b6e6f | |||
3aa3e65bbe | |||
937b0e4b76 | |||
dd419cb1ef | |||
5b69fc77cf | |||
36524fc85b | |||
|
48ed7e168a | ||
c1719bf84a | |||
a5ed9af862 | |||
|
13caebdbc2 | ||
|
0b6cbb6794 | ||
|
c6950a2103 | ||
|
e206a69d4a | ||
|
c796400ccb | ||
|
d71a74edcc | ||
123a59fdf8 | |||
|
2ada519c10 | ||
7124c816b5 | |||
|
f16cd5f6e7 | ||
|
972cd2ce68 | ||
5c35b3e3be | |||
|
8b136b075b | ||
|
6a8f9ec589 | ||
795ae316ff | |||
e76bb59970 | |||
|
8c05f269fa | ||
75fd10d40e | |||
|
f0a1adfb3d | ||
|
649b60b392 | ||
|
f472ca1fde | ||
46954b290c | |||
fdc01456d2 | |||
5a38c078c7 | |||
|
f2d9be5d4a | ||
0b6ed08d49 | |||
|
c8be9c7891 | ||
|
a17a816198 | ||
|
0ada1cd922 | ||
bce2bfaf4c | |||
|
9c6029fa0d | ||
|
fa93c2bc8d | ||
ed6f672cda | |||
|
cefb9fabcf | ||
822058c241 | |||
|
1a5c972842 | ||
b78088d794 | |||
|
fa85db6b7f | ||
|
2282f2bb4c | ||
f97fa8366f | |||
fe3dd0134a | |||
|
3d666332c3 | ||
a250b9d28e | |||
7d3ae80fe7 | |||
|
cfa975db17 | ||
153bc6344e | |||
d7c36b2cc7 | |||
|
1bdf8be34c | ||
d0ebd84cc8 | |||
|
7040640b57 | ||
|
b17385ffb6 | ||
8899cd6ee2 | |||
b2bd3ddfe1 | |||
|
0e2867c9d9 | ||
962ff0b1da | |||
|
6ed0d7eb0d | ||
|
1109578208 | ||
|
db549ab357 | ||
|
0a0bb0e461 | ||
|
d77cb53f10 | ||
|
f8ba3b1503 | ||
|
063fe1f921 | ||
|
b66801d7d2 | ||
|
d566d2b344 | ||
|
2672fcdebf | ||
|
e68a23885e | ||
|
5d0e20581c | ||
|
88cb6526b0 | ||
|
e3b452a0c2 | ||
d9128fa5d1 | |||
|
963eb19bfd | ||
|
4073580394 | ||
|
30dfcc7c68 | ||
8ebcdaeebc | |||
9bbf277d92 | |||
|
5371a9750e | ||
|
0f05f84d04 | ||
|
73b5b8e1df | ||
|
170e0b8f34 | ||
|
29fd360e4f | ||
8cd0837aa0 | |||
|
2ab21e1ea6 | ||
b4eccc73af | |||
|
96f345c657 | ||
df0177ac5e | |||
|
8069c0fcbe | ||
|
8084401dc6 | ||
|
6714723dc2 | ||
|
934d3ba751 | ||
|
275721aea7 | ||
|
ae1c1fa360 | ||
|
9ba0785e73 | ||
|
73d7f71c99 | ||
|
0951e3cfb3 | ||
|
2e4e24f507 | ||
|
1826dd57d6 | ||
|
5d1760c245 | ||
|
372029e1a2 | ||
|
4d59f37980 | ||
|
d1a73d7acd | ||
|
251c21300a | ||
|
6e48a1d222 | ||
|
5e890c9324 | ||
|
d61ab837e8 | ||
|
6947dfe08c | ||
|
403d04d3c4 | ||
|
440c7fcd8c | ||
|
c6c5f737bd | ||
|
ada3de8770 | ||
|
95c24bed4a | ||
|
93c204f322 | ||
|
aa79e774f1 | ||
|
25f9010793 | ||
|
3dd663e7a6 | ||
|
9aab02c189 | ||
|
4f57734e92 | ||
|
a18767bddc | ||
|
b701fa232c | ||
|
40fd0a2f70 | ||
|
ce2dab2c03 | ||
|
c9384ff54b | ||
|
d9bc74c9d4 | ||
|
cf814c5aae | ||
|
8c583de05b | ||
|
0fad2158be | ||
|
afd681201a | ||
|
2c77999fcc | ||
|
7a60213a7e | ||
|
11bae943f2 | ||
|
5c4413a97c | ||
|
5be40d1d09 | ||
|
0168ce754a | ||
|
64c24fab33 | ||
|
1f662a020a | ||
|
c79fe5b0ab | ||
|
e4870f1e29 | ||
|
82df6d5c4c | ||
|
51b53cfcc1 | ||
|
b1e7dbc52c | ||
|
c0c7ac6a7e | ||
|
c1c0f5af8c | ||
|
f2d51b017e | ||
|
3dc1fbb7a9 | ||
|
c5ddf84813 | ||
|
b6b49d5430 | ||
|
49f253c228 | ||
|
8233a670bc | ||
|
edf300dfad | ||
|
15b5a2b736 | ||
|
acf29c8c1b | ||
|
ddf46fd73d | ||
|
ffaa661384 | ||
|
de70ffd2bd | ||
|
a9b60cfd62 | ||
|
a6e5afa165 | ||
|
d26f609e9f | ||
|
546010b337 | ||
|
4ccf30d588 | ||
|
494a4d3432 | ||
|
338452a169 | ||
|
0c213eac0e | ||
|
a65fc7ff94 | ||
|
347d620959 | ||
|
4606062af8 | ||
|
838b850d48 | ||
|
118644be43 | ||
|
7f9e8cbb56 | ||
|
1c695eeda7 | ||
|
1387fbca38 | ||
|
4881a416be | ||
|
ecb26bc1ff | ||
|
31b1d9d0f1 | ||
|
9d3e2817fe | ||
|
9fdb2f0ada | ||
|
0b512fa031 | ||
|
5d37588ab2 | ||
|
04520e7993 | ||
|
700b87fba0 | ||
|
aba730295d | ||
|
3a3d0c2658 | ||
|
e09fc4a58f | ||
|
6ee6452748 | ||
|
1cb4074470 | ||
|
741ee9bb1a | ||
|
2098ad3bf2 | ||
|
67e0f4746e | ||
|
de6dbdd87f | ||
|
7ec35c2ad8 | ||
|
d1b26b1663 | ||
|
c7e7ed92cf | ||
|
03466cf0ad | ||
|
b4f3c0efb2 | ||
|
33f34b991e | ||
|
1b5af03644 | ||
|
1319ff063d | ||
|
4eb7a73887 | ||
|
a084f0f183 |
15
.editorconfig
Normal file
|
@ -0,0 +1,15 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{less,css,yml,json}]
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
6
.env.dist
Normal file
|
@ -0,0 +1,6 @@
|
|||
# This file can be used change api url and api key in tests. Useful when you want to use real networking for test case.
|
||||
# Follow these steps if you want to use real networking for your test case:
|
||||
# - Replace credentials below with your own.
|
||||
# - Use `php-http/curl-client` as an argument for `TestClientFactory::createClient`.
|
||||
API_URL=https://test.retailcrm.pro/
|
||||
API_KEY=testkey
|
46
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
tags-ignore:
|
||||
- '*.*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: "PHPUnit"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
|
||||
steps:
|
||||
- name: Check out code into the workspace
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP ${{ matrix.php-version }}
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
coverage: pcov
|
||||
|
||||
- name: Composer cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.HOME }}/.composer/cache
|
||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install -o
|
||||
|
||||
- name: Configure matchers
|
||||
uses: mheap/phpunit-matcher-action@v1
|
||||
|
||||
- name: Run tests
|
||||
run: composer run-script phpunit-ci
|
||||
|
||||
- name: Coverage
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
verbose: true
|
42
.github/workflows/code_quality.yml
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
name: "Code Quality Check"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "**.php"
|
||||
- "phpcs.xml"
|
||||
- ".github/workflows/code_quality.yml"
|
||||
|
||||
jobs:
|
||||
phpcs:
|
||||
name: "PHP CodeSniffer"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the workspace
|
||||
uses: actions/checkout@v4
|
||||
- name: Run PHPCS
|
||||
uses: chekalsky/phpcs-action@v1
|
||||
phpmd:
|
||||
name: "PHP MessDetector"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the workspace
|
||||
uses: actions/checkout@v4
|
||||
- name: Run PHPMD
|
||||
uses: GeneaLabs/action-reviewdog-phpmd@1.0.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
level: 'warning'
|
||||
reporter: github-pr-check
|
||||
standard: './phpmd.xml'
|
||||
target_directory: 'src'
|
||||
phpstan:
|
||||
name: PHPStan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the workspace
|
||||
uses: actions/checkout@v4
|
||||
- name: Run PHPStan
|
||||
uses: docker://oskarstark/phpstan-ga:1.8.0
|
||||
with:
|
||||
args: analyse src -c phpstan.neon --memory-limit=1G --no-progress
|
47
.github/workflows/documentation.yml
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
name: phpDocumentor
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
documentation:
|
||||
name: "phpDocumentor"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check GitHub Pages status
|
||||
if: ${{ github.ref != 'refs/heads/master' }}
|
||||
uses: crazy-max/ghaction-github-status@v2
|
||||
with:
|
||||
pages_threshold: major_outage
|
||||
- name: Check out code into the workspace
|
||||
if: success() && ${{ github.ref != 'refs/heads/master' }}
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup PHP 8.3
|
||||
if: ${{ github.ref != 'refs/heads/master' }}
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "8.3"
|
||||
- name: Cache phpDocumentor
|
||||
id: cache-phpdocumentor
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: phpDocumentor.phar
|
||||
key: phpdocumentor
|
||||
- name: Download latest phpDocumentor
|
||||
if: steps.cache-phpdocumentor.outputs.cache-hit != 'true'
|
||||
run: curl -O -L https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.4.3/phpDocumentor.phar
|
||||
- name: Generate documentation
|
||||
if: ${{ github.ref != 'refs/heads/master' }}
|
||||
run: php phpDocumentor.phar
|
||||
- name: Deploy documentation to GitHub Pages
|
||||
if: ${{ github.ref != 'refs/heads/master' }}
|
||||
uses: crazy-max/ghaction-github-pages@v2
|
||||
with:
|
||||
target_branch: gh-pages
|
||||
build_dir: docs/build/html
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
28
.gitignore
vendored
|
@ -1,10 +1,34 @@
|
|||
vendor/
|
||||
bin/
|
||||
# Composer files.
|
||||
/vendor
|
||||
composer.lock
|
||||
composer.phar
|
||||
|
||||
# Code Quality tools artifacts.
|
||||
coverage.xml
|
||||
test-report.xml
|
||||
phpunit.xml
|
||||
.php_cs.cache
|
||||
.phpunit.result.cache
|
||||
|
||||
# phpDocumentor files.
|
||||
.phpdoc
|
||||
docs
|
||||
phpDocumentor.phar
|
||||
|
||||
# Ignore autogenerated code.
|
||||
models/*.php
|
||||
models/checksum.json
|
||||
|
||||
# Different environment-related files.
|
||||
.idea
|
||||
.DS_Store
|
||||
.settings
|
||||
.buildpath
|
||||
.project
|
||||
.swp
|
||||
/nbproject
|
||||
.env
|
||||
|
||||
.docker
|
||||
docker*
|
||||
Makefile
|
||||
|
|
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2020 RetailDriver LLC
|
||||
|
||||
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.
|
328
README.md
|
@ -1,102 +1,286 @@
|
|||
# PHP-клиент для retailCRM API
|
||||
[](https://github.com/retailcrm/api-client-php/actions)
|
||||
[](https://codecov.io/gh/retailcrm/api-client-php)
|
||||
[](https://packagist.org/packages/retailcrm/api-client-php)
|
||||
[](https://packagist.org/packages/retailcrm/api-client-php)
|
||||
|
||||
PHP-клиент для работы с [retailCRM API](http://www.retailcrm.ru/docs/Разработчики/Разработчики#api).
|
||||
|
||||
## Обязательные требования
|
||||
# RetailCRM API PHP client
|
||||
|
||||
* PHP версии 5.3 и выше
|
||||
* PHP-расширение cURL
|
||||
This is the PHP RetailCRM API client. This library allows using of the actual API version.
|
||||
You can find more info in the [documentation](doc/index.md).
|
||||
|
||||
## Установка
|
||||
# Table of contents
|
||||
|
||||
1) Установите [composer](https://getcomposer.org/download/)
|
||||
* [Requirements](#requirements)
|
||||
* [Installation](#installation)
|
||||
* [Usage](#usage)
|
||||
* [Examples](#examples)
|
||||
* [Notes](#notes)
|
||||
* [Documentation](doc/index.md)
|
||||
|
||||
2) Выполните в папке проекта:
|
||||
## Requirements
|
||||
|
||||
* PHP 7.3 and above
|
||||
* PHP's cURL support
|
||||
* PHP's JSON support
|
||||
* Any HTTP client compatible with PSR-18 (covered by the installation instructions).
|
||||
* Any HTTP factories implementation compatible with PSR-17 (covered by the installation instructions).
|
||||
* Any HTTP messages implementation compatible with PSR-7 (covered by the installation instructions).
|
||||
* Other dependencies listed in the `composer.json` (covered by the installation instructions)
|
||||
|
||||
## Installation
|
||||
|
||||
Follow those steps to install the library:
|
||||
|
||||
1. Download and install [Composer](https://getcomposer.org/download/) package manager.
|
||||
2. Install the library from the Packagist by executing this command:
|
||||
```bash
|
||||
composer require retailcrm/api-client-php ~3.0.0
|
||||
composer require retailcrm/api-client-php:"~6.0"
|
||||
```
|
||||
During the installation you will see this message. Press `'y'` when you do:
|
||||
```sh
|
||||
civicrm/composer-compile-plugin contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
|
||||
Do you trust "civicrm/composer-compile-plugin" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?]
|
||||
```
|
||||
After that, you may see a message which will look like this:
|
||||
```sh
|
||||
The following packages have new compilation tasks:
|
||||
- retailcrm/api-client-php has 1 task
|
||||
|
||||
Allow these packages to compile? ([y]es, [a]lways, [n]o, [l]ist, [h]elp)
|
||||
```
|
||||
|
||||
В конфиг `composer.json` вашего проекта будет добавлена библиотека `retailcrm/api-client-php`, которая установится в папку `vendor/`. При отсутствии файла конфига или папки с вендорами они будут созданы.
|
||||
Choose `[a]lways` by typing `a` and pressing Enter.
|
||||
|
||||
В случае, если до этого в вашем проекте не использовался `composer`, подключите файл автозагрузки вендоров. Для этого укажите в коде проекта:
|
||||
**Note:** You should choose `'y'` and `[a]lways` if your application is using CI/CD pipeline because the interactive terminal is not available
|
||||
in that environment which will result in failure during the dependencies installation.
|
||||
|
||||
If you chose something else during the installation and API client doesn't work properly - please follow [these instructions](doc/compilation_prompt.md#ive-chosen-something-else-now-api-client-doesnt-work) to fix the problem.
|
||||
|
||||
3. Include the autoloader if it's not included, or you didn't use Composer before.
|
||||
```php
|
||||
require 'path/to/vendor/autoload.php';
|
||||
```
|
||||
|
||||
## Примеры использования
|
||||
Replace `path/to/vendor/autoload.php` with the correct path to Composer's `autoload.php`.
|
||||
|
||||
**Note:** API client uses `php-http/curl-client` and `nyholm/psr7` as a PSR-18, PSR-17 and PSR-7 implementation.
|
||||
You can replace those implementations during installation by installing this library with the implementation of your choice, like this:
|
||||
```sh
|
||||
composer require symfony/http-client guzzlehttp/psr7 retailcrm/api-client-php:"~6.0"
|
||||
```
|
||||
|
||||
More information about that can be found in the [documentation](doc/customization/different_psr_implementations.md).
|
||||
|
||||
## Usage
|
||||
|
||||
Firstly, you should initialize the Client. The easiest way to do this is to use the `SimpleClientFactory`:
|
||||
|
||||
### Получение информации о заказе
|
||||
```php
|
||||
$client = new \RetailCrm\ApiClient(
|
||||
'https://demo.intarocrm.ru',
|
||||
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH'
|
||||
);
|
||||
$client = \RetailCrm\Api\Factory\SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
```
|
||||
|
||||
The client is separated into several resource groups, all of which are accessible through the Client's public properties.
|
||||
You can call API methods from those groups like this:
|
||||
|
||||
```php
|
||||
$client->api->credentials();
|
||||
```
|
||||
|
||||
For example, you can retrieve the customers list:
|
||||
|
||||
```php
|
||||
$client = \RetailCrm\Api\Factory\SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
$response = $client->customers->list();
|
||||
```
|
||||
|
||||
Or the orders list:
|
||||
|
||||
```php
|
||||
$client = \RetailCrm\Api\Factory\SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
$response = $client->orders->list();
|
||||
```
|
||||
|
||||
To handle errors you must use two types of exceptions:
|
||||
* `RetailCrm\Api\Interfaces\ClientExceptionInterface` for the network or other runtime errors.
|
||||
* `RetailCrm\Api\Interfaces\ApiExceptionInterface` for the errors from the API.
|
||||
|
||||
An example of error handling can be found in the next section of this document.
|
||||
|
||||
Each resource group is responsible for the corresponding API section. For example, `costs` resource group provide methods
|
||||
for costs manipulation and `loyalty` resource group allows interacting with loyalty programs, accounts, bonuses, etc.
|
||||
|
||||
Use annotations to determine which DTOs you need for sending the requests. If annotations are not provided by your IDE - you
|
||||
probably should configure them. It'll ease your work with this (and any other) library a lot.
|
||||
|
||||
More information about the usage including examples can be found in the [documentation](doc/usage/usage.md).
|
||||
|
||||
## Examples
|
||||
|
||||
Listing orders:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use RetailCrm\Api\Interfaces\ClientExceptionInterface;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
use RetailCrm\Api\Model\Entity\CustomersCorporate\CustomerCorporate;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
|
||||
try {
|
||||
$response = $client->ordersGet('M-2342');
|
||||
} catch (\RetailCrm\Exception\CurlException $e) {
|
||||
echo "Сетевые проблемы. Ошибка подключения к retailCRM: " . $e->getMessage();
|
||||
$response = $client->orders->list();
|
||||
} catch (ApiExceptionInterface | ClientExceptionInterface $exception) {
|
||||
echo $exception; // Every ApiExceptionInterface and ClientExceptionInterface instance implements __toString() method.
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ($response->isSuccessful()) {
|
||||
echo $response->order['totalSumm'];
|
||||
// или $response['order']['totalSumm'];
|
||||
// или
|
||||
// $order = $response->getOrder();
|
||||
// $order['totalSumm'];
|
||||
} else {
|
||||
echo sprintf(
|
||||
"Ошибка получения информации о заказа: [Статус HTTP-ответа %s] %s",
|
||||
$response->getStatusCode(),
|
||||
$response->getErrorMsg()
|
||||
);
|
||||
|
||||
// получить детализацию ошибок
|
||||
//if (isset($response['errors'])) {
|
||||
// print_r($response['errors']);
|
||||
//}
|
||||
foreach ($response->orders as $order) {
|
||||
printf("Order ID: %d\n", $order->id);
|
||||
printf("First name: %s\n", $order->firstName);
|
||||
printf("Last name: %s\n", $order->lastName);
|
||||
printf("Patronymic: %s\n", $order->patronymic);
|
||||
printf("Phone #1: %s\n", $order->phone);
|
||||
printf("Phone #2: %s\n", $order->additionalPhone);
|
||||
printf("E-Mail: %s\n", $order->email);
|
||||
|
||||
if ($order->customer instanceof CustomerCorporate) {
|
||||
echo "Customer type: corporate\n";
|
||||
} else {
|
||||
echo "Customer type: individual\n";
|
||||
}
|
||||
|
||||
foreach ($order->items as $item) {
|
||||
echo PHP_EOL;
|
||||
|
||||
printf("Product name: %s\n", $item->productName);
|
||||
printf("Quantity: %d\n", $item->quantity);
|
||||
printf("Initial price: %f\n", $item->initialPrice);
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
|
||||
printf("Discount: %f\n", $order->discountManualAmount);
|
||||
printf("Total: %f\n", $order->totalSumm);
|
||||
|
||||
echo PHP_EOL;
|
||||
}
|
||||
```
|
||||
|
||||
### Создание заказа
|
||||
```php
|
||||
Fetching a specific order by it's ID:
|
||||
|
||||
$client = new \RetailCrm\ApiClient(
|
||||
'https://demo.intarocrm.ru',
|
||||
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH'
|
||||
);
|
||||
```php
|
||||
<?php
|
||||
|
||||
use RetailCrm\Api\Interfaces\ClientExceptionInterface;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
use RetailCrm\Api\Enum\ByIdentifier;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Model\Request\BySiteRequest;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
|
||||
try {
|
||||
$response = $client->ordersCreate(array(
|
||||
'externalId' => 'some-shop-order-id',
|
||||
'firstName' => 'Vasily',
|
||||
'lastName' => 'Pupkin',
|
||||
'items' => array(
|
||||
//...
|
||||
),
|
||||
'delivery' => array(
|
||||
'code' => 'russian-post',
|
||||
)
|
||||
));
|
||||
} catch (\RetailCrm\Exception\CurlException $e) {
|
||||
echo "Сетевые проблемы. Ошибка подключения к retailCRM: " . $e->getMessage();
|
||||
$response = $client->orders->get(1234, new BySiteRequest(ByIdentifier::ID, 'site'));
|
||||
} catch (ApiExceptionInterface | ClientExceptionInterface $exception) {
|
||||
echo $exception; // Every ApiExceptionInterface instance should implement __toString() method.
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ($response->isSuccessful() && 201 === $response->getStatusCode()) {
|
||||
echo 'Заказ успешно создан. ID заказа в retailCRM = ' . $response->id;
|
||||
// или $response['id'];
|
||||
// или $response->getId();
|
||||
} else {
|
||||
echo sprintf(
|
||||
"Ошибка создания заказа: [Статус HTTP-ответа %s] %s",
|
||||
$response->getStatusCode(),
|
||||
$response->getErrorMsg()
|
||||
);
|
||||
|
||||
// получить детализацию ошибок
|
||||
//if (isset($response['errors'])) {
|
||||
// print_r($response['errors']);
|
||||
//}
|
||||
}
|
||||
echo 'Order: ' . print_r($response->order, true);
|
||||
```
|
||||
|
||||
Creating a new customer:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use RetailCrm\Api\Interfaces\ClientExceptionInterface;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Model\Entity\Customers\Customer;
|
||||
use RetailCrm\Api\Model\Request\Customers\CustomersCreateRequest;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
|
||||
$request = new CustomersCreateRequest();
|
||||
$request->customer = new Customer();
|
||||
|
||||
$request->site = 'aliexpress';
|
||||
$request->customer->email = 'john.doe@example.com';
|
||||
$request->customer->firstName = 'John';
|
||||
$request->customer->lastName = 'Doe';
|
||||
|
||||
try {
|
||||
$response = $client->customers->create($request);
|
||||
} catch (ApiExceptionInterface | ClientExceptionInterface $exception) {
|
||||
echo $exception; // Every ApiExceptionInterface instance should implement __toString() method.
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
echo 'Customer ID: ' . $response->id;
|
||||
```
|
||||
|
||||
Creating a task for the user with a specific email:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use RetailCrm\Api\Interfaces\ClientExceptionInterface;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Model\Entity\Tasks\Task;use RetailCrm\Api\Model\Filter\Users\ApiUserFilter;
|
||||
use RetailCrm\Api\Model\Request\Tasks\TasksCreateRequest;
|
||||
use RetailCrm\Api\Model\Request\Users\UsersRequest;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
|
||||
$usersRequest = new UsersRequest();
|
||||
$usersRequest->filter = new ApiUserFilter();
|
||||
$usersRequest->filter->email = 'john.doe@example.com';
|
||||
|
||||
try {
|
||||
$usersResponse = $client->users->list($usersRequest);
|
||||
} catch (ApiExceptionInterface | ClientExceptionInterface $exception) {
|
||||
echo $exception; // Every ApiExceptionInterface instance should implement __toString() method.
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (0 === count($usersResponse->users)) {
|
||||
echo 'User is not found.';
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
$tasksRequest = new TasksCreateRequest();
|
||||
$tasksRequest->task = new Task();
|
||||
$tasksRequest->task->performerId = $usersResponse->users[0]->id;
|
||||
$tasksRequest->task->text = 'Do something!';
|
||||
$tasksRequest->site = 'site';
|
||||
|
||||
try {
|
||||
$tasksResponse = $client->tasks->create($tasksRequest);
|
||||
} catch (ApiExceptionInterface | ClientExceptionInterface $exception) {
|
||||
echo $exception; // Every ApiExceptionInterface instance should implement __toString() method.
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
echo 'Created task with ID: ' . $tasksResponse->id;
|
||||
```
|
||||
|
||||
|
||||
The error handling in the examples above is good enough for real production usage.
|
||||
You can safely assume that `ApiExceptionInterface` is an error from the API, and `ClientExceptionInterface` is a client error
|
||||
(e.g. network error or any runtime error, use `HttpClientException` to catch only PSR-18 client errors).
|
||||
However, you can implement more complex error handling if you want.
|
||||
|
||||
Also, both `ApiExceptionInterface` and `ClientExceptionInterface` implements `__toString()`. This means that you can just
|
||||
convert those exceptions to string and put the results into logs without any special treatment for the exception data.
|
||||
|
||||
More examples can be found in the [documentation](doc/usage/examples/index.md).
|
||||
|
||||
You can use a PSR-14 compatible event dispatcher to receive events from the client. See [documentation](doc/index.md) for details.
|
||||
|
||||
## Notes
|
||||
|
||||
This library uses HTTPlug abstractions. Visit [official documentation](http://docs.php-http.org/en/latest/httplug/users.html) to learn more about it.
|
||||
|
|
36
apigen.neon
|
@ -1,36 +0,0 @@
|
|||
extensions:
|
||||
- php
|
||||
|
||||
source:
|
||||
- lib
|
||||
|
||||
exclude:
|
||||
- tests/
|
||||
- vendor/
|
||||
- bin/
|
||||
- docs/
|
||||
|
||||
charset:
|
||||
- auto
|
||||
- UTF-8
|
||||
- Windows-1251
|
||||
|
||||
title: retailCRM PHP API client
|
||||
templateTheme: bootstrap
|
||||
groups: auto
|
||||
autocomplete:
|
||||
- classes
|
||||
- constants
|
||||
- methods
|
||||
- classconstants
|
||||
|
||||
accessLevels:
|
||||
- public
|
||||
|
||||
internal: true
|
||||
php: false
|
||||
tree: true
|
||||
deprecated: true
|
||||
todo: true
|
||||
destination: docs/api
|
||||
download: false
|
49
bin/retailcrm-client
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
namespace RetailCrm\Api;
|
||||
|
||||
use ReflectionClass;
|
||||
use RetailCrm\Api\Component\ComposerLocator;
|
||||
use RetailCrm\Api\Component\PhpFilesIterator;
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
|
||||
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
|
||||
}
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
require __DIR__ . '/../src/Component/ComposerLocator.php';
|
||||
|
||||
$composerAutoloader = ComposerLocator::findAutoloader();
|
||||
|
||||
if ('' === $composerAutoloader) {
|
||||
echo 'Cannot find autoload.php. Please install dependencies first.' . PHP_EOL;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
require $composerAutoloader;
|
||||
|
||||
if (!class_exists('Symfony\Component\Console\Application')) {
|
||||
echo 'Cannot find Symfony\Component\Console\Application class. Please install dependencies first.';
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
$application = new Application();
|
||||
$commands = new PhpFilesIterator(implode(DIRECTORY_SEPARATOR, [dirname(__DIR__), 'src', 'Command']));
|
||||
|
||||
foreach ($commands as $command) {
|
||||
if (!array_key_exists('fqn', $command)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$commandFqn = $command['fqn'];
|
||||
|
||||
if (class_exists($commandFqn) && !(new ReflectionClass($commandFqn))->isAbstract()) {
|
||||
$application->add(new $commandFqn());
|
||||
}
|
||||
}
|
||||
|
||||
$application->setName('RetailCRM API Client Management Tool');
|
||||
$application->run();
|
123
composer.json
|
@ -1,40 +1,121 @@
|
|||
{
|
||||
"name": "retailcrm/api-client-php",
|
||||
"description": "PHP client for retailCRM API",
|
||||
"description": "PHP client for RetailCRM API",
|
||||
"type": "library",
|
||||
"keywords": ["API", "retailCRM", "REST"],
|
||||
"homepage": "http://www.retailcrm.ru/",
|
||||
"keywords": [
|
||||
"API",
|
||||
"RetailCRM",
|
||||
"REST"
|
||||
],
|
||||
"homepage": "http://www.retailcrm.pro/",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "retailCRM",
|
||||
"email": "support@retailcrm.ru"
|
||||
"name": "RetailCRM",
|
||||
"email": "support@retailcrm.pro"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"ext-curl": "*"
|
||||
"php": ">=7.3",
|
||||
"ext-json": "*",
|
||||
"psr/log": "^1|^2|^3",
|
||||
"psr/http-client": "^1.0",
|
||||
"psr/http-message": "^1.0 || ^2.0",
|
||||
"psr/http-message-implementation": "^1.0",
|
||||
"php-http/client-implementation": "^1.0",
|
||||
"php-http/discovery": "^1.13",
|
||||
"doctrine/annotations": "^1.13|^2.0",
|
||||
"liip/serializer": "2.2.* || 2.6.*",
|
||||
"php-http/httplug": "^2.2",
|
||||
"civicrm/composer-compile-plugin": "^0.20",
|
||||
"symfony/console": "^4.0|^5.0|^6.0|^7.0",
|
||||
"psr/event-dispatcher": "^1.0",
|
||||
"neur0toxine/psr.http-client-implementation.php-http-curl": "*",
|
||||
"neur0toxine/psr.http-factory-implementation.nyholm": "*",
|
||||
"neur0toxine/psr.http-message-implementation.nyholm": "*",
|
||||
"psr/cache": "^1.0 || ^2.0 || ^3.0",
|
||||
"symfony/cache": ">=v3.1.0",
|
||||
"psr/http-factory": "^1.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.*",
|
||||
"phpmd/phpmd": "2.1.*",
|
||||
"sebastian/phpcpd": "2.0.*",
|
||||
"sebastian/phpdcd": "1.0.*",
|
||||
"squizlabs/php_codesniffer": "dev-master",
|
||||
"apigen/apigen": "dev-master"
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"phpmd/phpmd": "^2.10",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
|
||||
"phpcompatibility/php-compatibility": "^9.3",
|
||||
"phpstan/phpstan": "1.9.14",
|
||||
"vlucas/phpdotenv": "^5.3",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"php-http/curl-client": "^2.2",
|
||||
"nyholm/psr7": "^1.3",
|
||||
"league/event": "^3.0",
|
||||
"league/container": "^3.3",
|
||||
"neur0toxine/pock": "^0.11"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-curl": "Most HTTP clients need ext-curl to work properly.",
|
||||
"php-http/client-implementation": "PSR-18 compatible client should be available to use this library.",
|
||||
"psr/http-message-implementation": "PSR-7 compatible HTTP message implementation should be available to use to use this library.",
|
||||
"psr/http-factory-implementation": "PSR-17 compatible factories should be available to use this library.",
|
||||
"symfony/event-dispatcher": "PSR-14 compatible event dispatcher.",
|
||||
"league/event": "PSR-14 compatible event dispatcher.",
|
||||
"nyholm/psr7": "This is recommended PSR-7 and PSR-17 implementation.",
|
||||
"php-http/curl-client": "Simplest PSR-18 client implementation.",
|
||||
"symfony/http-client": "One of the most popular HTTP clients. Has PSR-18 compatible adapter.",
|
||||
"psr/log-implementation": "You can use log implementation for debug purposes."
|
||||
},
|
||||
"scripts": {
|
||||
"phpunit": "./vendor/bin/phpunit -c phpunit.xml.dist --coverage-text",
|
||||
"phpunit-ci": "@php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude=\"~vendor~\" ./vendor/bin/phpunit --teamcity -c phpunit.xml.dist",
|
||||
"phpmd": "./vendor/bin/phpmd src text ./phpmd.xml",
|
||||
"phpcs": "./vendor/bin/phpcs -p src --runtime-set testVersion 7.3-8.3 && ./vendor/bin/phpcs -p tests --runtime-set testVersion 7.3-8.3 --warning-severity=0",
|
||||
"phpstan": "./vendor/bin/phpstan analyse -c phpstan.neon src --memory-limit=-1",
|
||||
"phpstan-dockerized-ci": "docker run --rm -it -w=/app -v ${PWD}:/app oskarstark/phpstan-ga:1.0.1 analyse src -c phpstan.neon --memory-limit=1G --no-progress",
|
||||
"lint:fix": "./vendor/bin/phpcbf src",
|
||||
"lint": [
|
||||
"@phpcs",
|
||||
"@phpmd",
|
||||
"@phpstan"
|
||||
],
|
||||
"verify": [
|
||||
"@lint",
|
||||
"@phpunit"
|
||||
],
|
||||
"models": "@php bin/retailcrm-client models:generate --all"
|
||||
},
|
||||
"support": {
|
||||
"email": "support@intarocrm.ru"
|
||||
"email": "support@retailcrm.pro"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "RetailCrm\\": "lib/" }
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0.x-dev"
|
||||
"psr-4": {
|
||||
"RetailCrm\\Api\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"RetailCrm\\TestUtils\\": "tests/utils/",
|
||||
"RetailCrm\\Tests\\": "tests/src/"
|
||||
}
|
||||
},
|
||||
"bin": [
|
||||
"bin/retailcrm-client"
|
||||
],
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.x-dev"
|
||||
},
|
||||
"compile": [
|
||||
{
|
||||
"run": "@composer run-script models"
|
||||
}
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin",
|
||||
"process-timeout": 600
|
||||
"bin-dir": "vendor/bin",
|
||||
"process-timeout": 600,
|
||||
"allow-plugins": {
|
||||
"civicrm/composer-compile-plugin": true,
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
109
doc/compilation_prompt.md
Normal file
|
@ -0,0 +1,109 @@
|
|||
## Dealing with `civicrm/composer-compile-plugin` prompts
|
||||
|
||||
During installation you will see this prompt:
|
||||
```sh
|
||||
civicrm/composer-compile-plugin contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
|
||||
Do you trust "civicrm/composer-compile-plugin" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?]
|
||||
```
|
||||
|
||||
And after almost any Composer operation you will see this prompt:
|
||||
```sh
|
||||
The following packages have new compilation tasks:
|
||||
- retailcrm/api-client-php has 1 task
|
||||
|
||||
Allow these packages to compile? ([y]es, [a]lways, [n]o, [l]ist, [h]elp)
|
||||
```
|
||||
|
||||
That's because the API client utilizes code generation to speed up the serialization and deserialization of the requests. However,
|
||||
these prompts may be annoying and sometimes can even break the application lifecycle pipeline (in the CI/CD environment). We can't just
|
||||
disable it for everyone [because of security concerns](https://github.com/composer/composer/issues/1193). But you can disable it for your project.
|
||||
|
||||
There are three ways of disabling this prompt:
|
||||
1. During the installation.
|
||||
2. Automated way.
|
||||
3. Manual way.
|
||||
|
||||
### Disable compilation prompts during the installation
|
||||
|
||||
Press `'y'` when you see this message:
|
||||
```sh
|
||||
civicrm/composer-compile-plugin contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
|
||||
Do you trust "civicrm/composer-compile-plugin" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?]
|
||||
```
|
||||
|
||||
And when you see this prompt, press `'a'`:
|
||||
```sh
|
||||
The following packages have new compilation tasks:
|
||||
- retailcrm/api-client-php has 1 task
|
||||
|
||||
Allow these packages to compile? ([y]es, [a]lways, [n]o, [l]ist, [h]elp)
|
||||
```
|
||||
|
||||
That's it. Code generation is now enabled.
|
||||
|
||||
### I've chosen something else, now API client doesn't work!
|
||||
|
||||
That happens. We provide special CLI utility which will automatically configure your `composer.json` to enable code generation.
|
||||
Just run this command inside your project after API client installation:
|
||||
```sh
|
||||
./vendor/bin/retailcrm-client compiler:prompt
|
||||
```
|
||||
|
||||
You should see this message after running the command:
|
||||
```sh
|
||||
✓ Done, code generation has been enabled.
|
||||
```
|
||||
|
||||
You may also want to run code generation manually once. It can be achieved by running this command:
|
||||
```sh
|
||||
composer compile --all
|
||||
```
|
||||
|
||||
**Note:** `retailcrm-client` should be in your binary directory. By default it is set to `vendor/bin`. You can check `config.bin-dir`
|
||||
value in your `composer.json` and update paths in the commands above accordingly.
|
||||
**Note (2):** `compiler:prompt` command has `--revert` flag. You can use it if you want to disable automatic code generation for some reason.
|
||||
|
||||
### Disabling compilation prompts manually
|
||||
|
||||
It is possible to replicate the same actions manually. First, you will need to enable compiler plugin. Add the plugin
|
||||
to the `config.allow-plugins` segment of your `composer.json` file:
|
||||
|
||||
```json
|
||||
"allow-plugins": {
|
||||
"civicrm/composer-compile-plugin": true
|
||||
}
|
||||
```
|
||||
|
||||
After that add these params into the `extra` segment of your `composer.json`:
|
||||
|
||||
```json
|
||||
"compile-mode": "whitelist",
|
||||
"compile-whitelist": ["retailcrm/api-client-php"]
|
||||
```
|
||||
|
||||
Your `composer.json` file should look like this:
|
||||
```json
|
||||
{
|
||||
"name": "author/some-project",
|
||||
"description": "Description of the project.",
|
||||
"type": "project",
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": ">=7.3.0",
|
||||
"symfony/http-client": "^5.2",
|
||||
"nyholm/psr7": "^1.4",
|
||||
"retailcrm/api-client-php": "~6.0"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"civicrm/composer-compile-plugin": true
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"compile-mode": "whitelist",
|
||||
"compile-whitelist": ["retailcrm/api-client-php"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Voilà! You won't see the annoying prompt again.
|
20
doc/customization/customization.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
## Customization
|
||||
|
||||
* [Controlling HTTP abstraction layer](different_psr_implementations.md)
|
||||
* [Customizing request and response processing](pipelines/implementing_a_handler.md)
|
||||
+ [Using a predefined handler](pipelines/using_a_predefined_handler.md)
|
||||
+ [Built-in handlers](pipelines/using_a_predefined_handler.md#built-in-handlers)
|
||||
+ [Modifying the default pipeline](pipelines/using_a_predefined_handler.md#modifying-the-default-pipeline)
|
||||
+ [Constructing the pipeline from scratch](pipelines/using_a_predefined_handler.md#constructing-the-pipeline-from-scratch)
|
||||
+ [Implementing a handler](pipelines/implementing_a_handler.md)
|
||||
* [Implementing custom API methods](implementing_custom_api_methods.md)
|
||||
|
||||
Both `ClientFactory` and `ClientBuilder` provide the necessary functionality to replace PSR dependencies with any other compatible implementation.
|
||||
By default, those dependencies will be detected via service discovery. But service discovery supports a limited amount of implementation.
|
||||
If your implementation is not supported - the client won't work unless you provide the necessary dependencies manually.
|
||||
Another case would be testing. You can provide special HTTP client implementation which will return mocked responses instead of making
|
||||
real requests.
|
||||
|
||||
The Client uses [chain of responsibility](https://refactoring.guru/design-patterns/chain-of-responsibility) pattern to process requests.
|
||||
Each request and response is being processed by the pipeline of handlers. Every handler can apply some mutation to the request or response
|
||||
and can pass it to the next handler. In fact, API authentication is made possible by using a special handler which appends API key to every request.
|
69
doc/customization/different_psr_implementations.md
Normal file
|
@ -0,0 +1,69 @@
|
|||
## Controlling HTTP abstraction layer
|
||||
|
||||
You can replace default PSR dependencies in the client while using `ClientFactory` or `ClientBuilder`. It can be useful for tests
|
||||
or if you want to use a specific implementation that is not supported by the service discovery.
|
||||
|
||||
Both `ClientFactory` and `ClientBuilder` provide those methods:
|
||||
|
||||
```php
|
||||
/**
|
||||
* Set your PSR-18 HTTP client.
|
||||
*
|
||||
* Service discovery will be used if no client has been provided.
|
||||
*
|
||||
* @param \Psr\Http\Client\ClientInterface $httpClient
|
||||
*/
|
||||
public function setHttpClient(\Psr\Http\Client\ClientInterface $httpClient);
|
||||
|
||||
/**
|
||||
* Sets PSR-17 compatible stream factory. You can skip this step if you want to use service discovery.
|
||||
*
|
||||
* @param \Psr\Http\Message\StreamFactoryInterface|null $streamFactory
|
||||
*/
|
||||
public function setStreamFactory(?\Psr\Http\Message\StreamFactoryInterface $streamFactory);
|
||||
|
||||
/**
|
||||
* Sets PSR-17 compatible request factory. You can skip this step if you want to use service discovery.
|
||||
*
|
||||
* @param \Psr\Http\Message\RequestFactoryInterface|null $requestFactory
|
||||
*/
|
||||
public function setRequestFactory(?\Psr\Http\Message\RequestFactoryInterface $requestFactory);
|
||||
|
||||
/**
|
||||
* Sets PSR-17 compatible URI factory. You can skip this step if you want to use service discovery.
|
||||
*
|
||||
* @param \Psr\Http\Message\UriFactoryInterface|null $uriFactory
|
||||
*/
|
||||
public function setUriFactory(?\Psr\Http\Message\UriFactoryInterface $uriFactory);
|
||||
```
|
||||
|
||||
They can be used to specify PSR dependencies like this:
|
||||
|
||||
```php
|
||||
$psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
|
||||
$factory = new \RetailCrm\Api\Factory\ClientFactory();
|
||||
$factory->setHttpClient(new \Http\Client\Curl\Client())
|
||||
->setRequestFactory($psr17Factory)
|
||||
->setStreamFactory($psr17Factory)
|
||||
->setUriFactory($psr17Factory);
|
||||
|
||||
$client = $factory->createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
```
|
||||
|
||||
Or like this:
|
||||
|
||||
```php
|
||||
$psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
|
||||
$builder = new \RetailCrm\Api\Builder\ClientBuilder();
|
||||
$client = $builder
|
||||
->setApiUrl('https://test.retailcrm.pro')
|
||||
->setAuthenticatorHandler(new \RetailCrm\Api\Handler\Request\HeaderAuthenticatorHandler('apiKey'))
|
||||
->setHttpClient(new \Http\Client\Curl\Client())
|
||||
->setRequestFactory($psr17Factory)
|
||||
->setStreamFactory($psr17Factory)
|
||||
->setUriFactory($psr17Factory)
|
||||
->build();
|
||||
```
|
||||
|
||||
By replacing the HTTP client in the test environment you can easily mock requests and responses via libraries like
|
||||
[`neur0toxine/pock`](https://packagist.org/packages/neur0toxine/pock) or [`php-http/mock-client`](https://packagist.org/packages/php-http/mock-client).
|
|
@ -0,0 +1,28 @@
|
|||
# Custom API methods with DTO
|
||||
|
||||
This example demonstrates how you can use your custom serializer with custom DTOs to implement API methods.
|
||||
|
||||
## How to run the project
|
||||
|
||||
1. Open `app.php` and change credentials and the site to your data.
|
||||
2. Run these commands:
|
||||
```sh
|
||||
composer install
|
||||
php app.php
|
||||
```
|
||||
|
||||
You will see something like this:
|
||||
```sh
|
||||
Created customer using custom methods. ID: 5633
|
||||
```
|
||||
|
||||
This means that the project works as expected.
|
||||
|
||||
## Navigation
|
||||
|
||||
- [`app.php`](app.php) - entrypoint, calls the custom method and outputs the response data.
|
||||
- [`src/Component/Adapter/SymfonyToLiipAdapter.php`](src/Component/Adapter/SymfonyToLiipAdapter.php) - adapter for using `symfony/serializer` inside `FormEncoder` component.
|
||||
- [`src/Component/CustomApiMethod.php`](src/Component/CustomApiMethod.php) - `CustomApiMethod` that uses `SerializerInterface` from `liip/serializer` and `FormEncoder`. This component will handle marshaling.
|
||||
- [`src/Dto`](src/Dto) - data models used in the project.
|
||||
- [`src/Factory/SerializerFactory.php`](src/Factory/SerializerFactory.php) - builds `symfony/serializer`'s serializer and wraps it into the `SymfonyToLiipAdapter`.
|
||||
- [`src/Factory/ClientFactory.php`](src/Factory/ClientFactory.php) - custom client factory that register the custom API method.
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
use RetailCrm\Api\Builder\FormEncoderBuilder;
|
||||
use RetailCrm\Examples\CustomMethodsDto\Dto\Customer;
|
||||
use RetailCrm\Examples\CustomMethodsDto\Dto\Request\CustomersCreateRequest;
|
||||
use RetailCrm\Examples\CustomMethodsDto\Factory\ClientFactory;
|
||||
use RetailCrm\Examples\CustomMethodsDto\Factory\SerializerFactory;
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
// Three lines below will be usually called during DI container building or hidden by other means.
|
||||
$serializer = SerializerFactory::create();
|
||||
$encoder = (new FormEncoderBuilder())->setSerializer($serializer)->build();
|
||||
$clientFactory = (new ClientFactory())->setCustomEncoder($encoder);
|
||||
|
||||
// Replace API URL and API key with your data.
|
||||
$client = $clientFactory->createClient('https://test.simla.com', 'apiKey');
|
||||
|
||||
$request = new CustomersCreateRequest();
|
||||
$request->customer = new Customer();
|
||||
$request->customer->firstName = 'Tester';
|
||||
$request->customer->lastName = 'User';
|
||||
$request->customer->patronymic = 'Patronymic';
|
||||
$request->site = 'site'; // Replace site with your data.
|
||||
|
||||
/** @var \Retailcrm\Examples\CustomMethodsDto\Dto\Response\CustomersCreateResponse $response */
|
||||
$response = $client->customMethods->createCustomer($request);
|
||||
|
||||
echo 'Created customer using custom methods. ID: ' . $response->id;
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "retailcrm/custom-api-methods-with-dto-example",
|
||||
"description": "This project demonstrates DTO usage with the custom methods.",
|
||||
"type": "project",
|
||||
"require": {
|
||||
"retailcrm/api-client-php": "^6",
|
||||
"symfony/serializer": "^5.3",
|
||||
"symfony/property-access": "^5.3"
|
||||
},
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"RetailCrm\\Examples\\CustomMethodsDto\\": "src/"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category SymfonyToLiipAdapter
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Component\Adapter
|
||||
*/
|
||||
|
||||
namespace Retailcrm\Examples\CustomMethodsDto\Component\Adapter;
|
||||
|
||||
use Liip\Serializer\Context;
|
||||
use Liip\Serializer\SerializerInterface;
|
||||
use Symfony\Component\Serializer\Serializer as SymfonySerializer;
|
||||
|
||||
/**
|
||||
* Class SymfonyToLiipAdapter
|
||||
*
|
||||
* @category SymfonyToLiipAdapter
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Component\Adapter
|
||||
*/
|
||||
class SymfonyToLiipAdapter implements SerializerInterface
|
||||
{
|
||||
/** @var SymfonySerializer */
|
||||
private $serializer;
|
||||
|
||||
public function __construct(SymfonySerializer $serializer)
|
||||
{
|
||||
$this->serializer = $serializer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function serialize($data, string $format, Context $context = null): string
|
||||
{
|
||||
return $this->serializer->serialize($data, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function deserialize(string $data, string $type, string $format, Context $context = null)
|
||||
{
|
||||
return $this->serializer->deserialize($data, $type, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws \Symfony\Component\Serializer\Exception\ExceptionInterface
|
||||
*/
|
||||
public function toArray($data, Context $context = null): array
|
||||
{
|
||||
return $this->serializer->normalize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws \Symfony\Component\Serializer\Exception\ExceptionInterface
|
||||
*/
|
||||
public function fromArray(array $data, string $type, Context $context = null)
|
||||
{
|
||||
return $this->serializer->denormalize($data, $type);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category CustomApiMethod
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Component
|
||||
*/
|
||||
|
||||
namespace Retailcrm\Examples\CustomMethodsDto\Component;
|
||||
|
||||
use RetailCrm\Api\Exception\Client\HandlerException;
|
||||
use RetailCrm\Api\Interfaces\FormEncoderInterface;
|
||||
use RetailCrm\Api\Interfaces\RequestSenderInterface;
|
||||
|
||||
/**
|
||||
* Class CustomApiMethod
|
||||
*
|
||||
* @category CustomApiMethod
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Component
|
||||
*/
|
||||
class CustomApiMethod extends \RetailCrm\Api\Component\CustomApiMethod
|
||||
{
|
||||
/** @var string */
|
||||
private $responseFqn;
|
||||
|
||||
/** @var FormEncoderInterface */
|
||||
private $encoder;
|
||||
|
||||
public function __construct(string $method, string $route, string $responseFqn, FormEncoderInterface $encoder)
|
||||
{
|
||||
parent::__construct($method, $route);
|
||||
|
||||
$this->responseFqn = $responseFqn;
|
||||
$this->encoder = $encoder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the request, returns the response.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\RequestSenderInterface $sender
|
||||
* @param array<int|string, mixed>|object $data
|
||||
*
|
||||
* @return object
|
||||
* @throws \RetailCrm\Api\Exception\ApiException
|
||||
* @throws \RetailCrm\Api\Exception\ClientException
|
||||
* @throws \RetailCrm\Api\Exception\Client\HandlerException
|
||||
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
|
||||
*/
|
||||
public function __invoke(RequestSenderInterface $sender, $data = [])
|
||||
{
|
||||
if (is_object($data)) {
|
||||
$data = $this->encoder->encodeArray($data);
|
||||
}
|
||||
|
||||
$result = parent::__invoke($sender, $data);
|
||||
|
||||
try {
|
||||
return $this->encoder->getSerializer()->fromArray($result, $this->responseFqn);
|
||||
} catch (\Throwable $throwable) {
|
||||
throw new HandlerException(
|
||||
'Cannot deserialize body: ' . $throwable->getMessage(),
|
||||
0,
|
||||
$throwable
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category Customer
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Dto
|
||||
*/
|
||||
|
||||
namespace Retailcrm\Examples\CustomMethodsDto\Dto;
|
||||
|
||||
/**
|
||||
* Class Customer
|
||||
*
|
||||
* @category Customer
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Dto
|
||||
*/
|
||||
class Customer
|
||||
{
|
||||
/** @var string */
|
||||
public $firstName;
|
||||
|
||||
/** @var string */
|
||||
public $lastName;
|
||||
|
||||
/** @var string */
|
||||
public $patronymic;
|
||||
|
||||
/** @var string */
|
||||
public $email;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category CustomersCreateRequest
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Dto\Request
|
||||
*/
|
||||
|
||||
namespace Retailcrm\Examples\CustomMethodsDto\Dto\Request;
|
||||
|
||||
use RetailCrm\Api\Component\FormData\Mapping as Form;
|
||||
|
||||
/**
|
||||
* Class CustomersCreateRequest
|
||||
*
|
||||
* @category CustomersCreateRequest
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Dto\Request
|
||||
*/
|
||||
class CustomersCreateRequest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @Form\Type("string")
|
||||
* @Form\SerializedName("site")
|
||||
*/
|
||||
public $site;
|
||||
|
||||
/**
|
||||
* @var \Retailcrm\Examples\CustomMethodsDto\Dto\Customer
|
||||
*
|
||||
* @Form\Type("Retailcrm\Examples\CustomMethodsDto\Dto\Customer")
|
||||
* @Form\SerializedName("customer")
|
||||
* @Form\JsonField()
|
||||
*/
|
||||
public $customer;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category CustomersCreateResponse
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Dto\Response
|
||||
*/
|
||||
|
||||
namespace Retailcrm\Examples\CustomMethodsDto\Dto\Response;
|
||||
|
||||
/**
|
||||
* Class CustomersCreateResponse
|
||||
*
|
||||
* @category CustomersCreateResponse
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Dto\Response
|
||||
*/
|
||||
class CustomersCreateResponse
|
||||
{
|
||||
/** @var int */
|
||||
public $id;
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category ClientFactory
|
||||
* @package RetailCrm\Examples\CustomMethodsDto\Factory
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Examples\CustomMethodsDto\Factory;
|
||||
|
||||
use RetailCrm\Api\Client;
|
||||
use RetailCrm\Api\Enum\RequestMethod;
|
||||
use RetailCrm\Api\Factory\ClientFactory as Base;
|
||||
use RetailCrm\Api\Interfaces\FormEncoderInterface;
|
||||
use RetailCrm\Examples\CustomMethodsDto\Component\CustomApiMethod;
|
||||
use RetailCrm\Examples\CustomMethodsDto\Dto\Response\CustomersCreateResponse;
|
||||
|
||||
/**
|
||||
* Class ClientFactory
|
||||
*
|
||||
* @category ClientFactory
|
||||
* @package RetailCrm\Examples\CustomMethodsDto\Factory
|
||||
*/
|
||||
class ClientFactory extends Base
|
||||
{
|
||||
/** @var \RetailCrm\Api\Interfaces\FormEncoderInterface */
|
||||
private $customEncoder;
|
||||
|
||||
public function setCustomEncoder(FormEncoderInterface $customEncoder): ClientFactory
|
||||
{
|
||||
$this->customEncoder = $customEncoder;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function createClient(string $apiUrl, string $apiKey): Client
|
||||
{
|
||||
$client = parent::createClient($apiUrl, $apiKey);
|
||||
$client->customMethods->register(
|
||||
'createCustomer',
|
||||
$this->method(
|
||||
RequestMethod::POST,
|
||||
'customers/create',
|
||||
CustomersCreateResponse::class
|
||||
)
|
||||
);
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
||||
private function method(string $method, string $route, string $responseFqn): CustomApiMethod
|
||||
{
|
||||
return new CustomApiMethod($method, $route, $responseFqn, $this->customEncoder);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category SerializerFactory
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Factory
|
||||
*/
|
||||
|
||||
namespace Retailcrm\Examples\CustomMethodsDto\Factory;
|
||||
|
||||
use Liip\Serializer\SerializerInterface;
|
||||
use RetailCrm\Examples\CustomMethodsDto\Component\Adapter\SymfonyToLiipAdapter;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Serializer\Encoder\JsonEncoder;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||
|
||||
/**
|
||||
* Class SerializerFactory
|
||||
*
|
||||
* @category SerializerFactory
|
||||
* @package Retailcrm\Examples\CustomMethodsDto\Factory
|
||||
*/
|
||||
class SerializerFactory
|
||||
{
|
||||
public static function create(): SerializerInterface
|
||||
{
|
||||
return new SymfonyToLiipAdapter(new Serializer([new ObjectNormalizer()], [new JsonEncoder()]));
|
||||
}
|
||||
}
|
106
doc/customization/implementing_custom_api_methods.md
Normal file
|
@ -0,0 +1,106 @@
|
|||
## Implementing custom API methods
|
||||
|
||||
You can use this feature if you need to group multiple API calls, or return something custom - not the API response as-is,
|
||||
or, for example, to use new API methods without waiting for the implementation. For all of those cases, we provide a special
|
||||
resource group in the client that will make it easy to implement a custom API method.
|
||||
|
||||
The main limitation of this mechanism is the lack of DTO. You will be limited to arrays inside custom methods. It is
|
||||
_possible_ to use custom DTO's for the custom methods, but it is a little tricky - check the bottom of this page for the example.
|
||||
|
||||
Let's imagine that we have a special method with this route: `/api/v5/dialogs`. This method returns a list of the dialogs present in the system.
|
||||
We cannot use it directly because it is not implemented in the client. However, we can implement it by ourselves using custom methods.
|
||||
It will look like this:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Component\CustomApiMethod;
|
||||
use RetailCrm\Api\Enum\RequestMethod;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.simla.io', 'key');
|
||||
$client->customMethods->register('dialogs', new CustomApiMethod(RequestMethod::GET, 'dialogs'));
|
||||
|
||||
try {
|
||||
$dialogs = $client->customMethods->call('dialogs');
|
||||
} catch (ApiExceptionInterface $exception) {
|
||||
echo sprintf(
|
||||
'Error from RetailCRM API (status code: %d): %s',
|
||||
$exception->getStatusCode(),
|
||||
$exception->getMessage()
|
||||
);
|
||||
|
||||
if (count($exception->getErrorResponse()->errors) > 0) {
|
||||
echo PHP_EOL . 'Errors: ' . implode(', ', $exception->getErrorResponse()->errors);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
echo 'Dialogs: ' . print_r($dialogs['dialogs'], true);
|
||||
```
|
||||
|
||||
First, we need to register the custom method in the client. To do this we must give our method a name and an implementation.
|
||||
The name will be used to call the method later using `call()` and the implementation is just a callable with the three
|
||||
parameters: `RequestSenderInterface`, data array, and the context. Let's take a look at all three.
|
||||
|
||||
1. `RequestSenderInterface` is implemented by the `RequestSender` and contains three methods: `send`, `route` and `host`.
|
||||
`send` is used to send the request, `route` will append the base URL to your method name, and the latter, `host`, will return
|
||||
hostname from the base URL.
|
||||
2. The data array contains any data that has been provided to the callable during the method call. It will be encoded as
|
||||
a query string and stored either as the URL params or as the form body (query string is used for GET and DELETE requests).
|
||||
3. The context contains any information provided to the callable during the method call. It is not checked by the client.
|
||||
However, it is always must be of array type.
|
||||
|
||||
As you can see, we're using `CustomApiMethod` as a callable in the example. The `CustomApiMethod` is a simple invokable
|
||||
wrapper that can be used to simplify the registration of the new methods. The boilerplate code in the previous example is
|
||||
already implemented inside the `CustomApiMethod` component.
|
||||
|
||||
It is easier to understand how the callable should work and how the `CustomApiMethod` works by looking at the registration example.
|
||||
It works exactly like the previous example, but without the `CustomApiMethod` component:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Enum\RequestMethod;
|
||||
use RetailCrm\Api\Interfaces\RequestSenderInterface;
|
||||
|
||||
$client->customMethods->register('dialogs', function (RequestSenderInterface $sender, $data, array $context) {
|
||||
return $sender->send(RequestMethod::GET, $sender->route('dialogs'), $data);
|
||||
});
|
||||
```
|
||||
|
||||
The data here is not defined as array because it can be anything you like. You can use any serializer to serialize the data
|
||||
and deserialize the response. `CustomApiMethod` only supports array out-of-box, but your handlers can utilize any
|
||||
data types.
|
||||
|
||||
The base URL inside the client is always represented as a URL with the version suffix. It should be always kept in mind
|
||||
while using the `route` method:
|
||||
|
||||
```php
|
||||
// This code is being executed inside the custom method callable.
|
||||
// Base URL is http://test.simla.io/api/v5
|
||||
|
||||
$settingsRoute = $sender->route('settings');
|
||||
$host = $sender->host();
|
||||
|
||||
echo $settingsRoute; // prints "https://test.simla.io/api/v5/settings" - the slash is inserted by the route() method.
|
||||
echo $host; // prints "test.simla.io"
|
||||
```
|
||||
|
||||
Any registered custom method can be called using the `__call` magic method:
|
||||
|
||||
```php
|
||||
// Both calls below works the same.
|
||||
|
||||
$client->customMethods->call('dialogs', ['param' => 'value'], ['contextParam' => 'contextValue']);
|
||||
$client->customMethods->dialogs(['param' => 'value'], ['contextParam' => 'contextValue']);
|
||||
```
|
||||
|
||||
The last notable difference from the regular methods lies inside events. You won't be able to get request or response models
|
||||
from the events, but you can extract the response array using the `getResponseArray()` method.
|
||||
|
||||
## Using DTOs with the custom methods
|
||||
|
||||
You can use DTOs with the custom methods. To do that you just need to serialize the request models inside the method callback
|
||||
before sending the request and deserialize the response before returning it. We already made a great example project that
|
||||
demonstrates the DTO usage alongside custom methods.
|
||||
|
||||
[**DTOs with the custom methods - sample project**](examples/custom-api-methods-with-dto)
|
23
doc/customization/pipelines/implementing_a_handler.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
## Implementing a handler
|
||||
|
||||
You can implement your own handler using the `RetailCrm\Api\Interfaces\HandlerInterface`.
|
||||
`RetailCrm\Api\Handler\AbstractHandler` provides boilerplate code for the chain of responsibility.
|
||||
`AbstractHandler::next` method will call next handler in the chain. You can safely use `return parent::next()` in your code
|
||||
while using `AbstractHandler`.
|
||||
|
||||
Most of the information about how handlers operate can be found in the [chain of responsibility](https://refactoring.guru/design-patterns/chain-of-responsibility)
|
||||
pattern explanation. There are some specific details about handlers in the client. Client will pass desired dependencies to
|
||||
the handler if handler implements one of those interfaces:
|
||||
|
||||
* Any request handler
|
||||
+ `RetailCrm\Api\Interfaces\PsrFactoriesAwareInterface` will inject PSR-17 factories into the handler.
|
||||
* Any response handler
|
||||
+ `RetailCrm\Api\Interfaces\SerializerAwareInterface` will inject a `liip/serializer` instance into the handler.
|
||||
+ `RetailCrm\Api\Interfaces\ApiExceptionFactoryAwareInterface` will inject a `Liip\Serializer\SerializerInterface` instance into the handler.
|
||||
+ `RetailCrm\Api\Interfaces\EventDispatcherAwareInterface` will inject a `Psr\EventDispatcher\EventDispatcherInterface` instance into the handler.
|
||||
|
||||
All of those interfaces above have the corresponding implementation traits in the `RetailCrm\Api\Traits` namespace.
|
||||
For example, `RetailCrm\Api\Interfaces\EventDispatcherAwareInterface` implementation can be found in the
|
||||
`RetailCrm\Api\Traits\EventDispatcherAwareTrait` trait.
|
||||
|
||||
Handlers can be used in the both chains just like callback handlers (see ["using a predefined hander"](using_a_predefined_handler.md)).
|
292
doc/customization/pipelines/using_a_predefined_handler.md
Normal file
|
@ -0,0 +1,292 @@
|
|||
## Using a predefined handler
|
||||
|
||||
* [Built-in handlers](#built-in-handlers)
|
||||
* [Modifying the default pipeline](#modifying-the-default-pipeline)
|
||||
* [Constructing the pipeline from scratch](#constructing-the-pipeline-from-scratch)
|
||||
|
||||
### Built-in handlers
|
||||
|
||||
You can use a predefined handler to modify the process of request or response processing. Most of the predefined handlers are
|
||||
already in use by the client, except for the `CallbackRequestHandler` and `CallbackResponseHandler`.
|
||||
|
||||
Those are handlers that are present in the client and can be used for request processing:
|
||||
* `CallbackRequestHandler` - processes a request using provided callback.
|
||||
* `GetParameterAuthenticatorHandler` - appends a GET `apiKey` parameter with the API key.
|
||||
* `HeaderAuthenticatorHandler` - appends `X-Api-Key` header with the API key.
|
||||
* `PsrRequestHandler` - constructs base PSR-7 request with method and URI.
|
||||
* `RequestDataHandler` - fills base PSR-7 request with the data from the DTO.
|
||||
|
||||
Request handlers are using `RetailCrm\Api\Model\RequestData` DTO to share state between handlers.
|
||||
|
||||
Those are handlers that can be used for response processing:
|
||||
* `AccountNotFoundHandler` - detects when RetailCRM with specified API URL is not exist and throws specified exception.
|
||||
* `CallbackResponseHandler` - processes a response using provided callback.
|
||||
* `ErrorResponseHandler` - detects an error response, throws correct exception.
|
||||
* `FilesDownloadResponseHandler` - handles `/api/v5/files/download` response.
|
||||
* `UnmarshalResponseHandler` - unmarshals response body into response DTO.
|
||||
|
||||
Response handlers are using `RetailCrm\Api\Model\ResponseData` DTO to share state between handlers.
|
||||
|
||||
There are two built-in handlers which are most useful to users who want to modify the processing pipelines: `CallbackRequestHandler` and
|
||||
`CallbackResponseHandler`. Both handlers use provided callbacks to modify a request or response. You can initialize those
|
||||
with the examples below:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Handler\Request\CallbackRequestHandler;
|
||||
use RetailCrm\Api\Model\RequestData;
|
||||
use Psr\Http\Message\RequestFactoryInterface;
|
||||
use Psr\Http\Message\StreamFactoryInterface;
|
||||
use Psr\Http\Message\UriFactoryInterface;
|
||||
|
||||
$handler = new CallbackRequestHandler(
|
||||
static function (
|
||||
RequestData $requestData,
|
||||
RequestFactoryInterface $requestFactory,
|
||||
StreamFactoryInterface $streamFactory,
|
||||
UriFactoryInterface $uriFactory
|
||||
) {
|
||||
if (null !== $requestData->request) {
|
||||
$requestData->request = $requestData->request->withHeader('X-Rlimit-Token', 'example_token');
|
||||
}
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Exception\Api\MissingParameterException;
|
||||
use RetailCrm\Api\Factory\ApiExceptionFactory;
|
||||
use RetailCrm\Api\Handler\Response\CallbackResponseHandler;
|
||||
use RetailCrm\Api\Model\Response\Api\Credentials;
|
||||
use RetailCrm\Api\Model\Response\ErrorResponse;
|
||||
use RetailCrm\Api\Model\ResponseData;
|
||||
use Liip\Serializer\SerializerInterface;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
$handler = new CallbackResponseHandler(
|
||||
static function (
|
||||
ResponseData $data,
|
||||
SerializerInterface $serializer,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
ApiExceptionFactory $apiExceptionFactory
|
||||
) {
|
||||
if (
|
||||
$data->responseModel instanceof Credentials &&
|
||||
!in_array('/api/customers/create', $data->responseModel->credentials)
|
||||
) {
|
||||
$data->responseModel = new ErrorResponse();
|
||||
$data->responseModel->errorMsg = 'Parameter "/api/customers/create" is missing';
|
||||
|
||||
throw new MissingParameterException($data->responseModel, 400);
|
||||
}
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
Both handlers above can be appended to request and response pipelines. Let's move on to the next part to learn how
|
||||
you can append handlers to the chain using `ClientFactory` or `ClientBuilder`.
|
||||
|
||||
### Modifying the default pipeline
|
||||
|
||||
Two limitations apply to default pipeline modifying:
|
||||
1. Chain ordering cannot be changed. Your handler will always be at the end of the default chain.
|
||||
1. Callback handlers will always call the next handler. There is no way to stop the next handlers in the chain.
|
||||
|
||||
However, you can construct your own pipeline which won't be bound by the first limitation. And the second limitation can be
|
||||
circumvented by [implementing your own handler](implementing_a_handler.md).
|
||||
|
||||
Both `ClientFactory` and `ClientBuilder` allow you to append your own handlers to the processing pipeline. They provide
|
||||
those methods:
|
||||
|
||||
```php
|
||||
/**
|
||||
* Appends an additional request handler into the request processing chain.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\HandlerInterface $handler
|
||||
*/
|
||||
public function appendRequestHandler(HandlerInterface $handler);
|
||||
|
||||
/**
|
||||
* Appends an additional handler into the response processing chain.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\HandlerInterface $handler
|
||||
*/
|
||||
public function appendResponseHandler(HandlerInterface $handler);
|
||||
|
||||
/**
|
||||
* Appends an additional request handlers into the request processing chain.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\HandlerInterface[] $handlers
|
||||
*/
|
||||
public function appendRequestHandlers(array $handlers);
|
||||
|
||||
/**
|
||||
* Appends an additional response handlers into the response processing chain.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\HandlerInterface[] $handlers
|
||||
*/
|
||||
public function appendResponseHandlers(array $handlers);
|
||||
```
|
||||
|
||||
You can use those methods to pass the handler into desired chain. Take a look at the examples. This code will initialize the client
|
||||
with provided `CallbackRequestHandler`. Instantiation will be done via `ClientFactory`:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Factory\ClientFactory;
|
||||
use RetailCrm\Api\Handler\Request\CallbackRequestHandler;
|
||||
use RetailCrm\Api\Model\RequestData;
|
||||
use Psr\Http\Message\RequestFactoryInterface;
|
||||
use Psr\Http\Message\StreamFactoryInterface;
|
||||
use Psr\Http\Message\UriFactoryInterface;
|
||||
|
||||
$handler = new CallbackRequestHandler(
|
||||
static function (
|
||||
RequestData $requestData,
|
||||
RequestFactoryInterface $requestFactory,
|
||||
StreamFactoryInterface $streamFactory,
|
||||
UriFactoryInterface $uriFactory
|
||||
) {
|
||||
if (null !== $requestData->request) {
|
||||
$requestData->request = $requestData->request->withHeader('X-Rlimit-Token', 'example_token');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$factory = new ClientFactory();
|
||||
$client = $factory->appendRequestHandler($handler)->createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
```
|
||||
|
||||
And this code will instantiate a client using `ClientBuilder`. But this time we're modifying response pipeline:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Builder\ClientBuilder;
|
||||
use RetailCrm\Api\Builder\FormEncoderBuilder;
|
||||
use RetailCrm\Api\Exception\Api\MissingParameterException;
|
||||
use RetailCrm\Api\Factory\ApiExceptionFactory;
|
||||
use RetailCrm\Api\Handler\Request\HeaderAuthenticatorHandler;
|
||||
use RetailCrm\Api\Handler\Response\CallbackResponseHandler;
|
||||
use RetailCrm\Api\Model\Response\Api\Credentials;
|
||||
use RetailCrm\Api\Model\Response\ErrorResponse;
|
||||
use RetailCrm\Api\Model\ResponseData;
|
||||
use Liip\Serializer\SerializerInterface;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
$handler = new CallbackResponseHandler(
|
||||
static function (
|
||||
ResponseData $data,
|
||||
SerializerInterface $serializer,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
ApiExceptionFactory $apiExceptionFactory
|
||||
) {
|
||||
if (
|
||||
$data->responseModel instanceof Credentials &&
|
||||
!in_array('/api/customers/create', $data->responseModel->credentials)
|
||||
) {
|
||||
$data->responseModel = new ErrorResponse();
|
||||
$data->responseModel->errorMsg = 'Parameter "/api/customers/create" is missing';
|
||||
|
||||
throw new MissingParameterException($data->responseModel, 400);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$formEncoder = (new FormEncoderBuilder())->setCacheDir('cache')->build();
|
||||
$builder = new ClientBuilder();
|
||||
$client = $builder->setApiUrl('https://test.retailcrm.pro')
|
||||
->setAuthenticatorHandler(new HeaderAuthenticatorHandler('apiKey'))
|
||||
->setFormEncoder($formEncoder)
|
||||
->appendRequestHandler($handler)
|
||||
->build();
|
||||
```
|
||||
|
||||
That's how you can modify request and response processing chains. However, you also can use the default pipeline factory
|
||||
to pass desired handlers into the chain. Default request and response pipelines are constructed by those static factories:
|
||||
```php
|
||||
RetailCrm\Api\Factory\RequestPipelineFactory::createDefaultPipeline()
|
||||
RetailCrm\Api\Factory\ResponsePipelineFactory::createDefaultPipeline()
|
||||
```
|
||||
|
||||
Look at the example below to learn how to use those static factories. In this example we will modify both the request
|
||||
and response pipelines:
|
||||
|
||||
```php
|
||||
use Liip\Serializer\SerializerInterface;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Http\Message\RequestFactoryInterface;
|
||||
use Psr\Http\Message\StreamFactoryInterface;
|
||||
use Psr\Http\Message\UriFactoryInterface;
|
||||
use RetailCrm\Api\Builder\ClientBuilder;
|
||||
use RetailCrm\Api\Builder\FormEncoderBuilder;
|
||||
use RetailCrm\Api\Component\Transformer\RequestTransformer;
|
||||
use RetailCrm\Api\Component\Transformer\ResponseTransformer;
|
||||
use RetailCrm\Api\Exception\Api\MissingParameterException;
|
||||
use RetailCrm\Api\Factory\ApiExceptionFactory;
|
||||
use RetailCrm\Api\Factory\RequestPipelineFactory;
|
||||
use RetailCrm\Api\Factory\ResponsePipelineFactory;
|
||||
use RetailCrm\Api\Handler\Request\CallbackRequestHandler;
|
||||
use RetailCrm\Api\Handler\Request\HeaderAuthenticatorHandler;
|
||||
use RetailCrm\Api\Handler\Response\CallbackResponseHandler;
|
||||
use RetailCrm\Api\Model\RequestData;
|
||||
use RetailCrm\Api\Model\Response\Api\Credentials;
|
||||
use RetailCrm\Api\Model\Response\ErrorResponse;
|
||||
use RetailCrm\Api\Model\ResponseData;
|
||||
|
||||
$requestHandler = new CallbackRequestHandler(
|
||||
static function (
|
||||
RequestData $requestData,
|
||||
RequestFactoryInterface $requestFactory,
|
||||
StreamFactoryInterface $streamFactory,
|
||||
UriFactoryInterface $uriFactory
|
||||
) {
|
||||
if (null !== $requestData->request) {
|
||||
$requestData->request = $requestData->request->withHeader('X-Rlimit-Token', 'example_token');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$responseHandler = new CallbackResponseHandler(
|
||||
static function (
|
||||
ResponseData $data,
|
||||
SerializerInterface $serializer,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
ApiExceptionFactory $apiExceptionFactory
|
||||
) {
|
||||
if (
|
||||
$data->responseModel instanceof Credentials &&
|
||||
!in_array('/api/customers/create', $data->responseModel->credentials)
|
||||
) {
|
||||
$data->responseModel = new ErrorResponse();
|
||||
$data->responseModel->errorMsg = 'Parameter "/api/customers/create" is missing';
|
||||
|
||||
throw new MissingParameterException($data->responseModel, 400);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$builder = new ClientBuilder();
|
||||
$formEncoder = (new FormEncoderBuilder())->setCacheDir('cache')->build();
|
||||
$client = $builder->setApiUrl('https://test.retailcrm.pro')
|
||||
->setAuthenticatorHandler(new HeaderAuthenticatorHandler('apiKey'))
|
||||
->setRequestTransformer(new RequestTransformer(
|
||||
RequestPipelineFactory::createDefaultPipeline(
|
||||
$formEncoder,
|
||||
null, // PSR factories will be found by the service discovery.
|
||||
null,
|
||||
null,
|
||||
$requestHandler
|
||||
)
|
||||
))
|
||||
->setResponseTransformer(new ResponseTransformer(
|
||||
ResponsePipelineFactory::createDefaultPipeline(
|
||||
$formEncoder->getSerializer(),
|
||||
new ApiExceptionFactory(),
|
||||
null, // No EventDispatcherInterface was provided
|
||||
$responseHandler
|
||||
)
|
||||
))->build();
|
||||
```
|
||||
|
||||
### Constructing the pipeline from scratch
|
||||
|
||||
Both `RequestTransformer` and `ResponseTransformer` accept the `HandlerInterface` instance as the first argument. You can
|
||||
look into `RequestPipelineFactory` and `ResponsePipelineFactory` source code to learn how to build your own pipeline from
|
||||
scratch. This is, however, is discouraged.
|
32
doc/index.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Documentation
|
||||
|
||||
* [Dealing with `civicrm/composer-compile-plugin` prompts](compilation_prompt.md)
|
||||
+ [Disable compilation prompts during the installation](compilation_prompt.md#disable-compilation-prompts-during-the-installation)
|
||||
+ [I've chosen something else, now API client doesn't work!](compilation_prompt.md#ive-chosen-something-else-now-api-client-doesnt-work)
|
||||
+ [Disabling compilation prompts manually](compilation_prompt.md#disabling-compilation-prompts-manually)
|
||||
* [Client structure](structure.md)
|
||||
+ [Design principles](structure.md#design-principles)
|
||||
+ [Resource groups](structure.md#resource-groups)
|
||||
* [Usage](usage/usage.md)
|
||||
+ [Instantiation](usage/instantiation.md)
|
||||
+ [Sending a request](usage/sending_a_request.md)
|
||||
+ [Choosing correct resource group, DTOs, and method](usage/sending_a_request.md#choosing-correct-resource-group-dtos-and-method)
|
||||
+ [Sending a request](usage/sending_a_request.md#sending-a-request)
|
||||
+ [Dealing with exceptions](usage/sending_a_request.md#dealing-with-exceptions)
|
||||
+ [Error handling](usage/error_handling.md)
|
||||
+ [Examples](usage/examples)
|
||||
+ [How to create an order](usage/examples/create_order.md)
|
||||
+ [How to receive the list of orders](usage/examples/fetch_orders.md)
|
||||
+ [How to handle all Client's exceptions](usage/examples/complete_error_handling_example.md)
|
||||
+ [Event handling](usage/event_handing.md)
|
||||
* [Customization](customization/customization.md)
|
||||
+ [Controlling HTTP abstraction layer](customization/different_psr_implementations.md)
|
||||
+ [Customizing request and response processing](customization/pipelines/implementing_a_handler.md)
|
||||
+ [Using a predefined handler](customization/pipelines/using_a_predefined_handler.md)
|
||||
+ [Built-in handlers](customization/pipelines/using_a_predefined_handler.md#built-in-handlers)
|
||||
+ [Modifying the default pipeline](customization/pipelines/using_a_predefined_handler.md#modifying-the-default-pipeline)
|
||||
+ [Constructing the pipeline from scratch](customization/pipelines/using_a_predefined_handler.md#constructing-the-pipeline-from-scratch)
|
||||
+ [Implementing a handler](customization/pipelines/implementing_a_handler.md)
|
||||
+ [Implementing custom API methods](customization/implementing_custom_api_methods.md)
|
||||
* [Troubleshooting](troubleshooting.md)
|
||||
* [PHPDoc](https://retailcrm.github.io/api-client-php/)
|
48
doc/structure.md
Normal file
|
@ -0,0 +1,48 @@
|
|||
## Client structure
|
||||
|
||||
The client is separated into several resource groups, all of which are accessible through the Client's public properties. Each resource group is responsible for the corresponding API section. It is much easier to understand how the Client works by learning its design principles.
|
||||
|
||||
### Design principles
|
||||
|
||||
The general principles of the Client design are:
|
||||
1. The Client itself doesn't contain any API methods implementations.
|
||||
1. ResourceGroups implements all API methods.
|
||||
1. Every method can accept from zero to several arguments.
|
||||
1. URI path arguments (not the query string ones) are always passed as separate method arguments.
|
||||
1. Query parameters are always passed in the form of the Request model. The same principle applies to the POST form data.
|
||||
1. If the Request contains only one parameter - it'll probably accept it through the constructor. This doesn't apply to the filter requests, which don't have constructors at all.
|
||||
1. All DTO's you'll ever need can be found in the `RetailCrm\Api\Model` namespace.
|
||||
1. Every method has an example of the usage in its DocBlock. Yes, all of them. You can learn how to use any of the methods just by looking at the DocBlock help tooltip provided by your IDE. If it's not provided by your IDE - you'll need to look up how to configure it. It'll ease your work with this (and any other) library a lot.
|
||||
|
||||
### Resource groups
|
||||
|
||||
The resource groups list into which client is separated:
|
||||
|
||||
* `api`
|
||||
* `costs`
|
||||
* `customFields`
|
||||
* `customers`
|
||||
* `customersCorporate`
|
||||
* `delivery`
|
||||
* `features`
|
||||
* `files`
|
||||
* `integration`
|
||||
* `loyalty`
|
||||
* `notifications`
|
||||
* `orders`
|
||||
* `packs`
|
||||
* `payments`
|
||||
* `references`
|
||||
* `segments`
|
||||
* `settings`
|
||||
* `store`
|
||||
* `tasks`
|
||||
* `telephony`
|
||||
* `users`
|
||||
* `verification`
|
||||
* `statistics`
|
||||
* `webAnalytics`
|
||||
|
||||
There is also a special `customMethods` group that is used for custom API methods. Each group except this one implements corresponding API documentation block:
|
||||
* [English](https://docs.retailcrm.pro/Developers/API/APIVersions/APIv5)
|
||||
* [Русский](https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5)
|
59
doc/troubleshooting.md
Normal file
|
@ -0,0 +1,59 @@
|
|||
### I've got error that looks like this: `Cannot deserialize body: Type "RetailCrm\Api\Model\Response\Api\ApiVersionsResponse" is not known.`
|
||||
|
||||
Run this command to fix the problem:
|
||||
|
||||
```sh
|
||||
composer compile --all
|
||||
```
|
||||
|
||||
The details about that error can be found in the [documentation](compilation_prompt.md).
|
||||
|
||||
### I've got "No Message Factories" error.
|
||||
|
||||
This means that PSR-17 implementation you have is not supported by the service discovery, therefore, API client cannot find proper factories.
|
||||
In order to use your own PSR-17 implementation you need to use `ClientBuilder`. Also, you can just install supported implementation which is
|
||||
much easier:
|
||||
```sh
|
||||
composer require nyholm/psr7
|
||||
```
|
||||
|
||||
### I've got `Http\Discovery\Exception\DiscoveryFailedException` or any other error with message like "`Could not find resource using any discovery strategy`".
|
||||
|
||||
That's because you don't have any supported PSR-18, PSR-7 or PSR-17 implementation available. This usually happens if you do have any implementation for those
|
||||
standards, but it's not supported by service discovery. You can fix this easily by installing supported implementations. We recommend using `symfony/http-client`
|
||||
and `nyholm/psr7`. Install those using this command:
|
||||
```sh
|
||||
composer require nyholm/psr7 symfony/http-client
|
||||
```
|
||||
|
||||
Alternatively, you can use `ClientBuilder` which allows you to pass your own HTTP client and message & URI factories.
|
||||
|
||||
### There are too many available exceptions! How do I catch them all?
|
||||
|
||||
Every exception in the library implements either `ApiExceptionInterface` or `ClientExceptionInterface`. First will be thrown in case of any
|
||||
errors from the API, and the second will be thrown in case of any problems with the client or network itself. Concrete exception types are meant
|
||||
to be used to determine what exactly gone wrong while sending a request.
|
||||
|
||||
Also, you can use PSR-14 compatible event dispatcher to handle some exceptions globally. The Client will send `FailureRequestEvent` in case of any exceptions.
|
||||
You can call `FailureRequestEvent::suppressThrow()` to prevent client from throwing an exception.
|
||||
|
||||
### I can't test my app in the CI because Composer fails while installing dependencies.
|
||||
|
||||
That's because you should explicitly allow code generation for the library. Otherwise, Composer will ask you to run compilation task at runtime
|
||||
which is not possible in the CI since it lacks the support for interactive input.
|
||||
|
||||
You can allow code generation tasks without interactive approval. Just add parameters from the JSON below to
|
||||
the `"extra"` key of your project's `composer.json` file.
|
||||
```json
|
||||
{
|
||||
"compile-mode": "whitelist",
|
||||
"compile-whitelist": ["retailcrm/api-client-php"]
|
||||
}
|
||||
```
|
||||
|
||||
### How can I choose proper DTO class for my request?
|
||||
|
||||
Request DTO's can be found in the `RetailCrm\Api\Model\Request` namespace. They are separated by the API resource groups.
|
||||
For example, requests for interaction with customer entities can be found in the `RetailCrm\Api\Model\Request\Customers` namespace
|
||||
and requests for operations with the orders can be found in the `RetailCrm\Api\Model\Request\Orders` namespace. Every request method
|
||||
defines it's input and output types. Also, you can choose correct type for child entities by looking at type annotations.
|
52
doc/usage/error_handling.md
Normal file
|
@ -0,0 +1,52 @@
|
|||
## Error handling
|
||||
|
||||
The API Client exceptions are hierarchical. It means that groups of exceptions can be caught using more generic exception types.
|
||||
Let's take a look at the exceptions hierarchy:
|
||||
|
||||
- `ApiException` is an abstraction and will never be thrown by itself.
|
||||
- `AccessDeniedException` is thrown if the `Access denied.` error string is received from the API.
|
||||
- `AccountDoesNotExistException` is thrown if the RetailCRM account with a specified API URL does not exist.
|
||||
- `ApiErrorException` is thrown in case of any generic API error which is not recognized as a more specific type.
|
||||
- `InvalidCredentialsException` is thrown if the provided API key is not correct.
|
||||
- `MissingCredentialsException` is thrown if no API key was provided (this can happen if you initialize the Client without an authenticator).
|
||||
- `MissingParameterException` is thrown if `Parameter '*' is missing` error is returned from the API (`*` is any parameter name).
|
||||
- `ValidationException` is thrown if request validation is failed on the server-side (incorrect request data).
|
||||
- `ClientException` is an abstraction and will never be thrown by itself.
|
||||
- `BuilderException` is thrown by any builder if something goes wrong.
|
||||
- `HandlerException` is thrown by the handlers in the request / response processing chain if they encountered an error.
|
||||
- `HttpClientException` is thrown if underlying HTTP client throws an exception.
|
||||
|
||||
`ApiException` implements `ApiExceptionInterface` and `ClientException` implements `ClientExceptionInterface`.
|
||||
It means that you can catch any exception in the `ApiException` leaf using `ApiExceptionInterface` as an exception type.
|
||||
Also, you can catch any exception in the `ClientException` leaf using the `ClientExceptionInterface` type.
|
||||
|
||||
`ClientExceptionInterface` and `ApiExceptionInterface` implements `__toString()`. The first one will return a string with an error
|
||||
message and stack trace and the second one will print out the error message, stack trace, and error response data.
|
||||
|
||||
Let's take a look at the example:
|
||||
```php
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
use RetailCrm\Api\Interfaces\ClientExceptionInterface;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
|
||||
try {
|
||||
$apiVersions = $client->api->apiVersions();
|
||||
} catch (ApiExceptionInterface | ClientExceptionInterface $exception) {
|
||||
echo $exception;
|
||||
return;
|
||||
}
|
||||
|
||||
echo 'Available API versions: ' . implode(', ', $apiVersions->versions);
|
||||
```
|
||||
|
||||
All Client exceptions can be found in the `RetailCrm\Api\Exception` namespace. `ApiException` children reside in the `RetailCrm\Api\Exception\Api` namespace,
|
||||
and `ClientException` children reside at the `RetailCrm\Api\Exception\Client` namespace.
|
||||
|
||||
It is recommended to look at the [complete error handling example](examples/complete_error_handling_example.md).
|
||||
The most useful case would be the error message generation for the client in your app, which can look like this:
|
||||
- `InvalidCredentialsException` - show the `Invalid API key` message.
|
||||
- `AccountDoesNotExistException` - show the `Incorrect RetailCRM URL` or `This RetailCRM instance does not exist` message.
|
||||
- `AccessDeniedException` - show the `Please enable the /api/v5/... method for this key` message.
|
||||
- and so on.
|
105
doc/usage/event_handing.md
Normal file
|
@ -0,0 +1,105 @@
|
|||
## Events
|
||||
|
||||
You can use a PSR-14 compatible event dispatcher to receive events from the client.
|
||||
It may be useful if you want to process certain events with the same logic without duplicating calls to such code.
|
||||
These events are provided by the library:
|
||||
- `RetailCrm\Api\Event\SuccessRequestEvent` will be dispatched if the request was successful.
|
||||
- `RetailCrm\Api\Event\FailureRequestEvent` will be dispatched if the request was not successful. It won't be dispatched if the request cannot be formed at all.
|
||||
|
||||
Event API documentation can be found here:
|
||||
* [`FailureRequestEvent`](https://retailcrm.github.io/api-client-php/classes/RetailCrm-Api-Event-FailureRequestEvent.html)
|
||||
* [`SuccessRequestEvent`](https://retailcrm.github.io/api-client-php/classes/RetailCrm-Api-Event-SuccessRequestEvent.html)
|
||||
|
||||
Here is an example of event handling with Symfony. We're using an empty Symfony 5.x project with annotations routing. `IndexController`
|
||||
outputs `/api/credentials` response without any changes. We'll handle all exceptions inside this event listener which will allow us
|
||||
to call the method without any `try...catch` blocks.
|
||||
|
||||
**config/services.yml**
|
||||
```yaml
|
||||
services:
|
||||
# ClientFactory definition.
|
||||
RetailCrm\Api\Interfaces\ClientFactoryInterface:
|
||||
class: 'RetailCrm\Api\Factory\ClientFactory'
|
||||
calls:
|
||||
- setCacheDir: ['%kernel.cache_dir%']
|
||||
- setEventDispatcher: ['@event_dispatcher']
|
||||
|
||||
# Event listener definition. This listener will suppress exceptions and log them.
|
||||
App\EventListener\FailureRequestListener:
|
||||
tags:
|
||||
- { name: kernel.event_listener, event: RetailCrm\Api\Event\FailureRequestEvent, method: onRequestFailure }
|
||||
```
|
||||
|
||||
**src/EventListener/FailureRequestListener.php**
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\EventListener;
|
||||
|
||||
use Psr\Http\Client\ClientExceptionInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RetailCrm\Api\Event\FailureRequestEvent;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
|
||||
class FailureRequestListener
|
||||
{
|
||||
/** @var \Psr\Log\LoggerInterface */
|
||||
private $logger;
|
||||
|
||||
public function __construct(LoggerInterface $logger)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
public function onRequestFailure(FailureRequestEvent $event): void
|
||||
{
|
||||
$exception = $event->getException();
|
||||
|
||||
if ($exception instanceof ApiExceptionInterface) {
|
||||
$event->suppressThrow();
|
||||
$this->logger->error(sprintf(
|
||||
'CRM URL "%s", API error: %s',
|
||||
$event->getApiUrl(),
|
||||
(string) $exception
|
||||
));
|
||||
}
|
||||
|
||||
if ($exception instanceof ClientExceptionInterface) {
|
||||
$event->suppressThrow();
|
||||
$this->logger->error(sprintf(
|
||||
'CRM URL "%s", client error: %s, trace: %s',
|
||||
$event->getApiUrl(),
|
||||
$exception->getMessage(),
|
||||
$exception->getTraceAsString()
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**src/Controller/IndexController.php**
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use RetailCrm\Api\Interfaces\ClientFactoryInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route("/", name="index")
|
||||
*/
|
||||
public function index(ClientFactoryInterface $clientFactory): Response
|
||||
{
|
||||
$client = $clientFactory->createClient('https://test3487687.retailcrm.pro', 'key');
|
||||
$credentials = $client->api->credentials();
|
||||
|
||||
// Will print out empty model because https://test3487687.retailcrm.pro account does not exist.
|
||||
return $this->json($credentials);
|
||||
}
|
||||
}
|
||||
```
|
115
doc/usage/examples/complete_error_handling_example.md
Normal file
|
@ -0,0 +1,115 @@
|
|||
Here is a complete example of the Client usage with error handling. It fetches the filtered orders data and prints it out.
|
||||
|
||||
**Note:** it's not recommended using this example to process all API client errors in your application. It will clutter your code too much.
|
||||
There are other options for exception processing. You can [match more generic exceptions in the hierarchy](../error_handling.md) or use
|
||||
[events](../event_handing.md) to process exceptions.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use Psr\Http\Client\ClientExceptionInterface as PsrClientExceptionInterface;
|
||||
use Psr\Http\Client\NetworkExceptionInterface;
|
||||
use Psr\Http\Client\RequestExceptionInterface;
|
||||
use RetailCrm\Api\Exception\Api\AccessDeniedException;
|
||||
use RetailCrm\Api\Exception\Api\AccountDoesNotExistException;
|
||||
use RetailCrm\Api\Exception\Api\ApiErrorException;
|
||||
use RetailCrm\Api\Exception\Api\InvalidCredentialsException;
|
||||
use RetailCrm\Api\Exception\Api\MissingCredentialsException;
|
||||
use RetailCrm\Api\Exception\Api\MissingParameterException;
|
||||
use RetailCrm\Api\Exception\Api\ValidationException;
|
||||
use RetailCrm\Api\Exception\Client\HandlerException;
|
||||
use RetailCrm\Api\Exception\Client\HttpClientException;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
use RetailCrm\Api\Interfaces\ClientExceptionInterface;
|
||||
use RetailCrm\Api\Model\Entity\CustomersCorporate\CustomerCorporate;
|
||||
use RetailCrm\Api\Model\Filter\Orders\OrderFilter;
|
||||
use RetailCrm\Api\Model\Request\Orders\OrdersRequest;
|
||||
use Throwable;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
|
||||
$request = new OrdersRequest();
|
||||
$request->filter = new OrderFilter();
|
||||
$request->filter->ids = [7141];
|
||||
|
||||
try {
|
||||
$response = $client->orders->list($request);
|
||||
} catch (HandlerException $exception) {
|
||||
echo 'Error while trying to prepare request: ' . $exception->getMessage();
|
||||
exit(-1);
|
||||
} catch (HttpClientException $exception) {
|
||||
$prefix = 'Unknown error';
|
||||
|
||||
if ($exception->getPrevious() instanceof NetworkExceptionInterface) {
|
||||
$prefix = 'Network error';
|
||||
}
|
||||
|
||||
if ($exception->getPrevious() instanceof RequestExceptionInterface) {
|
||||
$prefix = 'Invalid request';
|
||||
}
|
||||
|
||||
if ($exception->getPrevious() instanceof PsrClientExceptionInterface) {
|
||||
$prefix = 'HTTP client exception';
|
||||
}
|
||||
|
||||
echo $prefix . ': ' . $exception->getMessage();
|
||||
|
||||
exit(-1);
|
||||
} catch (
|
||||
InvalidCredentialsException |
|
||||
AccessDeniedException |
|
||||
AccountDoesNotExistException |
|
||||
MissingCredentialsException |
|
||||
MissingParameterException $exception
|
||||
) {
|
||||
echo $exception->getMessage();
|
||||
exit(-1);
|
||||
} catch (ValidationException $exception) {
|
||||
echo 'Errors in fields:' . PHP_EOL;
|
||||
|
||||
foreach ($exception->getErrorResponse()->errors as $field => $error) {
|
||||
printf(" - %s: %s\n", $field, $error);
|
||||
}
|
||||
|
||||
exit(-1);
|
||||
} catch (ApiExceptionInterface | ClientExceptionInterface $exception) {
|
||||
echo $exception; // Every ApiException and ClientException implements __toString() method
|
||||
exit(-1);
|
||||
} catch (Throwable $throwable) {
|
||||
echo 'Unknown runtime exception: ' . $throwable->getMessage() . PHP_EOL;
|
||||
echo $throwable->getTraceAsString();
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
foreach ($response->orders as $order) {
|
||||
printf("Order ID: %d\n", $order->id);
|
||||
printf("First name: %s\n", $order->firstName);
|
||||
printf("Last name: %s\n", $order->lastName);
|
||||
printf("Patronymic: %s\n", $order->patronymic);
|
||||
printf("Phone #1: %s\n", $order->phone);
|
||||
printf("Phone #2: %s\n", $order->additionalPhone);
|
||||
printf("E-Mail: %s\n", $order->email);
|
||||
|
||||
if ($order->customer instanceof CustomerCorporate) {
|
||||
echo "Customer type: corporate\n";
|
||||
} else {
|
||||
echo "Customer type: individual\n";
|
||||
}
|
||||
|
||||
foreach ($order->items as $item) {
|
||||
echo PHP_EOL;
|
||||
|
||||
printf("Product name: %s\n", $item->productName);
|
||||
printf("Quantity: %d\n", $item->quantity);
|
||||
printf("Initial price: %f\n", $item->initialPrice);
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
|
||||
printf("Discount: %f\n", $order->discountManualAmount);
|
||||
printf("Total: %f\n", $order->totalSumm);
|
||||
|
||||
echo PHP_EOL;
|
||||
}
|
||||
```
|
|
@ -0,0 +1,253 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category PaginatedRequestIterator
|
||||
*/
|
||||
|
||||
use RetailCrm\Api\Client;
|
||||
use RetailCrm\Api\Exception\Client\HandlerException;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
use RetailCrm\Api\Interfaces\RequestInterface;
|
||||
use RetailCrm\Api\Model\Response\AbstractPaginatedResponse;
|
||||
|
||||
/**
|
||||
* Class PaginatedRequestIterator
|
||||
*
|
||||
* @category PaginatedRequestIterator
|
||||
* @template T
|
||||
* @implements Iterator<int|string, T>
|
||||
*/
|
||||
class PaginatedRequestIterator implements Iterator
|
||||
{
|
||||
/** @var \RetailCrm\Api\Client */
|
||||
private $client;
|
||||
|
||||
/** @var array<int|string, mixed> */
|
||||
private $items = [];
|
||||
|
||||
/** @var int */
|
||||
private $position = 0;
|
||||
|
||||
/** @var int */
|
||||
private $seek = 0;
|
||||
|
||||
/** @var int */
|
||||
private $currentPage = 1;
|
||||
|
||||
/** @var bool */
|
||||
private $fetchFailed = false;
|
||||
|
||||
/** @var \Throwable|null */
|
||||
private $error;
|
||||
|
||||
/** @var bool */
|
||||
private $finalized = false;
|
||||
|
||||
/** @var \RetailCrm\Api\Interfaces\RequestInterface */
|
||||
private $request;
|
||||
|
||||
/** @var callable */
|
||||
private $nextPageFunc;
|
||||
|
||||
/** @var callable */
|
||||
private $sendResponseFunc;
|
||||
|
||||
/** @var callable */
|
||||
private $extractBatchFunc;
|
||||
|
||||
/**
|
||||
* PaginatedRequestIterator constructor.
|
||||
*
|
||||
* @param \RetailCrm\Api\Client $client
|
||||
*/
|
||||
public function __construct(Client $client)
|
||||
{
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* This request will be used in every iteration.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\RequestInterface $request
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setRequest(RequestInterface $request): self
|
||||
{
|
||||
$this->request = $request;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function should modify provided request which will be used in the next iteration.
|
||||
*
|
||||
* These params will be supplied in this exact order:
|
||||
* - The request instance.
|
||||
* - The response instance.
|
||||
* - Next page number.
|
||||
*
|
||||
* @param callable $nextPageFunc
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setNextPageFunc(callable $nextPageFunc): self
|
||||
{
|
||||
$this->nextPageFunc = $nextPageFunc;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function should send the request and return the response.
|
||||
*
|
||||
* These params will be supplied in this exact order:
|
||||
* - The Client instance.
|
||||
* - The request instance.
|
||||
*
|
||||
* @param callable $sendResponseFunc
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSendResponseFunc(callable $sendResponseFunc): self
|
||||
{
|
||||
$this->sendResponseFunc = $sendResponseFunc;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function should extract the batch of objects from the response.
|
||||
*
|
||||
* These params will be supplied in this exact order:
|
||||
* - The response instance.
|
||||
*
|
||||
* @param callable $extractBatchFunc
|
||||
*
|
||||
* @return PaginatedRequestIterator
|
||||
*/
|
||||
public function setExtractBatchFunc(callable $extractBatchFunc): PaginatedRequestIterator
|
||||
{
|
||||
$this->extractBatchFunc = $extractBatchFunc;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @return mixed
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
return $this->items[$this->getPosition()];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function next(): void
|
||||
{
|
||||
++$this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function key(): int
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function valid(): bool
|
||||
{
|
||||
if (empty($this->items) || !array_key_exists($this->getPosition(), $this->items)) {
|
||||
$this->fetchChunk();
|
||||
}
|
||||
|
||||
return isset($this->items[$this->getPosition()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function rewind(): void
|
||||
{
|
||||
$this->items = [];
|
||||
$this->position = 0;
|
||||
$this->seek = 0;
|
||||
$this->currentPage = 1;
|
||||
$this->error = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isFetchFailed(): bool
|
||||
{
|
||||
return $this->fetchFailed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Throwable|null
|
||||
*/
|
||||
public function getError(): ?Throwable
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
private function getPosition(): int
|
||||
{
|
||||
return $this->position - $this->seek;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetchChunk obtains chunk of data
|
||||
*/
|
||||
private function fetchChunk(): void
|
||||
{
|
||||
if ($this->finalized || $this->fetchFailed) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if ($this->currentPage > 1) {
|
||||
time_nanosleep(0, 100000000);
|
||||
}
|
||||
|
||||
$response = call_user_func($this->sendResponseFunc, $this->client, $this->request);
|
||||
|
||||
if ($response instanceof AbstractPaginatedResponse) {
|
||||
$batch = call_user_func($this->extractBatchFunc, $response);
|
||||
|
||||
if (empty($batch)) {
|
||||
$this->items = [];
|
||||
$this->fetchFailed = true;
|
||||
$this->error = new HandlerException('Received an empty response');
|
||||
} else {
|
||||
$this->seek += count($this->items);
|
||||
$this->items = array_values($batch);
|
||||
|
||||
if ($this->currentPage < $response->pagination->totalPageCount) {
|
||||
call_user_func($this->nextPageFunc, $this->request, $response, ++$this->currentPage);
|
||||
} else {
|
||||
$this->finalized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable $exception) {
|
||||
if ($exception instanceof ApiExceptionInterface && 503 === $exception->getStatusCode()) {
|
||||
time_nanosleep(1, 0);
|
||||
$this->fetchChunk();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fetchFailed = true;
|
||||
$this->error = $exception;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
use RetailCrm\Api\Client;
|
||||
use RetailCrm\Api\Enum\PaginationLimit;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Model\Filter\Customers\CustomerHistoryFilter;
|
||||
use RetailCrm\Api\Model\Request\Customers\CustomersHistoryRequest;
|
||||
use RetailCrm\Api\Model\Response\Customers\CustomersHistoryResponse;
|
||||
|
||||
require __DIR__ . '/../../../../vendor/autoload.php';
|
||||
require __DIR__ . '/PaginatedRequestIterator.php';
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro/', 'apiKey');
|
||||
$request = new CustomersHistoryRequest();
|
||||
$request->filter = new CustomerHistoryFilter();
|
||||
$request->filter->startDate = (new DateTime())->sub(new DateInterval('P7D')); // 7 days
|
||||
$request->limit = PaginationLimit::LIMIT_100;
|
||||
|
||||
$paginator = (new PaginatedRequestIterator($client))
|
||||
->setRequest($request)
|
||||
->setNextPageFunc(static function (CustomersHistoryRequest $request, CustomersHistoryResponse $response, int $page) {
|
||||
$request->filter->startDate = null;
|
||||
$request->filter->sinceId = end($response->history)->id;
|
||||
})
|
||||
->setExtractBatchFunc(static function (CustomersHistoryResponse $response) {
|
||||
return $response->history;
|
||||
})
|
||||
->setSendResponseFunc(static function (Client $client, CustomersHistoryRequest $request) {
|
||||
return $client->customers->history($request);
|
||||
});
|
||||
|
||||
/** @var \RetailCrm\Api\Model\Entity\Customers\Customer $customer */
|
||||
foreach ($paginator as $historyEntry) {
|
||||
print_r($historyEntry);
|
||||
}
|
||||
|
||||
if ($paginator->isFetchFailed()) {
|
||||
echo $paginator->getError();
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
use RetailCrm\Api\Client;
|
||||
use RetailCrm\Api\Enum\PaginationLimit;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Model\Entity\Customers\CustomerPhone;
|
||||
use RetailCrm\Api\Model\Request\Customers\CustomersRequest;
|
||||
use RetailCrm\Api\Model\Response\Customers\CustomersResponse;
|
||||
|
||||
require __DIR__ . '/../../../../vendor/autoload.php';
|
||||
require __DIR__ . '/PaginatedRequestIterator.php';
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro/', 'apiKey');
|
||||
$request = new CustomersRequest();
|
||||
$request->limit = PaginationLimit::LIMIT_100;
|
||||
$request->page = 1;
|
||||
|
||||
$paginator = (new PaginatedRequestIterator($client))
|
||||
->setRequest($request)
|
||||
->setNextPageFunc(static function (CustomersRequest $request, CustomersResponse $response, int $page) {
|
||||
$request->page = $page;
|
||||
})
|
||||
->setExtractBatchFunc(static function (CustomersResponse $response) {
|
||||
return $response->customers;
|
||||
})
|
||||
->setSendResponseFunc(static function (Client $client, CustomersRequest $request) {
|
||||
return $client->customers->list($request);
|
||||
});
|
||||
|
||||
/** @var \RetailCrm\Api\Model\Entity\Customers\Customer $customer */
|
||||
foreach ($paginator as $customer) {
|
||||
printf(
|
||||
'%d: %s %s %s <%s> (%s) %s',
|
||||
$customer->id,
|
||||
$customer->firstName,
|
||||
$customer->lastName,
|
||||
$customer->patronymic,
|
||||
implode(', ', array_map(static function (CustomerPhone $phone) {
|
||||
return $phone->number;
|
||||
}, $customer->phones)),
|
||||
$customer->email, PHP_EOL
|
||||
);
|
||||
}
|
||||
|
||||
if ($paginator->isFetchFailed()) {
|
||||
echo $paginator->getError();
|
||||
}
|
8
doc/usage/examples/complex_pagination/index.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
Here are some complex examples of pagination handling. In this case, we're using a special component that handles the pagination for us.
|
||||
As a result, we can just iterate over batches of the data using `foreach`.
|
||||
|
||||
More than that, this component automatically handles rate limit exceptions.
|
||||
|
||||
* [Fetching customers](example_customers_list.php)
|
||||
* [Fetching customers history](example_customers_history.php)
|
||||
* [Pagination component (`PaginatedRequestIterator`)](PaginatedRequestIterator.php)
|
104
doc/usage/examples/create_order.md
Normal file
|
@ -0,0 +1,104 @@
|
|||
That's how you can create a new order:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use RetailCrm\Api\Interfaces\ClientExceptionInterface;
|
||||
use RetailCrm\Api\Enum\CountryCodeIso3166;
|
||||
use RetailCrm\Api\Enum\Customers\CustomerType;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
use RetailCrm\Api\Model\Entity\Orders\Delivery\OrderDeliveryAddress;
|
||||
use RetailCrm\Api\Model\Entity\Orders\Delivery\SerializedOrderDelivery;
|
||||
use RetailCrm\Api\Model\Entity\Orders\Items\Offer;
|
||||
use RetailCrm\Api\Model\Entity\Orders\Items\OrderProduct;
|
||||
use RetailCrm\Api\Model\Entity\Orders\Items\PriceType;
|
||||
use RetailCrm\Api\Model\Entity\Orders\Items\Unit;
|
||||
use RetailCrm\Api\Model\Entity\Orders\Order;
|
||||
use RetailCrm\Api\Model\Entity\Orders\Payment;
|
||||
use RetailCrm\Api\Model\Entity\Orders\SerializedRelationCustomer;
|
||||
use RetailCrm\Api\Model\Request\Orders\OrdersCreateRequest;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
|
||||
$request = new OrdersCreateRequest();
|
||||
$order = new Order();
|
||||
$payment = new Payment();
|
||||
$delivery = new SerializedOrderDelivery();
|
||||
$deliveryAddress = new OrderDeliveryAddress();
|
||||
$offer = new Offer();
|
||||
$item = new OrderProduct();
|
||||
|
||||
$payment->type = 'bank-card';
|
||||
$payment->status = 'paid';
|
||||
$payment->amount = 1000;
|
||||
$payment->paidAt = new DateTime();
|
||||
|
||||
$deliveryAddress->index = '344001';
|
||||
$deliveryAddress->countryIso = CountryCodeIso3166::RUSSIAN_FEDERATION;
|
||||
$deliveryAddress->region = 'Region';
|
||||
$deliveryAddress->city = 'City';
|
||||
$deliveryAddress->street = 'Street';
|
||||
$deliveryAddress->building = '10';
|
||||
|
||||
$delivery->address = $deliveryAddress;
|
||||
$delivery->cost = 0;
|
||||
$delivery->netCost = 0;
|
||||
|
||||
$offer->name = 'Offer №1445123';
|
||||
$offer->displayName = 'Offer №1445123';
|
||||
$offer->xmlId = 'tGunLo27jlPGmbA8BrHxY2';
|
||||
$offer->article = '14451445-14451445';
|
||||
$offer->unit = new Unit('796', 'Piece', 'pcs');
|
||||
|
||||
$item->offer = $offer;
|
||||
$item->priceType = new PriceType('base');
|
||||
$item->quantity = 1;
|
||||
$item->purchasePrice = 60;
|
||||
|
||||
$order->delivery = $delivery;
|
||||
$order->items = [$item];
|
||||
$order->payments = [$payment];
|
||||
$order->orderType = 'test';
|
||||
$order->orderMethod = 'phone';
|
||||
$order->countryIso = CountryCodeIso3166::RUSSIAN_FEDERATION;
|
||||
$order->firstName = 'Test';
|
||||
$order->lastName = 'User';
|
||||
$order->patronymic = 'Patronymic';
|
||||
$order->phone = '89003005069';
|
||||
$order->email = 'testuser12345678901@example.com';
|
||||
$order->managerId = 28;
|
||||
$order->customer = SerializedRelationCustomer::withIdAndType(
|
||||
4924,
|
||||
CustomerType::CUSTOMER
|
||||
);
|
||||
$order->status = 'assembling';
|
||||
$order->statusComment = 'Assembling order';
|
||||
$order->weight = 1000;
|
||||
$order->shipmentStore = 'main12';
|
||||
$order->shipmentDate = (new DateTime())->add(new DateInterval('P7D'));
|
||||
$order->shipped = false;
|
||||
$order->customFields = [
|
||||
"galka" => false,
|
||||
"test_number" => 0,
|
||||
"otpravit_dozakaz" => false,
|
||||
];
|
||||
|
||||
$request->order = $order;
|
||||
$request->site = 'moysklad';
|
||||
|
||||
try {
|
||||
$response = $client->orders->create($request);
|
||||
} catch (ApiExceptionInterface | ClientExceptionInterface $exception) {
|
||||
echo $exception; // Every ApiExceptionInterface instance should implement __toString() method.
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
printf(
|
||||
'Created order id = %d with the following data: %s',
|
||||
$response->id,
|
||||
print_r($response->order, true)
|
||||
);
|
||||
```
|
||||
|
||||
|
50
doc/usage/examples/fetch_orders.md
Normal file
|
@ -0,0 +1,50 @@
|
|||
That's how you can fetch the orders list:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use RetailCrm\Api\Interfaces\ClientExceptionInterface;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
use RetailCrm\Api\Model\Entity\CustomersCorporate\CustomerCorporate;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
|
||||
try {
|
||||
$response = $client->orders->list();
|
||||
} catch (ApiExceptionInterface | ClientExceptionInterface $exception) {
|
||||
echo $exception; // Every ApiExceptionInterface instance should implement __toString() method.
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
foreach ($response->orders as $order) {
|
||||
printf("Order ID: %d\n", $order->id);
|
||||
printf("First name: %s\n", $order->firstName);
|
||||
printf("Last name: %s\n", $order->lastName);
|
||||
printf("Patronymic: %s\n", $order->patronymic);
|
||||
printf("Phone #1: %s\n", $order->phone);
|
||||
printf("Phone #2: %s\n", $order->additionalPhone);
|
||||
printf("E-Mail: %s\n", $order->email);
|
||||
|
||||
if ($order->customer instanceof CustomerCorporate) {
|
||||
echo "Customer type: corporate\n";
|
||||
} else {
|
||||
echo "Customer type: individual\n";
|
||||
}
|
||||
|
||||
foreach ($order->items as $item) {
|
||||
echo PHP_EOL;
|
||||
|
||||
printf("Product name: %s\n", $item->productName);
|
||||
printf("Quantity: %d\n", $item->quantity);
|
||||
printf("Initial price: %f\n", $item->initialPrice);
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
|
||||
printf("Discount: %f\n", $order->discountManualAmount);
|
||||
printf("Total: %f\n", $order->totalSumm);
|
||||
|
||||
echo PHP_EOL;
|
||||
}
|
||||
```
|
7
doc/usage/examples/index.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
## Examples
|
||||
|
||||
* [How to create an order](create_order.md)
|
||||
* [How to receive the list of orders](fetch_orders.md)
|
||||
* [How to handle all Client's exceptions](complete_error_handling_example.md)
|
||||
* [Fetching orders history](orders_history.md)
|
||||
* [Complex pagination example](complex_pagination/index.md)
|
34
doc/usage/examples/orders_history.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
In this example we will fetch all history entries for 1 month from the API.
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Enum\PaginationLimit;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
use RetailCrm\Api\Interfaces\ClientExceptionInterface;
|
||||
use RetailCrm\Api\Model\Filter\Orders\OrderHistoryFilterV4Type;
|
||||
use RetailCrm\Api\Model\Request\Orders\OrdersHistoryRequest;
|
||||
|
||||
$history = [];
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||
$request = new OrdersHistoryRequest();
|
||||
$request->filter = new OrderHistoryFilterV4Type();
|
||||
$request->limit = PaginationLimit::LIMIT_100;
|
||||
$request->filter->startDate = (new DateTime())->sub(new DateInterval('P1M')); // History for 1 month by default.
|
||||
|
||||
do {
|
||||
time_nanosleep(0, 100000000); // 10 requests per second
|
||||
|
||||
try {
|
||||
$response = $client->orders->history($request);
|
||||
} catch (ClientExceptionInterface | ApiExceptionInterface $exception) {
|
||||
echo $exception;
|
||||
break;
|
||||
}
|
||||
|
||||
$history = array_merge($history, $response->history);
|
||||
$request->filter->startDate = null;
|
||||
$request->filter->sinceId = end($response->history)->id;
|
||||
} while ($response->pagination->currentPage < $response->pagination->totalPageCount);
|
||||
|
||||
// Here you can process all history entries in the `$history` variable.
|
||||
```
|
255
doc/usage/instantiation.md
Normal file
|
@ -0,0 +1,255 @@
|
|||
## Instantiation
|
||||
|
||||
There are several ways to instantiate the Client. Let's take look at them: from the simplest one to the most complex.
|
||||
|
||||
* [Instantiation via `SimpleClientFactory`](#instantiation-via-simpleclientfactory)
|
||||
* [Instantiation via `ClientFactory`](#instantiation-via-clientfactory)
|
||||
+ [Simple example](#simple-example)
|
||||
+ [Abstract example](#abstract-example)
|
||||
+ [Real-world example (Symfony)](#real-world-example-symfony)
|
||||
* [Instantiation via `ClientBuilder`](#instantiation-via-clientbuilder)
|
||||
|
||||
### Instantiation via `SimpleClientFactory`
|
||||
|
||||
It's the easiest way to instantiate an API client. You can use this method if you just want to use API client without
|
||||
thinking much about integration with the app or framework.
|
||||
|
||||
Example:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'key');
|
||||
```
|
||||
|
||||
That's it. You can use `$client` to make requests. However, even this simple method allows you to pass the `CacheItemPoolInterface` instance
|
||||
(`symfony/cache` is being used by default) or path to the cache directory. The cache is being used by the client to store
|
||||
annotations which omits the necessity to parse them each time you send a request.
|
||||
|
||||
Example with the `CacheItemPoolInterface` instance (we're using Redis as cache here):
|
||||
|
||||
```php
|
||||
use Symfony\Component\Cache\Adapter\RedisAdapter;
|
||||
use RetailCrm\Api\Enum\CacheDirectories;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
|
||||
$redis = new Redis();
|
||||
$redis->connect('127.0.0.1', 6379);
|
||||
|
||||
$client = SimpleClientFactory::createWithCache(
|
||||
'https://test.retailcrm.pro',
|
||||
'key',
|
||||
new RedisAdapter($redis, CacheDirectories::DIR_NAME)
|
||||
);
|
||||
```
|
||||
|
||||
`CacheDirectories::DIR_NAME` is optional here. You can use any other namespace you want. By default, `CacheDirectories::DIR_NAME`
|
||||
will be used as a namespace by default if the cache instance was created by the client automatically.
|
||||
|
||||
It's easier to use `SimpleClientFactory::createWithCacheDir` if you just want to specify your directory for cache instead of
|
||||
default temporary directory:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
|
||||
$client = SimpleClientFactory::createWithCacheDir('https://test.retailcrm.pro', 'key', __DIR__ . '/cache');
|
||||
```
|
||||
|
||||
You can find more details about `SimpleClientFactory` in the documentation:
|
||||
* [`SimpleClientFactory`](https://retailcrm.github.io/api-client-php/classes/RetailCrm-Api-Factory-SimpleClientFactory.html)
|
||||
|
||||
### Instantiation via `ClientFactory`
|
||||
|
||||
The main difference between `SimpleClientFactory` and `ClientFactory` is the fact that the second factory is stateful.
|
||||
It allows you to better integrate this client with your application. Consider the following: you may just set all global client
|
||||
dependencies into the `ClientFactory` during the dependency container instantiation, and use the factory after that
|
||||
to instantiate any number of clients you want.
|
||||
|
||||
#### Simple example
|
||||
|
||||
Here's an example of `ClientFactory` usage without any integration with the framework or the app:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Factory\ClientFactory;
|
||||
use League\Event\EventDispatcher;
|
||||
|
||||
$eventDispatcher = new EventDispatcher();
|
||||
$factory = new ClientFactory();
|
||||
$factory
|
||||
->setCacheDir('/tmp/retailcrm_cache')
|
||||
->setEventDispatcher($eventDispatcher);
|
||||
|
||||
$client = $factory->createClient('https://test.retailcrm.pro', 'key');
|
||||
```
|
||||
|
||||
Doesn't look that impressive, right? That's because `ClientFactory` is not supposed to be used just like that.
|
||||
It won't give you any benefits in comparison to `SimpleClientFactory` with such usage.
|
||||
|
||||
Let's take a look at the more complex example. We'll use `league/container` here to demonstrate how you can integrate
|
||||
`ClientFactory` with the DI you're using.
|
||||
|
||||
#### Abstract example
|
||||
|
||||
Let's assume that you have a specific service that should instantiate a Client for some internal purposes.
|
||||
Here it is:
|
||||
|
||||
```php
|
||||
namespace App\Services;
|
||||
|
||||
use RetailCrm\Api\Interfaces\ClientFactoryInterface;
|
||||
use Throwable;
|
||||
|
||||
class ClientFactoryDependentService
|
||||
{
|
||||
/** @var ClientFactoryInterface */
|
||||
private $clientFactory;
|
||||
|
||||
public function __construct(ClientFactoryInterface $clientFactory)
|
||||
{
|
||||
$this->clientFactory = $clientFactory;
|
||||
}
|
||||
|
||||
public function isApiAccessible(string $apiUrl, string $apiKey): bool
|
||||
{
|
||||
try {
|
||||
$client = $this->clientFactory->createClient($apiUrl, $apiKey);
|
||||
$client->api->apiVersions();
|
||||
|
||||
return true;
|
||||
} catch (Throwable $throwable) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
And you have a controller which returns a JSON response with the API availability flag. It requires the service above.
|
||||
|
||||
```php
|
||||
namespace App\Controller;
|
||||
|
||||
use Some\Framework\Specific\Annotations\Route;
|
||||
use Some\Framework\Specific\Controller;
|
||||
use Some\Framework\Specific\Response;
|
||||
|
||||
class HealthCheckController extends Controller
|
||||
{
|
||||
/** @var ClientFactoryDependentService */
|
||||
private $service;
|
||||
|
||||
public function __construct(ClientFactoryDependentService $service)
|
||||
{
|
||||
$this->service = $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/healthcheck")
|
||||
*/
|
||||
public function healthCheckAction(): Response
|
||||
{
|
||||
return $this->responseJson([
|
||||
'is_api_accessible' => $this->service->isApiAccessible($_GET['apiUrl'], $_GET['apiKey'])
|
||||
]);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
During the container configuration you configure the container to instantiate proper `ClientFactory` once. After that
|
||||
you can use the factory in any service you want. Here's an example with the `league/container`:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Factory\ClientFactory;
|
||||
use RetailCrm\Api\Interfaces\ClientFactoryInterface;
|
||||
use League\Container\Container;
|
||||
use League\Event\EventDispatcher;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
|
||||
use App\Services\ClientFactoryDependentService;
|
||||
use App\Controller\HealthCheckController;
|
||||
|
||||
$container = new Container();
|
||||
|
||||
$container->add(CacheItemPoolInterface::class, new FilesystemAdapter('test_app'));
|
||||
$container->add(EventDispatcherInterface::class, EventDispatcher::class);
|
||||
$container->add(ClientFactoryInterface::class, ClientFactory::class)
|
||||
->addMethodCalls([
|
||||
'setCache' => [CacheItemPoolInterface::class],
|
||||
'setEventDispatcher' => [EventDispatcherInterface::class],
|
||||
]);
|
||||
$container->add(ClientFactoryDependentService::class)->addArgument(ClientFactoryInterface::class);
|
||||
$container->add(HealthCheckController::class)->addArgument(ClientFactoryDependentService::class);
|
||||
```
|
||||
|
||||
That's it! Now your controller is using the underlying service to form a response. The service is using `ClientFactory`
|
||||
which is being instantiated only once by the container. `ClientFactory` can be injected into other services as well, and it
|
||||
will be the same instance.
|
||||
|
||||
#### Real-world example (Symfony)
|
||||
|
||||
You can use this exact service definition to instantiate a `ClientFactory` instance:
|
||||
|
||||
```yaml
|
||||
RetailCrm\Api\Interfaces\ClientFactoryInterface:
|
||||
class: 'RetailCrm\Api\Factory\ClientFactory'
|
||||
calls:
|
||||
- setCacheDir: ['%kernel.cache_dir%']
|
||||
- setEventDispatcher: ['@event_dispatcher']
|
||||
```
|
||||
|
||||
That's it. Now you can autowire `ClientFactoryInterface` in your services. It also allows you to mock the factory itself
|
||||
in the tests using `services_test.yml`.
|
||||
|
||||
You can find more details about `ClientFactory` in the documentation:
|
||||
* [`ClientFactory`](https://retailcrm.github.io/api-client-php/classes/RetailCrm-Api-Factory-ClientFactory.html)
|
||||
|
||||
### Instantiation via `ClientBuilder`
|
||||
|
||||
`ClientBuilder` is the most powerful, and most complex method of client instantiation. It allows you to replace any client's
|
||||
external dependencies with your own implementations. Here's an example of `ClientBuilder` usage:
|
||||
|
||||
```php
|
||||
use Http\Client\Curl\Client as CurlClient;
|
||||
use League\Event\EventDispatcher;
|
||||
use Nyholm\Psr7\Factory\Psr17Factory;
|
||||
use RetailCrm\Api\Builder\ClientBuilder;
|
||||
use RetailCrm\Api\Builder\FormEncoderBuilder;
|
||||
use RetailCrm\Api\Component\Transformer\RequestTransformer;
|
||||
use RetailCrm\Api\Component\Transformer\ResponseTransformer;
|
||||
use RetailCrm\Api\Factory\ApiExceptionFactory;
|
||||
use RetailCrm\Api\Factory\RequestPipelineFactory;
|
||||
use RetailCrm\Api\Factory\ResponsePipelineFactory;
|
||||
use RetailCrm\Api\Handler\Request\HeaderAuthenticatorHandler;
|
||||
|
||||
$eventDispatcher = new EventDispatcher();
|
||||
$psr17Factory = new Psr17Factory();
|
||||
$httpClient = new CurlClient();
|
||||
|
||||
$builder = new ClientBuilder();
|
||||
$formEncoder = (new FormEncoderBuilder())->setCacheDir('cache')->build();
|
||||
$client = $builder->setApiUrl('https://test.retailcrm.pro')
|
||||
->setAuthenticatorHandler(new HeaderAuthenticatorHandler('apiKey'))
|
||||
->setFormEncoder($formEncoder)
|
||||
->setHttpClient($httpClient)
|
||||
->setRequestTransformer(new RequestTransformer(
|
||||
RequestPipelineFactory::createDefaultPipeline(
|
||||
$formEncoder,
|
||||
$psr17Factory, // PSR-17 UriFactoryInterface
|
||||
$psr17Factory, // PSR-17 RequestFactoryInterface
|
||||
$psr17Factory // PSR-17 StreamFactoryInterface
|
||||
)
|
||||
))
|
||||
->setResponseTransformer(new ResponseTransformer(
|
||||
ResponsePipelineFactory::createDefaultPipeline(
|
||||
$formEncoder->getSerializer(),
|
||||
new ApiExceptionFactory(),
|
||||
$eventDispatcher
|
||||
)
|
||||
))->build();
|
||||
```
|
||||
|
||||
You can find more details about this in the documentation:
|
||||
* [`ClientBuilder`](https://retailcrm.github.io/api-client-php/classes/RetailCrm-Api-Builder-ClientBuilder.html)
|
||||
* [`FormEncoderBuilder`](https://retailcrm.github.io/api-client-php/classes/RetailCrm-Api-Builder-FormEncoderBuilder.html)
|
||||
* [`RequestPipelineFactory`](https://retailcrm.github.io/api-client-php/classes/RetailCrm-Api-Factory-RequestPipelineFactory.html)
|
||||
* [`ResponsePipelineFactory`](https://retailcrm.github.io/api-client-php/classes/RetailCrm-Api-Factory-ResponsePipelineFactory.html)
|
144
doc/usage/sending_a_request.md
Normal file
|
@ -0,0 +1,144 @@
|
|||
## Sending a request
|
||||
|
||||
You need three things to send a request:
|
||||
1. [Resource group, DTOs, and method](#choosing-correct-resource-group-dtos-and-method)
|
||||
2. [Send a request](#sending-a-request)
|
||||
3. [Deal with exceptions](#dealing-with-exceptions)
|
||||
|
||||
### Choosing correct resource group, DTOs, and method
|
||||
|
||||
First, take a look at the API itself:
|
||||
* [English](https://docs.retailcrm.pro/Developers/API/APIVersions/APIv5)
|
||||
* [Русский](https://docs.retailcrm.ru/Developers/API/APIVersions/APIv5)
|
||||
|
||||
Choose a method you want to use. Which one is yours depend on the task you want to perform.
|
||||
|
||||
Then take look at the API again. It consists of several blocks, each block is responsible for a specific set of features.
|
||||
The Client itself is also separated to those blocks or resource groups (full list of them can be found [here](../structure.md#resource-groups)).
|
||||
|
||||
Each resource group corresponds to an equal block in the documentation. For example. `customersCorporate` resource group implements methods
|
||||
in the _Corporate customers_ API block (рус. _Корпоративные клиенты_).
|
||||
|
||||
Just look at the method you want to use and pick a proper resource group. That's it. Let's move on to the DTOs.
|
||||
|
||||
Choosing proper DTOs is also easy. Each client method defines expected parameter types. If the method doesn't have any
|
||||
parameters, then the API method is also doesn't require any parameters and can be just called. The most noteworthy would be
|
||||
`/api/api-versions` and `/api/credentials` methods. They can be called from the Client instance like that:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'key');
|
||||
$client->api->apiVersions();
|
||||
$client->api->credentials();
|
||||
```
|
||||
|
||||
The majority of the methods will require some parameters. Usually it's a request DTO, some path parameters (like customer id)
|
||||
or both. For example, `/api/v5/customers/create` method requires request DTO, `/api/v5/customers/{externalId}` requires
|
||||
customer ID and `/api/v5/customers/{externalId}/edit` requires both.
|
||||
|
||||
The corresponding methods on the client instance are:
|
||||
|
||||
| API method | Client instance method |
|
||||
| ------------------------------------- | ---------------------------- |
|
||||
| `/api/v5/customers/create` | `$client->customers->create` |
|
||||
| `/api/v5/customers/{externalId}` | `$client->customers->get` |
|
||||
| `/api/v5/customers/{externalId}/edit` | `$client->customers->edit` |
|
||||
|
||||
Look at the method definitions (they have also shown by the IDE):
|
||||
|
||||
```php
|
||||
public function create(CustomersCreateRequest $request): IdResponse;
|
||||
public function get($identifier, ?BySiteRequest $request = null): CustomersGetResponse;
|
||||
public function edit($identifier, CustomersEditRequest $request): CustomersEditResponse;
|
||||
```
|
||||
|
||||
Just use types from the type hints and everything will work. The DTO's fields also have type declarations but in the form
|
||||
of the `@var` annotation tags. That's how you can choose the correct type for the DTO fields.
|
||||
|
||||
### Sending a request
|
||||
|
||||
Using information from the previous article you can easily construct a request.
|
||||
|
||||
This request will create a new customer.
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Model\Entity\Customers\Customer;
|
||||
use RetailCrm\Api\Model\Request\Customers\CustomersCreateRequest;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'key');
|
||||
$request = new CustomersCreateRequest();
|
||||
|
||||
$request->customer = new Customer();
|
||||
$request->customer->email = 'test@example.com';
|
||||
$request->site = 'site';
|
||||
|
||||
$response = $client->customers->create($request);
|
||||
```
|
||||
|
||||
This one will fetch specific customer from the API by the ID and site.
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Enum\ByIdentifier;use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Model\Request\BySiteRequest;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'key');
|
||||
$response = $client->customers->get(1, new BySiteRequest(ByIdentifier::ID, 'site'));
|
||||
|
||||
echo $response->customer->email;
|
||||
```
|
||||
|
||||
And this one will edit specific customer:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Enum\ByIdentifier;
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Model\Entity\Customers\Customer;
|
||||
use RetailCrm\Api\Model\Request\Customers\CustomersEditRequest;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'key');
|
||||
$request = new CustomersEditRequest();
|
||||
|
||||
$request->customer = new Customer();
|
||||
$request->customer->email = 'test@example.com';
|
||||
$request->site = 'site';
|
||||
$request->by = ByIdentifier::ID;
|
||||
|
||||
$response = $client->customers->edit(1, $request);
|
||||
|
||||
echo "Edited customer ID: " . $response->id;
|
||||
```
|
||||
|
||||
### Dealing with exceptions
|
||||
|
||||
What will happen if an API error is returned for the one of requests above? Or the network is not working at all?
|
||||
An exception will happen.
|
||||
|
||||
There are two main exception types:
|
||||
* `RetailCrm\Api\Interfaces\ApiExceptionInterface` is thrown if API returned an error.
|
||||
* `RetailCrm\Api\Interfaces\ClientExceptionInterface` is thrown if the request cannot be sent due to an internal error.
|
||||
|
||||
You can use those like this:
|
||||
|
||||
```php
|
||||
use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||
use RetailCrm\Api\Interfaces\ClientExceptionInterface;
|
||||
|
||||
$client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'key');
|
||||
|
||||
try {
|
||||
$response = $client->customers->list();
|
||||
} catch (ApiExceptionInterface $exception) {
|
||||
echo $exception;
|
||||
} catch (ClientExceptionInterface $exception) {
|
||||
echo 'Client error: ' . $exception->getMessage();
|
||||
}
|
||||
|
||||
if (isset($response)) {
|
||||
echo "Customers: " . print_r($response->customers, true);
|
||||
}
|
||||
```
|
||||
|
||||
More information about exceptions can be found on the [error handling](error_handling.md) page.
|
15
doc/usage/usage.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
## Usage
|
||||
|
||||
* [Instantiation](instantiation.md)
|
||||
* [Sending a request](sending_a_request.md)
|
||||
* [Choosing correct resource group, DTOs, and method](sending_a_request.md#choosing-correct-resource-group-dtos-and-method)
|
||||
* [Sending a request](sending_a_request.md#sending-a-request)
|
||||
* [Dealing with exceptions](sending_a_request.md#dealing-with-exceptions)
|
||||
* [Error handling](error_handling.md)
|
||||
* [Examples](examples)
|
||||
+ [How to create an order](examples/create_order.md)
|
||||
+ [How to receive the list of orders](examples/fetch_orders.md)
|
||||
+ [How to handle all Client's exceptions](examples/complete_error_handling_example.md)
|
||||
+ [Fetching orders history](examples/orders_history.md)
|
||||
+ [Complex pagination example](examples/complex_pagination/index.md)
|
||||
* [Event handling](event_handing.md)
|
|
@ -1,93 +0,0 @@
|
|||
PHP client for retailCRM API
|
||||
=================
|
||||
|
||||
PHP client for [retailCRM API](http://www.retailcrm.ru/docs/Разработчики/Разработчики#api).
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
* PHP version 5.3 and above
|
||||
* PHP-extension CURL
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
1) Install [composer](https://getcomposer.org/download/)
|
||||
|
||||
2) Run:
|
||||
```bash
|
||||
composer require retailcrm/api-client-php 3.0
|
||||
```
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Example of the receipt of order:
|
||||
```php
|
||||
|
||||
$client = new \RetailCrm\ApiClient(
|
||||
'https://demo.intarocrm.ru',
|
||||
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH'
|
||||
);
|
||||
|
||||
try {
|
||||
$response = $client->ordersGet('M-2342');
|
||||
} catch (\RetailCrm\Exception\CurlException $e) {
|
||||
echo "CRM connection error: " . $e->getMessage();
|
||||
}
|
||||
|
||||
if ($response->isSuccessful()) {
|
||||
echo $response->order['totalSumm'];
|
||||
// or $response['order']['totalSumm'];
|
||||
// or
|
||||
// $order = $response->getOrder();
|
||||
// $order['totalSumm'];
|
||||
} else {
|
||||
echo sprintf(
|
||||
"Error of the order receipt: [Code %s] %s",
|
||||
$response->getStatusCode(),
|
||||
$response->getErrorMsg()
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
Example of the order creating:
|
||||
```php
|
||||
|
||||
$client = new \RetailCrm\ApiClient(
|
||||
'https://demo.intarocrm.ru',
|
||||
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH'
|
||||
);
|
||||
|
||||
try {
|
||||
$response = $client->ordersCreate(array(
|
||||
'externalId' => 'some-shop-order-id',
|
||||
'firstName' => 'Vasily',
|
||||
'lastName' => 'Pupkin',
|
||||
'items' => array(
|
||||
//...
|
||||
),
|
||||
'delivery' => array(
|
||||
'code' => 'russian-post',
|
||||
)
|
||||
));
|
||||
} catch (\RetailCrm\Exception\CurlException $e) {
|
||||
echo "CRM connection error: " . $e->getMessage();
|
||||
}
|
||||
|
||||
if ($response->isSuccessful()) {
|
||||
if (201 === $response->getStatusCode()) {
|
||||
echo 'Order created successfully! Order ID in CRM = ' . $response->id;
|
||||
// or $response['id'];
|
||||
// or $response->getId();
|
||||
} else {
|
||||
echo 'Order updated successfully!';
|
||||
}
|
||||
} else {
|
||||
echo sprintf(
|
||||
"Error of the order creating: [Code %s] %s",
|
||||
$response->getStatusCode(),
|
||||
$response->getErrorMsg()
|
||||
);
|
||||
}
|
||||
```
|
|
@ -1,119 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex">
|
||||
|
||||
<title>Page not found | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<span>Namespace</span> </li>
|
||||
<li>
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.ApiClient.html">RetailCrm\ApiClient</a></li>
|
||||
<li><a href="class-RetailCrm.Http.Client.html">RetailCrm\Http\Client</a></li>
|
||||
<li><a href="class-RetailCrm.Response.ApiResponse.html">RetailCrm\Response\ApiResponse</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h3>Exceptions</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.Exception.CurlException.html">RetailCrm\Exception\CurlException</a></li>
|
||||
<li><a href="class-RetailCrm.Exception.InvalidJsonException.html">RetailCrm\Exception\InvalidJsonException</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content">
|
||||
<h1>Page not found</h1>
|
||||
<p>The requested page could not be found.</p>
|
||||
<p>You have probably clicked on a link that is outdated and points to a page that does not exist any more or you have made an typing error in the address.</p>
|
||||
<p>To continue please try to find requested page in the menu, take a look at <a href="tree.html">the tree view</a> of the whole project or use search field on the top.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,180 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Class RetailCrm\Exception\CurlException | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html" title="Summary of RetailCrm\Exception"><span>Namespace</span></a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
|
||||
|
||||
|
||||
<h3>Exceptions</h3>
|
||||
<ul>
|
||||
<li class="active"><a href="class-RetailCrm.Exception.CurlException.html">CurlException</a></li>
|
||||
<li><a href="class-RetailCrm.Exception.InvalidJsonException.html">InvalidJsonException</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content" class="class">
|
||||
<h1>Class CurlException</h1>
|
||||
|
||||
|
||||
<div class="description">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<dl class="tree well">
|
||||
<dd style="padding-left:0px">
|
||||
Exception
|
||||
|
||||
|
||||
</dd>
|
||||
<dd style="padding-left:30px">
|
||||
<img src="resources/inherit.png" alt="Extended by">
|
||||
RuntimeException
|
||||
|
||||
|
||||
</dd>
|
||||
<dd style="padding-left:60px">
|
||||
<img src="resources/inherit.png" alt="Extended by">
|
||||
<b><span>RetailCrm\Exception\CurlException</span></b>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="alert alert-info">
|
||||
|
||||
|
||||
<b>Namespace:</b> RetailCrm\Exception<br>
|
||||
|
||||
|
||||
<b>Located at</b> <a href="source-class-RetailCrm.Exception.CurlException.html#5-7" title="Go to source code">RetailCrm/Exception/CurlException.php</a><br>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<h2>Methods summary</h2>
|
||||
|
||||
<h3>Methods inherited from Exception</h3>
|
||||
<p class="elementList">
|
||||
<code>__construct()</code>,
|
||||
<code>__toString()</code>,
|
||||
<code>getCode()</code>,
|
||||
<code>getFile()</code>,
|
||||
<code>getLine()</code>,
|
||||
<code>getMessage()</code>,
|
||||
<code>getPrevious()</code>,
|
||||
<code>getTrace()</code>,
|
||||
<code>getTraceAsString()</code>
|
||||
</p>
|
||||
|
||||
|
||||
<h3>Magic methods summary</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,186 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Class RetailCrm\Exception\InvalidJsonException | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html" title="Summary of RetailCrm\Exception"><span>Namespace</span></a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
|
||||
|
||||
|
||||
<h3>Exceptions</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.Exception.CurlException.html">CurlException</a></li>
|
||||
<li class="active"><a href="class-RetailCrm.Exception.InvalidJsonException.html">InvalidJsonException</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content" class="class">
|
||||
<h1>Class InvalidJsonException</h1>
|
||||
|
||||
|
||||
<div class="description">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<dl class="tree well">
|
||||
<dd style="padding-left:0px">
|
||||
Exception
|
||||
|
||||
|
||||
</dd>
|
||||
<dd style="padding-left:30px">
|
||||
<img src="resources/inherit.png" alt="Extended by">
|
||||
LogicException
|
||||
|
||||
|
||||
</dd>
|
||||
<dd style="padding-left:60px">
|
||||
<img src="resources/inherit.png" alt="Extended by">
|
||||
DomainException
|
||||
|
||||
|
||||
</dd>
|
||||
<dd style="padding-left:90px">
|
||||
<img src="resources/inherit.png" alt="Extended by">
|
||||
<b><span>RetailCrm\Exception\InvalidJsonException</span></b>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="alert alert-info">
|
||||
|
||||
|
||||
<b>Namespace:</b> RetailCrm\Exception<br>
|
||||
|
||||
|
||||
<b>Located at</b> <a href="source-class-RetailCrm.Exception.InvalidJsonException.html#5-7" title="Go to source code">RetailCrm/Exception/InvalidJsonException.php</a><br>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<h2>Methods summary</h2>
|
||||
|
||||
<h3>Methods inherited from Exception</h3>
|
||||
<p class="elementList">
|
||||
<code>__construct()</code>,
|
||||
<code>__toString()</code>,
|
||||
<code>getCode()</code>,
|
||||
<code>getFile()</code>,
|
||||
<code>getLine()</code>,
|
||||
<code>getMessage()</code>,
|
||||
<code>getPrevious()</code>,
|
||||
<code>getTrace()</code>,
|
||||
<code>getTraceAsString()</code>
|
||||
</p>
|
||||
|
||||
|
||||
<h3>Magic methods summary</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,287 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Class RetailCrm\Http\Client | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html" title="Summary of RetailCrm\Http"><span>Namespace</span></a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li class="active"><a href="class-RetailCrm.Http.Client.html">Client</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content" class="class">
|
||||
<h1>Class Client</h1>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>HTTP client</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="alert alert-info">
|
||||
|
||||
|
||||
<b>Namespace:</b> RetailCrm\Http<br>
|
||||
|
||||
|
||||
<b>Located at</b> <a href="source-class-RetailCrm.Http.Client.html#8-82" title="Go to source code">RetailCrm/Http/Client.php</a><br>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<h2>Methods summary</h2>
|
||||
<table class="summary table table-bordered table-striped methods" id="methods">
|
||||
<tr data-order="__construct" id="___construct">
|
||||
|
||||
<td class="attributes"><code>
|
||||
public
|
||||
|
||||
|
||||
</code>
|
||||
</td>
|
||||
|
||||
<td class="name"><div>
|
||||
<a class="anchor" href="#___construct">#</a>
|
||||
<code><a href="source-class-RetailCrm.Http.Client.html#19-27" title="Go to source code">__construct</a>( <span>mixed <var>$url</var></span>, <span>array <var>$defaultParameters</var> = <span class="php-keyword1">array</span>()</span> )</code>
|
||||
|
||||
<div class="description short">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr data-order="makeRequest" id="_makeRequest">
|
||||
|
||||
<td class="attributes"><code>
|
||||
public
|
||||
<code><a href="class-RetailCrm.Response.ApiResponse.html">RetailCrm\Response\ApiResponse</a></code>
|
||||
|
||||
</code>
|
||||
</td>
|
||||
|
||||
<td class="name"><div>
|
||||
<a class="anchor" href="#_makeRequest">#</a>
|
||||
<code><a href="source-class-RetailCrm.Http.Client.html#29-81" title="Go to source code">makeRequest</a>( <span>string <var>$path</var></span>, <span>string <var>$method</var></span>, <span>array <var>$parameters</var> = <span class="php-keyword1">array</span>()</span>, <span>integer <var>$timeout</var> = <span class="php-num">30</span></span> )</code>
|
||||
|
||||
<div class="description short">
|
||||
<p>Make HTTP request</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
<p>Make HTTP request</p>
|
||||
|
||||
|
||||
|
||||
<h4>Parameters</h4>
|
||||
<div class="list"><dl>
|
||||
<dt><var>$path</var></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><var>$method</var></dt>
|
||||
<dd>(default: 'GET')
|
||||
</dd>
|
||||
<dt><var>$parameters</var></dt>
|
||||
<dd>(default: array())
|
||||
</dd>
|
||||
<dt><var>$timeout</var></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl></div>
|
||||
|
||||
<h4>Returns</h4>
|
||||
<div class="list">
|
||||
<code><code><a href="class-RetailCrm.Response.ApiResponse.html">RetailCrm\Response\ApiResponse</a></code></code>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<h3>Magic methods summary</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Constants summary</h2>
|
||||
<table class="summary table table-bordered table-striped constants" id="constants">
|
||||
<tr data-order="METHOD_GET" id="METHOD_GET">
|
||||
|
||||
<td class="attributes"><code>string</code></td>
|
||||
<td class="name">
|
||||
<code>
|
||||
<a href="source-class-RetailCrm.Http.Client.html#13" title="Go to source code"><b>METHOD_GET</b></a>
|
||||
</code>
|
||||
|
||||
<div class="description short">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td class="value">
|
||||
<div>
|
||||
<a href="#METHOD_GET" class="anchor">#</a>
|
||||
<code><span class="php-quote">'GET'</span></code>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr data-order="METHOD_POST" id="METHOD_POST">
|
||||
|
||||
<td class="attributes"><code>string</code></td>
|
||||
<td class="name">
|
||||
<code>
|
||||
<a href="source-class-RetailCrm.Http.Client.html#14" title="Go to source code"><b>METHOD_POST</b></a>
|
||||
</code>
|
||||
|
||||
<div class="description short">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td class="value">
|
||||
<div>
|
||||
<a href="#METHOD_POST" class="anchor">#</a>
|
||||
<code><span class="php-quote">'POST'</span></code>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,512 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Class RetailCrm\Response\ApiResponse | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html" title="Summary of RetailCrm\Response"><span>Namespace</span></a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li class="active"><a href="class-RetailCrm.Response.ApiResponse.html">ApiResponse</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content" class="class">
|
||||
<h1>Class ApiResponse</h1>
|
||||
|
||||
|
||||
<div class="description">
|
||||
<p>Response from retailCRM API</p>
|
||||
|
||||
</div>
|
||||
|
||||
<dl class="tree well">
|
||||
<dd style="padding-left:0px">
|
||||
<b><span>RetailCrm\Response\ApiResponse</span></b>
|
||||
implements
|
||||
<span>ArrayAccess</span>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="alert alert-info">
|
||||
|
||||
|
||||
<b>Namespace:</b> RetailCrm\Response<br>
|
||||
|
||||
|
||||
<b>Located at</b> <a href="source-class-RetailCrm.Response.ApiResponse.html#7-127" title="Go to source code">RetailCrm/Response/ApiResponse.php</a><br>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<h2>Methods summary</h2>
|
||||
<table class="summary table table-bordered table-striped methods" id="methods">
|
||||
<tr data-order="__construct" id="___construct">
|
||||
|
||||
<td class="attributes"><code>
|
||||
public
|
||||
|
||||
|
||||
</code>
|
||||
</td>
|
||||
|
||||
<td class="name"><div>
|
||||
<a class="anchor" href="#___construct">#</a>
|
||||
<code><a href="source-class-RetailCrm.Response.ApiResponse.html#18-34" title="Go to source code">__construct</a>( <span>mixed <var>$statusCode</var></span>, <span>mixed <var>$responseBody</var> = <span class="php-keyword1">null</span></span> )</code>
|
||||
|
||||
<div class="description short">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr data-order="getStatusCode" id="_getStatusCode">
|
||||
|
||||
<td class="attributes"><code>
|
||||
public
|
||||
integer
|
||||
|
||||
</code>
|
||||
</td>
|
||||
|
||||
<td class="name"><div>
|
||||
<a class="anchor" href="#_getStatusCode">#</a>
|
||||
<code><a href="source-class-RetailCrm.Response.ApiResponse.html#36-44" title="Go to source code">getStatusCode</a>( )</code>
|
||||
|
||||
<div class="description short">
|
||||
<p>Return HTTP response status code</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
<p>Return HTTP response status code</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Returns</h4>
|
||||
<div class="list">
|
||||
<code>integer</code>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr data-order="isSuccessful" id="_isSuccessful">
|
||||
|
||||
<td class="attributes"><code>
|
||||
public
|
||||
boolean
|
||||
|
||||
</code>
|
||||
</td>
|
||||
|
||||
<td class="name"><div>
|
||||
<a class="anchor" href="#_isSuccessful">#</a>
|
||||
<code><a href="source-class-RetailCrm.Response.ApiResponse.html#46-54" title="Go to source code">isSuccessful</a>( )</code>
|
||||
|
||||
<div class="description short">
|
||||
<p>HTTP request was successful</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
<p>HTTP request was successful</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Returns</h4>
|
||||
<div class="list">
|
||||
<code>boolean</code>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr data-order="__call" id="___call">
|
||||
|
||||
<td class="attributes"><code>
|
||||
public
|
||||
mixed
|
||||
|
||||
</code>
|
||||
</td>
|
||||
|
||||
<td class="name"><div>
|
||||
<a class="anchor" href="#___call">#</a>
|
||||
<code><a href="source-class-RetailCrm.Response.ApiResponse.html#56-72" title="Go to source code">__call</a>( <span>string <var>$name</var></span>, <span>mixed <var>$arguments</var></span> )</code>
|
||||
|
||||
<div class="description short">
|
||||
<p>Allow to access for the property throw class method</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
<p>Allow to access for the property throw class method</p>
|
||||
|
||||
|
||||
|
||||
<h4>Parameters</h4>
|
||||
<div class="list"><dl>
|
||||
<dt><var>$name</var></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><var>$arguments</var></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl></div>
|
||||
|
||||
<h4>Returns</h4>
|
||||
<div class="list">
|
||||
<code>mixed</code>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr data-order="__get" id="___get">
|
||||
|
||||
<td class="attributes"><code>
|
||||
public
|
||||
mixed
|
||||
|
||||
</code>
|
||||
</td>
|
||||
|
||||
<td class="name"><div>
|
||||
<a class="anchor" href="#___get">#</a>
|
||||
<code><a href="source-class-RetailCrm.Response.ApiResponse.html#74-87" title="Go to source code">__get</a>( <span>string <var>$name</var></span> )</code>
|
||||
|
||||
<div class="description short">
|
||||
<p>Allow to access for the property throw object property</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
<p>Allow to access for the property throw object property</p>
|
||||
|
||||
|
||||
|
||||
<h4>Parameters</h4>
|
||||
<div class="list"><dl>
|
||||
<dt><var>$name</var></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl></div>
|
||||
|
||||
<h4>Returns</h4>
|
||||
<div class="list">
|
||||
<code>mixed</code>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr data-order="offsetSet" id="_offsetSet">
|
||||
|
||||
<td class="attributes"><code>
|
||||
public
|
||||
|
||||
|
||||
</code>
|
||||
</td>
|
||||
|
||||
<td class="name"><div>
|
||||
<a class="anchor" href="#_offsetSet">#</a>
|
||||
<code><a href="source-class-RetailCrm.Response.ApiResponse.html#89-96" title="Go to source code">offsetSet</a>( <span>mixed <var>$offset</var></span>, <span>mixed <var>$value</var></span> )</code>
|
||||
|
||||
<div class="description short">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Parameters</h4>
|
||||
<div class="list"><dl>
|
||||
<dt><var>$offset</var></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
<dt><var>$value</var></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Implementation of</h4>
|
||||
<div class="list"><code>ArrayAccess::offsetSet()</code></div>
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr data-order="offsetUnset" id="_offsetUnset">
|
||||
|
||||
<td class="attributes"><code>
|
||||
public
|
||||
|
||||
|
||||
</code>
|
||||
</td>
|
||||
|
||||
<td class="name"><div>
|
||||
<a class="anchor" href="#_offsetUnset">#</a>
|
||||
<code><a href="source-class-RetailCrm.Response.ApiResponse.html#98-104" title="Go to source code">offsetUnset</a>( <span>mixed <var>$offset</var></span> )</code>
|
||||
|
||||
<div class="description short">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Parameters</h4>
|
||||
<div class="list"><dl>
|
||||
<dt><var>$offset</var></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Implementation of</h4>
|
||||
<div class="list"><code>ArrayAccess::offsetUnset()</code></div>
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr data-order="offsetExists" id="_offsetExists">
|
||||
|
||||
<td class="attributes"><code>
|
||||
public
|
||||
boolean
|
||||
|
||||
</code>
|
||||
</td>
|
||||
|
||||
<td class="name"><div>
|
||||
<a class="anchor" href="#_offsetExists">#</a>
|
||||
<code><a href="source-class-RetailCrm.Response.ApiResponse.html#106-113" title="Go to source code">offsetExists</a>( <span>mixed <var>$offset</var></span> )</code>
|
||||
|
||||
<div class="description short">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Parameters</h4>
|
||||
<div class="list"><dl>
|
||||
<dt><var>$offset</var></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl></div>
|
||||
|
||||
<h4>Returns</h4>
|
||||
<div class="list">
|
||||
<code>boolean</code>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Implementation of</h4>
|
||||
<div class="list"><code>ArrayAccess::offsetExists()</code></div>
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr data-order="offsetGet" id="_offsetGet">
|
||||
|
||||
<td class="attributes"><code>
|
||||
public
|
||||
mixed
|
||||
|
||||
</code>
|
||||
</td>
|
||||
|
||||
<td class="name"><div>
|
||||
<a class="anchor" href="#_offsetGet">#</a>
|
||||
<code><a href="source-class-RetailCrm.Response.ApiResponse.html#115-126" title="Go to source code">offsetGet</a>( <span>mixed <var>$offset</var></span> )</code>
|
||||
|
||||
<div class="description short">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="description detailed hidden">
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Parameters</h4>
|
||||
<div class="list"><dl>
|
||||
<dt><var>$offset</var></dt>
|
||||
<dd>
|
||||
</dd>
|
||||
</dl></div>
|
||||
|
||||
<h4>Returns</h4>
|
||||
<div class="list">
|
||||
<code>mixed</code>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Implementation of</h4>
|
||||
<div class="list"><code>ArrayAccess::offsetGet()</code></div>
|
||||
</div>
|
||||
</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<h3>Magic methods summary</h3>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,123 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Deprecated | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<span>Namespace</span> </li>
|
||||
<li>
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<span>Deprecated</span> </li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.ApiClient.html">RetailCrm\ApiClient</a></li>
|
||||
<li><a href="class-RetailCrm.Http.Client.html">RetailCrm\Http\Client</a></li>
|
||||
<li><a href="class-RetailCrm.Response.ApiResponse.html">RetailCrm\Response\ApiResponse</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h3>Exceptions</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.Exception.CurlException.html">RetailCrm\Exception\CurlException</a></li>
|
||||
<li><a href="class-RetailCrm.Exception.InvalidJsonException.html">RetailCrm\Exception\InvalidJsonException</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content">
|
||||
<h1>Deprecated</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
var ApiGen = ApiGen || {};
|
||||
ApiGen.elements = [["c","RetailCrm\\ApiClient"],["m","RetailCrm\\ApiClient::__construct()"],["m","RetailCrm\\ApiClient::customersCreate()"],["m","RetailCrm\\ApiClient::customersEdit()"],["m","RetailCrm\\ApiClient::customersFixExternalIds()"],["m","RetailCrm\\ApiClient::customersGet()"],["m","RetailCrm\\ApiClient::customersList()"],["m","RetailCrm\\ApiClient::customersUpload()"],["m","RetailCrm\\ApiClient::deliveryServicesEdit()"],["m","RetailCrm\\ApiClient::deliveryServicesList()"],["m","RetailCrm\\ApiClient::deliveryTypesEdit()"],["m","RetailCrm\\ApiClient::deliveryTypesList()"],["m","RetailCrm\\ApiClient::orderMethodsEdit()"],["m","RetailCrm\\ApiClient::orderMethodsList()"],["m","RetailCrm\\ApiClient::ordersCreate()"],["m","RetailCrm\\ApiClient::ordersEdit()"],["m","RetailCrm\\ApiClient::ordersFixExternalIds()"],["m","RetailCrm\\ApiClient::ordersGet()"],["m","RetailCrm\\ApiClient::ordersHistory()"],["m","RetailCrm\\ApiClient::ordersList()"],["m","RetailCrm\\ApiClient::ordersStatuses()"],["m","RetailCrm\\ApiClient::ordersUpload()"],["m","RetailCrm\\ApiClient::orderTypesEdit()"],["m","RetailCrm\\ApiClient::orderTypesList()"],["m","RetailCrm\\ApiClient::paymentStatusesEdit()"],["m","RetailCrm\\ApiClient::paymentStatusesList()"],["m","RetailCrm\\ApiClient::paymentTypesEdit()"],["m","RetailCrm\\ApiClient::paymentTypesList()"],["m","RetailCrm\\ApiClient::productStatusesEdit()"],["m","RetailCrm\\ApiClient::productStatusesList()"],["m","RetailCrm\\ApiClient::statisticUpdate()"],["m","RetailCrm\\ApiClient::statusesEdit()"],["m","RetailCrm\\ApiClient::statusesList()"],["m","RetailCrm\\ApiClient::statusGroupsList()"],["cc","RetailCrm\\ApiClient::VERSION"],["c","RetailCrm\\Exception\\CurlException"],["c","RetailCrm\\Exception\\InvalidJsonException"],["c","RetailCrm\\Http\\Client"],["m","RetailCrm\\Http\\Client::__construct()"],["m","RetailCrm\\Http\\Client::makeRequest()"],["cc","RetailCrm\\Http\\Client::METHOD_GET"],["cc","RetailCrm\\Http\\Client::METHOD_POST"],["c","RetailCrm\\Response\\ApiResponse"],["m","RetailCrm\\Response\\ApiResponse::__call()"],["m","RetailCrm\\Response\\ApiResponse::__construct()"],["m","RetailCrm\\Response\\ApiResponse::__get()"],["m","RetailCrm\\Response\\ApiResponse::getStatusCode()"],["m","RetailCrm\\Response\\ApiResponse::isSuccessful()"],["m","RetailCrm\\Response\\ApiResponse::offsetExists()"],["m","RetailCrm\\Response\\ApiResponse::offsetGet()"],["m","RetailCrm\\Response\\ApiResponse::offsetSet()"],["m","RetailCrm\\Response\\ApiResponse::offsetUnset()"]];
|
|
@ -1,134 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<span>Namespace</span> </li>
|
||||
<li>
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search" autofocus>
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.ApiClient.html">RetailCrm\ApiClient</a></li>
|
||||
<li><a href="class-RetailCrm.Http.Client.html">RetailCrm\Http\Client</a></li>
|
||||
<li><a href="class-RetailCrm.Response.ApiResponse.html">RetailCrm\Response\ApiResponse</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h3>Exceptions</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.Exception.CurlException.html">RetailCrm\Exception\CurlException</a></li>
|
||||
<li><a href="class-RetailCrm.Exception.InvalidJsonException.html">RetailCrm\Exception\InvalidJsonException</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content">
|
||||
<h1>retailCRM PHP API client</h1>
|
||||
|
||||
|
||||
<h2>Namespaces summary</h2>
|
||||
<table class="summary table table-bordered table-striped" id="namespaces">
|
||||
<tr>
|
||||
<td class="name"><a href="namespace-RetailCrm.html">RetailCrm</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name"><a href="namespace-RetailCrm.Exception.html">RetailCrm\Exception</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name"><a href="namespace-RetailCrm.Http.html">RetailCrm\Http</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name"><a href="namespace-RetailCrm.Response.html">RetailCrm\Response</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js"></script>
|
||||
<script src="elementlist.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,130 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Namespace RetailCrm\Exception | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li class="active">
|
||||
<span>Namespace</span> </li>
|
||||
<li>
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
|
||||
|
||||
|
||||
<h3>Exceptions</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.Exception.CurlException.html">CurlException</a></li>
|
||||
<li><a href="class-RetailCrm.Exception.InvalidJsonException.html">InvalidJsonException</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content" class="namespace">
|
||||
<h1>Namespace RetailCrm\Exception</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Exceptions summary</h2>
|
||||
<table class="summary table table-bordered table-striped" id="exceptions">
|
||||
<tr>
|
||||
<td class="name"><a href="class-RetailCrm.Exception.CurlException.html">CurlException</a></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name"><a href="class-RetailCrm.Exception.InvalidJsonException.html">InvalidJsonException</a></td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,124 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Namespace RetailCrm\Http | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li class="active">
|
||||
<span>Namespace</span> </li>
|
||||
<li>
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.Http.Client.html">Client</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content" class="namespace">
|
||||
<h1>Namespace RetailCrm\Http</h1>
|
||||
|
||||
|
||||
|
||||
<h2>Classes summary</h2>
|
||||
<table class="summary table table-bordered table-striped" id="classes">
|
||||
<tr>
|
||||
<td class="name"><a href="class-RetailCrm.Http.Client.html">Client</a></td>
|
||||
<td>HTTP client
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,124 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Namespace RetailCrm\Response | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li class="active">
|
||||
<span>Namespace</span> </li>
|
||||
<li>
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.Response.ApiResponse.html">ApiResponse</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content" class="namespace">
|
||||
<h1>Namespace RetailCrm\Response</h1>
|
||||
|
||||
|
||||
|
||||
<h2>Classes summary</h2>
|
||||
<table class="summary table table-bordered table-striped" id="classes">
|
||||
<tr>
|
||||
<td class="name"><a href="class-RetailCrm.Response.ApiResponse.html">ApiResponse</a></td>
|
||||
<td>Response from retailCRM API
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,136 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Namespace RetailCrm | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li class="active">
|
||||
<span>Namespace</span> </li>
|
||||
<li>
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.ApiClient.html">ApiClient</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content" class="namespace">
|
||||
<h1>Namespace RetailCrm</h1>
|
||||
|
||||
<h2>Namespaces summary</h2>
|
||||
<table class="summary table table-bordered table-striped" id="namespaces">
|
||||
<tr>
|
||||
<td class="name"><a href="namespace-RetailCrm.Exception.html">RetailCrm\Exception</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name"><a href="namespace-RetailCrm.Http.html">RetailCrm\Http</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name"><a href="namespace-RetailCrm.Response.html">RetailCrm\Response</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<h2>Classes summary</h2>
|
||||
<table class="summary table table-bordered table-striped" id="classes">
|
||||
<tr>
|
||||
<td class="name"><a href="class-RetailCrm.ApiClient.html">ApiClient</a></td>
|
||||
<td>retailCRM API client class
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
632
docs/api/resources/bootstrap.min.css
vendored
|
@ -1,632 +0,0 @@
|
|||
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block;}
|
||||
audio,canvas,video{display:inline-block;*display:inline;*zoom:1;}
|
||||
audio:not([controls]){display:none;}
|
||||
html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}
|
||||
a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;}
|
||||
a:hover,a:active{outline:0;}
|
||||
sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline;}
|
||||
sup{top:-0.5em;}
|
||||
sub{bottom:-0.25em;}
|
||||
img{max-width:100%;height:auto;border:0;-ms-interpolation-mode:bicubic;}
|
||||
button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle;}
|
||||
button,input{*overflow:visible;line-height:normal;}
|
||||
button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0;}
|
||||
button,input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button;}
|
||||
input[type="search"]{-webkit-appearance:textfield;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;}
|
||||
input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none;}
|
||||
textarea{overflow:auto;vertical-align:top;}
|
||||
.clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";}
|
||||
.clearfix:after{clear:both;}
|
||||
body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;line-height:18px;color:#333333;background-color:#ffffff;}
|
||||
a{color:#0088cc;text-decoration:none;}
|
||||
a:hover{color:#005580;text-decoration:underline;}
|
||||
.row{margin-left:-20px;*zoom:1;}.row:before,.row:after{display:table;content:"";}
|
||||
.row:after{clear:both;}
|
||||
[class*="span"]{float:left;margin-left:20px;}
|
||||
.span1{width:60px;}
|
||||
.span2{width:140px;}
|
||||
.span3{width:220px;}
|
||||
.span4{width:300px;}
|
||||
.span5{width:380px;}
|
||||
.span6{width:460px;}
|
||||
.span7{width:540px;}
|
||||
.span8{width:620px;}
|
||||
.span9{width:700px;}
|
||||
.span10{width:780px;}
|
||||
.span11{width:860px;}
|
||||
.span12,.container{width:940px;}
|
||||
.offset1{margin-left:100px;}
|
||||
.offset2{margin-left:180px;}
|
||||
.offset3{margin-left:260px;}
|
||||
.offset4{margin-left:340px;}
|
||||
.offset5{margin-left:420px;}
|
||||
.offset6{margin-left:500px;}
|
||||
.offset7{margin-left:580px;}
|
||||
.offset8{margin-left:660px;}
|
||||
.offset9{margin-left:740px;}
|
||||
.offset10{margin-left:820px;}
|
||||
.offset11{margin-left:900px;}
|
||||
.row-fluid{width:100%;*zoom:1;}.row-fluid:before,.row-fluid:after{display:table;content:"";}
|
||||
.row-fluid:after{clear:both;}
|
||||
.row-fluid>[class*="span"]{float:left;margin-left:2.127659574%;}
|
||||
.row-fluid>[class*="span"]:first-child{margin-left:0;}
|
||||
.row-fluid>.span1{width:6.382978723%;}
|
||||
.row-fluid>.span2{width:14.89361702%;}
|
||||
.row-fluid>.span3{width:23.404255317%;}
|
||||
.row-fluid>.span4{width:31.914893614%;}
|
||||
.row-fluid>.span5{width:40.425531911%;}
|
||||
.row-fluid>.span6{width:48.93617020799999%;}
|
||||
.row-fluid>.span7{width:57.446808505%;}
|
||||
.row-fluid>.span8{width:65.95744680199999%;}
|
||||
.row-fluid>.span9{width:74.468085099%;}
|
||||
.row-fluid>.span10{width:82.97872339599999%;}
|
||||
.row-fluid>.span11{width:91.489361693%;}
|
||||
.row-fluid>.span12{width:99.99999998999999%;}
|
||||
.container{width:940px;margin-left:auto;margin-right:auto;*zoom:1;}.container:before,.container:after{display:table;content:"";}
|
||||
.container:after{clear:both;}
|
||||
.container-fluid{padding-left:20px;padding-right:20px;*zoom:1;}.container-fluid:before,.container-fluid:after{display:table;content:"";}
|
||||
.container-fluid:after{clear:both;}
|
||||
p{margin:0 0 9px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;line-height:18px;}p small{font-size:11px;color:#999999;}
|
||||
.lead{margin-bottom:18px;font-size:20px;font-weight:200;line-height:27px;}
|
||||
h1,h2,h3,h4,h5,h6{margin:0;font-weight:bold;color:#333333;text-rendering:optimizelegibility;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;color:#999999;}
|
||||
h1{font-size:30px;line-height:36px;}h1 small{font-size:18px;}
|
||||
h2{font-size:24px;line-height:36px;}h2 small{font-size:18px;}
|
||||
h3{line-height:27px;font-size:18px;}h3 small{font-size:14px;}
|
||||
h4,h5,h6{line-height:18px;}
|
||||
h4{font-size:14px;}h4 small{font-size:12px;}
|
||||
h5{font-size:12px;}
|
||||
h6{font-size:11px;color:#999999;text-transform:uppercase;}
|
||||
.page-header{padding-bottom:17px;margin:18px 0;border-bottom:1px solid #eeeeee;}
|
||||
.page-header h1{line-height:1;}
|
||||
ul,ol{padding:0;margin:0 0 9px 25px;}
|
||||
ul ul,ul ol,ol ol,ol ul{margin-bottom:0;}
|
||||
ul{list-style:disc;}
|
||||
ol{list-style:decimal;}
|
||||
li{line-height:18px;}
|
||||
ul.unstyled,ol.unstyled{margin-left:0;list-style:none;}
|
||||
dl{margin-bottom:18px;}
|
||||
dt,dd{line-height:18px;}
|
||||
dt{font-weight:bold;}
|
||||
dd{margin-left:9px;}
|
||||
hr{margin:18px 0;border:0;border-top:1px solid #eeeeee;border-bottom:1px solid #ffffff;}
|
||||
strong{font-weight:bold;}
|
||||
em{font-style:italic;}
|
||||
.muted{color:#999999;}
|
||||
abbr{font-size:90%;text-transform:uppercase;border-bottom:1px dotted #ddd;cursor:help;}
|
||||
blockquote{padding:0 0 0 15px;margin:0 0 18px;border-left:5px solid #eeeeee;}blockquote p{margin-bottom:0;font-size:16px;font-weight:300;line-height:22.5px;}
|
||||
blockquote small{display:block;line-height:18px;color:#999999;}blockquote small:before{content:'\2014 \00A0';}
|
||||
blockquote.pull-right{float:right;padding-left:0;padding-right:15px;border-left:0;border-right:5px solid #eeeeee;}blockquote.pull-right p,blockquote.pull-right small{text-align:right;}
|
||||
q:before,q:after,blockquote:before,blockquote:after{content:"";}
|
||||
address{display:block;margin-bottom:18px;line-height:18px;font-style:normal;}
|
||||
small{font-size:100%;}
|
||||
cite{font-style:normal;}
|
||||
code,pre{padding:0 3px 2px;font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;color:#333333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
|
||||
code{padding:3px 4px;color:#d14;background-color:#f7f7f9;border:1px solid #e1e1e8;}
|
||||
pre{display:block;padding:8.5px;margin:0 0 9px;font-size:12px;line-height:18px;background-color:#f5f5f5;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.15);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;white-space:pre;white-space:pre-wrap;word-break:break-all;word-wrap:break-word;}pre.prettyprint{margin-bottom:18px;}
|
||||
pre code{padding:0;color:inherit;background-color:transparent;border:0;}
|
||||
.pre-scrollable{max-height:340px;overflow-y:scroll;}
|
||||
form{margin:0 0 18px;}
|
||||
fieldset{padding:0;margin:0;border:0;}
|
||||
legend{display:block;width:100%;padding:0;margin-bottom:27px;font-size:19.5px;line-height:36px;color:#333333;border:0;border-bottom:1px solid #eee;}legend small{font-size:13.5px;color:#999999;}
|
||||
label,input,button,select,textarea{font-size:13px;font-weight:normal;line-height:18px;}
|
||||
input,button,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;}
|
||||
label{display:block;margin-bottom:5px;color:#333333;}
|
||||
input,textarea,select,.uneditable-input{display:inline-block;width:210px;height:18px;padding:4px;margin-bottom:9px;font-size:13px;line-height:18px;color:#555555;border:1px solid #ccc;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
|
||||
.uneditable-textarea{width:auto;height:auto;}
|
||||
label input,label textarea,label select{display:block;}
|
||||
input[type="image"],input[type="checkbox"],input[type="radio"]{width:auto;height:auto;padding:0;margin:3px 0;*margin-top:0;line-height:normal;cursor:pointer;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;border:0 \9;}
|
||||
input[type="image"]{border:0;}
|
||||
input[type="file"]{width:auto;padding:initial;line-height:initial;border:initial;background-color:#ffffff;background-color:initial;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}
|
||||
input[type="button"],input[type="reset"],input[type="submit"]{width:auto;height:auto;}
|
||||
select,input[type="file"]{height:28px;*margin-top:4px;line-height:28px;}
|
||||
input[type="file"]{line-height:18px \9;}
|
||||
select{width:220px;background-color:#ffffff;}
|
||||
select[multiple],select[size]{height:auto;}
|
||||
input[type="image"]{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}
|
||||
textarea{height:auto;}
|
||||
input[type="hidden"]{display:none;}
|
||||
.radio,.checkbox{padding-left:18px;}
|
||||
.radio input[type="radio"],.checkbox input[type="checkbox"]{float:left;margin-left:-18px;}
|
||||
.controls>.radio:first-child,.controls>.checkbox:first-child{padding-top:5px;}
|
||||
.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle;}
|
||||
.radio.inline+.radio.inline,.checkbox.inline+.checkbox.inline{margin-left:10px;}
|
||||
input,textarea{-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-webkit-transition:border linear 0.2s,box-shadow linear 0.2s;-moz-transition:border linear 0.2s,box-shadow linear 0.2s;-ms-transition:border linear 0.2s,box-shadow linear 0.2s;-o-transition:border linear 0.2s,box-shadow linear 0.2s;transition:border linear 0.2s,box-shadow linear 0.2s;}
|
||||
input:focus,textarea:focus{border-color:rgba(82, 168, 236, 0.8);-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 8px rgba(82, 168, 236, 0.6);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 8px rgba(82, 168, 236, 0.6);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 8px rgba(82, 168, 236, 0.6);outline:0;outline:thin dotted \9;}
|
||||
input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus,select:focus{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;}
|
||||
.input-mini{width:60px;}
|
||||
.input-small{width:90px;}
|
||||
.input-medium{width:150px;}
|
||||
.input-large{width:210px;}
|
||||
.input-xlarge{width:270px;}
|
||||
.input-xxlarge{width:530px;}
|
||||
input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{float:none;margin-left:0;}
|
||||
input.span1,textarea.span1,.uneditable-input.span1{width:50px;}
|
||||
input.span2,textarea.span2,.uneditable-input.span2{width:130px;}
|
||||
input.span3,textarea.span3,.uneditable-input.span3{width:210px;}
|
||||
input.span4,textarea.span4,.uneditable-input.span4{width:290px;}
|
||||
input.span5,textarea.span5,.uneditable-input.span5{width:370px;}
|
||||
input.span6,textarea.span6,.uneditable-input.span6{width:450px;}
|
||||
input.span7,textarea.span7,.uneditable-input.span7{width:530px;}
|
||||
input.span8,textarea.span8,.uneditable-input.span8{width:610px;}
|
||||
input.span9,textarea.span9,.uneditable-input.span9{width:690px;}
|
||||
input.span10,textarea.span10,.uneditable-input.span10{width:770px;}
|
||||
input.span11,textarea.span11,.uneditable-input.span11{width:850px;}
|
||||
input.span12,textarea.span12,.uneditable-input.span12{width:930px;}
|
||||
input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{background-color:#f5f5f5;border-color:#ddd;cursor:not-allowed;}
|
||||
.control-group.warning>label,.control-group.warning .help-block,.control-group.warning .help-inline{color:#c09853;}
|
||||
.control-group.warning input,.control-group.warning select,.control-group.warning textarea{color:#c09853;border-color:#c09853;}.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus{border-color:#a47e3c;-webkit-box-shadow:0 0 6px #dbc59e;-moz-box-shadow:0 0 6px #dbc59e;box-shadow:0 0 6px #dbc59e;}
|
||||
.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on{color:#c09853;background-color:#fcf8e3;border-color:#c09853;}
|
||||
.control-group.error>label,.control-group.error .help-block,.control-group.error .help-inline{color:#b94a48;}
|
||||
.control-group.error input,.control-group.error select,.control-group.error textarea{color:#b94a48;border-color:#b94a48;}.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus{border-color:#953b39;-webkit-box-shadow:0 0 6px #d59392;-moz-box-shadow:0 0 6px #d59392;box-shadow:0 0 6px #d59392;}
|
||||
.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on{color:#b94a48;background-color:#f2dede;border-color:#b94a48;}
|
||||
.control-group.success>label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847;}
|
||||
.control-group.success input,.control-group.success select,.control-group.success textarea{color:#468847;border-color:#468847;}.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus{border-color:#356635;-webkit-box-shadow:0 0 6px #7aba7b;-moz-box-shadow:0 0 6px #7aba7b;box-shadow:0 0 6px #7aba7b;}
|
||||
.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#dff0d8;border-color:#468847;}
|
||||
input:focus:required:invalid,textarea:focus:required:invalid,select:focus:required:invalid{color:#b94a48;border-color:#ee5f5b;}input:focus:required:invalid:focus,textarea:focus:required:invalid:focus,select:focus:required:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7;}
|
||||
.form-actions{padding:17px 20px 18px;margin-top:18px;margin-bottom:18px;background-color:#f5f5f5;border-top:1px solid #ddd;}
|
||||
.uneditable-input{display:block;background-color:#ffffff;border-color:#eee;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);cursor:not-allowed;}
|
||||
:-moz-placeholder{color:#999999;}
|
||||
::-webkit-input-placeholder{color:#999999;}
|
||||
.help-block{display:block;margin-top:5px;margin-bottom:0;color:#999999;}
|
||||
.help-inline{display:inline-block;*display:inline;*zoom:1;margin-bottom:9px;vertical-align:middle;padding-left:5px;}
|
||||
.input-prepend,.input-append{margin-bottom:5px;*zoom:1;}.input-prepend:before,.input-append:before,.input-prepend:after,.input-append:after{display:table;content:"";}
|
||||
.input-prepend:after,.input-append:after{clear:both;}
|
||||
.input-prepend input,.input-append input,.input-prepend .uneditable-input,.input-append .uneditable-input{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;}.input-prepend input:focus,.input-append input:focus,.input-prepend .uneditable-input:focus,.input-append .uneditable-input:focus{position:relative;z-index:2;}
|
||||
.input-prepend .uneditable-input,.input-append .uneditable-input{border-left-color:#ccc;}
|
||||
.input-prepend .add-on,.input-append .add-on{float:left;display:block;width:auto;min-width:16px;height:18px;margin-right:-1px;padding:4px 5px;font-weight:normal;line-height:18px;color:#999999;text-align:center;text-shadow:0 1px 0 #ffffff;background-color:#f5f5f5;border:1px solid #ccc;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;}
|
||||
.input-prepend .active,.input-append .active{background-color:#a9dba9;border-color:#46a546;}
|
||||
.input-prepend .add-on{*margin-top:1px;}
|
||||
.input-append input,.input-append .uneditable-input{float:left;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;}
|
||||
.input-append .uneditable-input{border-left-color:#eee;border-right-color:#ccc;}
|
||||
.input-append .add-on{margin-right:0;margin-left:-1px;-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;}
|
||||
.input-append input:first-child{*margin-left:-160px;}.input-append input:first-child+.add-on{*margin-left:-21px;}
|
||||
.search-query{padding-left:14px;padding-right:14px;margin-bottom:0;-webkit-border-radius:14px;-moz-border-radius:14px;border-radius:14px;}
|
||||
.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input{display:inline-block;margin-bottom:0;}
|
||||
.form-search .hide,.form-inline .hide,.form-horizontal .hide{display:none;}
|
||||
.form-search label,.form-inline label,.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend{display:inline-block;}
|
||||
.form-search .input-append .add-on,.form-inline .input-prepend .add-on,.form-search .input-append .add-on,.form-inline .input-prepend .add-on{vertical-align:middle;}
|
||||
.form-search .radio,.form-inline .radio,.form-search .checkbox,.form-inline .checkbox{margin-bottom:0;vertical-align:middle;}
|
||||
.control-group{margin-bottom:9px;}
|
||||
legend+.control-group{margin-top:18px;-webkit-margin-top-collapse:separate;}
|
||||
.form-horizontal .control-group{margin-bottom:18px;*zoom:1;}.form-horizontal .control-group:before,.form-horizontal .control-group:after{display:table;content:"";}
|
||||
.form-horizontal .control-group:after{clear:both;}
|
||||
.form-horizontal .control-label{float:left;width:140px;padding-top:5px;text-align:right;}
|
||||
.form-horizontal .controls{margin-left:160px;}
|
||||
.form-horizontal .form-actions{padding-left:160px;}
|
||||
table{max-width:100%;border-collapse:collapse;border-spacing:0;}
|
||||
.table{width:100%;margin-bottom:18px;}.table th,.table td{padding:8px;line-height:18px;text-align:left;vertical-align:top;border-top:1px solid #ddd;}
|
||||
.table th{font-weight:bold;}
|
||||
.table thead th{vertical-align:bottom;}
|
||||
.table thead:first-child tr th,.table thead:first-child tr td{border-top:0;}
|
||||
.table tbody+tbody{border-top:2px solid #ddd;}
|
||||
.table-condensed th,.table-condensed td{padding:4px 5px;}
|
||||
.table-bordered{border:1px solid #ddd;border-collapse:separate;*border-collapse:collapsed;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.table-bordered th+th,.table-bordered td+td,.table-bordered th+td,.table-bordered td+th{border-left:1px solid #ddd;}
|
||||
.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0;}
|
||||
.table-bordered thead:first-child tr:first-child th:first-child,.table-bordered tbody:first-child tr:first-child td:first-child{-webkit-border-radius:4px 0 0 0;-moz-border-radius:4px 0 0 0;border-radius:4px 0 0 0;}
|
||||
.table-bordered thead:first-child tr:first-child th:last-child,.table-bordered tbody:first-child tr:first-child td:last-child{-webkit-border-radius:0 4px 0 0;-moz-border-radius:0 4px 0 0;border-radius:0 4px 0 0;}
|
||||
.table-bordered thead:last-child tr:last-child th:first-child,.table-bordered tbody:last-child tr:last-child td:first-child{-webkit-border-radius:0 0 0 4px;-moz-border-radius:0 0 0 4px;border-radius:0 0 0 4px;}
|
||||
.table-bordered thead:last-child tr:last-child th:last-child,.table-bordered tbody:last-child tr:last-child td:last-child{-webkit-border-radius:0 0 4px 0;-moz-border-radius:0 0 4px 0;border-radius:0 0 4px 0;}
|
||||
.table-striped tbody tr:nth-child(odd) td,.table-striped tbody tr:nth-child(odd) th{background-color:#f9f9f9;}
|
||||
.table tbody tr:hover td,.table tbody tr:hover th{background-color:#f5f5f5;}
|
||||
table .span1{float:none;width:44px;margin-left:0;}
|
||||
table .span2{float:none;width:124px;margin-left:0;}
|
||||
table .span3{float:none;width:204px;margin-left:0;}
|
||||
table .span4{float:none;width:284px;margin-left:0;}
|
||||
table .span5{float:none;width:364px;margin-left:0;}
|
||||
table .span6{float:none;width:444px;margin-left:0;}
|
||||
table .span7{float:none;width:524px;margin-left:0;}
|
||||
table .span8{float:none;width:604px;margin-left:0;}
|
||||
table .span9{float:none;width:684px;margin-left:0;}
|
||||
table .span10{float:none;width:764px;margin-left:0;}
|
||||
table .span11{float:none;width:844px;margin-left:0;}
|
||||
table .span12{float:none;width:924px;margin-left:0;}
|
||||
[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat;*margin-right:.3em;}[class^="icon-"]:last-child,[class*=" icon-"]:last-child{*margin-left:0;}
|
||||
.icon-white{background-image:url("../img/glyphicons-halflings-white.png");}
|
||||
.icon-glass{background-position:0 0;}
|
||||
.icon-music{background-position:-24px 0;}
|
||||
.icon-search{background-position:-48px 0;}
|
||||
.icon-envelope{background-position:-72px 0;}
|
||||
.icon-heart{background-position:-96px 0;}
|
||||
.icon-star{background-position:-120px 0;}
|
||||
.icon-star-empty{background-position:-144px 0;}
|
||||
.icon-user{background-position:-168px 0;}
|
||||
.icon-film{background-position:-192px 0;}
|
||||
.icon-th-large{background-position:-216px 0;}
|
||||
.icon-th{background-position:-240px 0;}
|
||||
.icon-th-list{background-position:-264px 0;}
|
||||
.icon-ok{background-position:-288px 0;}
|
||||
.icon-remove{background-position:-312px 0;}
|
||||
.icon-zoom-in{background-position:-336px 0;}
|
||||
.icon-zoom-out{background-position:-360px 0;}
|
||||
.icon-off{background-position:-384px 0;}
|
||||
.icon-signal{background-position:-408px 0;}
|
||||
.icon-cog{background-position:-432px 0;}
|
||||
.icon-trash{background-position:-456px 0;}
|
||||
.icon-home{background-position:0 -24px;}
|
||||
.icon-file{background-position:-24px -24px;}
|
||||
.icon-time{background-position:-48px -24px;}
|
||||
.icon-road{background-position:-72px -24px;}
|
||||
.icon-download-alt{background-position:-96px -24px;}
|
||||
.icon-download{background-position:-120px -24px;}
|
||||
.icon-upload{background-position:-144px -24px;}
|
||||
.icon-inbox{background-position:-168px -24px;}
|
||||
.icon-play-circle{background-position:-192px -24px;}
|
||||
.icon-repeat{background-position:-216px -24px;}
|
||||
.icon-refresh{background-position:-240px -24px;}
|
||||
.icon-list-alt{background-position:-264px -24px;}
|
||||
.icon-lock{background-position:-287px -24px;}
|
||||
.icon-flag{background-position:-312px -24px;}
|
||||
.icon-headphones{background-position:-336px -24px;}
|
||||
.icon-volume-off{background-position:-360px -24px;}
|
||||
.icon-volume-down{background-position:-384px -24px;}
|
||||
.icon-volume-up{background-position:-408px -24px;}
|
||||
.icon-qrcode{background-position:-432px -24px;}
|
||||
.icon-barcode{background-position:-456px -24px;}
|
||||
.icon-tag{background-position:0 -48px;}
|
||||
.icon-tags{background-position:-25px -48px;}
|
||||
.icon-book{background-position:-48px -48px;}
|
||||
.icon-bookmark{background-position:-72px -48px;}
|
||||
.icon-print{background-position:-96px -48px;}
|
||||
.icon-camera{background-position:-120px -48px;}
|
||||
.icon-font{background-position:-144px -48px;}
|
||||
.icon-bold{background-position:-167px -48px;}
|
||||
.icon-italic{background-position:-192px -48px;}
|
||||
.icon-text-height{background-position:-216px -48px;}
|
||||
.icon-text-width{background-position:-240px -48px;}
|
||||
.icon-align-left{background-position:-264px -48px;}
|
||||
.icon-align-center{background-position:-288px -48px;}
|
||||
.icon-align-right{background-position:-312px -48px;}
|
||||
.icon-align-justify{background-position:-336px -48px;}
|
||||
.icon-list{background-position:-360px -48px;}
|
||||
.icon-indent-left{background-position:-384px -48px;}
|
||||
.icon-indent-right{background-position:-408px -48px;}
|
||||
.icon-facetime-video{background-position:-432px -48px;}
|
||||
.icon-picture{background-position:-456px -48px;}
|
||||
.icon-pencil{background-position:0 -72px;}
|
||||
.icon-map-marker{background-position:-24px -72px;}
|
||||
.icon-adjust{background-position:-48px -72px;}
|
||||
.icon-tint{background-position:-72px -72px;}
|
||||
.icon-edit{background-position:-96px -72px;}
|
||||
.icon-share{background-position:-120px -72px;}
|
||||
.icon-check{background-position:-144px -72px;}
|
||||
.icon-move{background-position:-168px -72px;}
|
||||
.icon-step-backward{background-position:-192px -72px;}
|
||||
.icon-fast-backward{background-position:-216px -72px;}
|
||||
.icon-backward{background-position:-240px -72px;}
|
||||
.icon-play{background-position:-264px -72px;}
|
||||
.icon-pause{background-position:-288px -72px;}
|
||||
.icon-stop{background-position:-312px -72px;}
|
||||
.icon-forward{background-position:-336px -72px;}
|
||||
.icon-fast-forward{background-position:-360px -72px;}
|
||||
.icon-step-forward{background-position:-384px -72px;}
|
||||
.icon-eject{background-position:-408px -72px;}
|
||||
.icon-chevron-left{background-position:-432px -72px;}
|
||||
.icon-chevron-right{background-position:-456px -72px;}
|
||||
.icon-plus-sign{background-position:0 -96px;}
|
||||
.icon-minus-sign{background-position:-24px -96px;}
|
||||
.icon-remove-sign{background-position:-48px -96px;}
|
||||
.icon-ok-sign{background-position:-72px -96px;}
|
||||
.icon-question-sign{background-position:-96px -96px;}
|
||||
.icon-info-sign{background-position:-120px -96px;}
|
||||
.icon-screenshot{background-position:-144px -96px;}
|
||||
.icon-remove-circle{background-position:-168px -96px;}
|
||||
.icon-ok-circle{background-position:-192px -96px;}
|
||||
.icon-ban-circle{background-position:-216px -96px;}
|
||||
.icon-arrow-left{background-position:-240px -96px;}
|
||||
.icon-arrow-right{background-position:-264px -96px;}
|
||||
.icon-arrow-up{background-position:-289px -96px;}
|
||||
.icon-arrow-down{background-position:-312px -96px;}
|
||||
.icon-share-alt{background-position:-336px -96px;}
|
||||
.icon-resize-full{background-position:-360px -96px;}
|
||||
.icon-resize-small{background-position:-384px -96px;}
|
||||
.icon-plus{background-position:-408px -96px;}
|
||||
.icon-minus{background-position:-433px -96px;}
|
||||
.icon-asterisk{background-position:-456px -96px;}
|
||||
.icon-exclamation-sign{background-position:0 -120px;}
|
||||
.icon-gift{background-position:-24px -120px;}
|
||||
.icon-leaf{background-position:-48px -120px;}
|
||||
.icon-fire{background-position:-72px -120px;}
|
||||
.icon-eye-open{background-position:-96px -120px;}
|
||||
.icon-eye-close{background-position:-120px -120px;}
|
||||
.icon-warning-sign{background-position:-144px -120px;}
|
||||
.icon-plane{background-position:-168px -120px;}
|
||||
.icon-calendar{background-position:-192px -120px;}
|
||||
.icon-random{background-position:-216px -120px;}
|
||||
.icon-comment{background-position:-240px -120px;}
|
||||
.icon-magnet{background-position:-264px -120px;}
|
||||
.icon-chevron-up{background-position:-288px -120px;}
|
||||
.icon-chevron-down{background-position:-313px -119px;}
|
||||
.icon-retweet{background-position:-336px -120px;}
|
||||
.icon-shopping-cart{background-position:-360px -120px;}
|
||||
.icon-folder-close{background-position:-384px -120px;}
|
||||
.icon-folder-open{background-position:-408px -120px;}
|
||||
.icon-resize-vertical{background-position:-432px -119px;}
|
||||
.icon-resize-horizontal{background-position:-456px -118px;}
|
||||
.dropdown{position:relative;}
|
||||
.dropdown-toggle{*margin-bottom:-3px;}
|
||||
.dropdown-toggle:active,.open .dropdown-toggle{outline:0;}
|
||||
.caret{display:inline-block;width:0;height:0;text-indent:-99999px;*text-indent:0;vertical-align:top;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #000000;opacity:0.3;filter:alpha(opacity=30);content:"\2193";}
|
||||
.dropdown .caret{margin-top:8px;margin-left:2px;}
|
||||
.dropdown:hover .caret,.open.dropdown .caret{opacity:1;filter:alpha(opacity=100);}
|
||||
.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;float:left;display:none;min-width:160px;_width:160px;padding:4px 0;margin:0;list-style:none;background-color:#ffffff;border-color:#ccc;border-color:rgba(0, 0, 0, 0.2);border-style:solid;border-width:1px;-webkit-border-radius:0 0 5px 5px;-moz-border-radius:0 0 5px 5px;border-radius:0 0 5px 5px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;*border-right-width:2px;*border-bottom-width:2px;}.dropdown-menu.bottom-up{top:auto;bottom:100%;margin-bottom:2px;}
|
||||
.dropdown-menu .divider{height:1px;margin:5px 1px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #ffffff;*width:100%;*margin:-5px 0 5px;}
|
||||
.dropdown-menu a{display:block;padding:3px 15px;clear:both;font-weight:normal;line-height:18px;color:#555555;white-space:nowrap;}
|
||||
.dropdown-menu li>a:hover,.dropdown-menu .active>a,.dropdown-menu .active>a:hover{color:#ffffff;text-decoration:none;background-color:#0088cc;}
|
||||
.dropdown.open{*z-index:1000;}.dropdown.open .dropdown-toggle{color:#ffffff;background:#ccc;background:rgba(0, 0, 0, 0.3);}
|
||||
.dropdown.open .dropdown-menu{display:block;}
|
||||
.typeahead{margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
|
||||
.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #eee;border:1px solid rgba(0, 0, 0, 0.05);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05);}.well blockquote{border-color:#ddd;border-color:rgba(0, 0, 0, 0.15);}
|
||||
.fade{-webkit-transition:opacity 0.15s linear;-moz-transition:opacity 0.15s linear;-ms-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear;opacity:0;}.fade.in{opacity:1;}
|
||||
.collapse{-webkit-transition:height 0.35s ease;-moz-transition:height 0.35s ease;-ms-transition:height 0.35s ease;-o-transition:height 0.35s ease;transition:height 0.35s ease;position:relative;overflow:hidden;height:0;}.collapse.in{height:auto;}
|
||||
.close{float:right;font-size:20px;font-weight:bold;line-height:18px;color:#000000;text-shadow:0 1px 0 #ffffff;opacity:0.2;filter:alpha(opacity=20);}.close:hover{color:#000000;text-decoration:none;opacity:0.4;filter:alpha(opacity=40);cursor:pointer;}
|
||||
.btn{display:inline-block;padding:4px 10px 4px;margin-bottom:0;font-size:13px;line-height:18px;color:#333333;text-align:center;text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);vertical-align:middle;background-color:#f5f5f5;background-image:-moz-linear-gradient(top, #ffffff, #e6e6e6);background-image:-ms-linear-gradient(top, #ffffff, #e6e6e6);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));background-image:-webkit-linear-gradient(top, #ffffff, #e6e6e6);background-image:-o-linear-gradient(top, #ffffff, #e6e6e6);background-image:linear-gradient(top, #ffffff, #e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);border:1px solid #ccc;border-bottom-color:#bbb;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);cursor:pointer;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);*margin-left:.3em;}.btn:hover,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{background-color:#e6e6e6;}
|
||||
.btn:active,.btn.active{background-color:#cccccc \9;}
|
||||
.btn:first-child{*margin-left:0;}
|
||||
.btn:hover{color:#333333;text-decoration:none;background-color:#e6e6e6;background-position:0 -15px;-webkit-transition:background-position 0.1s linear;-moz-transition:background-position 0.1s linear;-ms-transition:background-position 0.1s linear;-o-transition:background-position 0.1s linear;transition:background-position 0.1s linear;}
|
||||
.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;}
|
||||
.btn.active,.btn:active{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);background-color:#e6e6e6;background-color:#d9d9d9 \9;outline:0;}
|
||||
.btn.disabled,.btn[disabled]{cursor:default;background-image:none;background-color:#e6e6e6;opacity:0.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;}
|
||||
.btn-large{padding:9px 14px;font-size:15px;line-height:normal;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;}
|
||||
.btn-large [class^="icon-"]{margin-top:1px;}
|
||||
.btn-small{padding:5px 9px;font-size:11px;line-height:16px;}
|
||||
.btn-small [class^="icon-"]{margin-top:-1px;}
|
||||
.btn-mini{padding:2px 6px;font-size:11px;line-height:14px;}
|
||||
.btn-primary,.btn-primary:hover,.btn-warning,.btn-warning:hover,.btn-danger,.btn-danger:hover,.btn-success,.btn-success:hover,.btn-info,.btn-info:hover,.btn-inverse,.btn-inverse:hover{text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);color:#ffffff;}
|
||||
.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-dark.active{color:rgba(255, 255, 255, 0.75);}
|
||||
.btn-primary{background-color:#006dcc;background-image:-moz-linear-gradient(top, #0088cc, #0044cc);background-image:-ms-linear-gradient(top, #0088cc, #0044cc);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));background-image:-webkit-linear-gradient(top, #0088cc, #0044cc);background-image:-o-linear-gradient(top, #0088cc, #0044cc);background-image:linear-gradient(top, #0088cc, #0044cc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);border-color:#0044cc #0044cc #002a80;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-primary:hover,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{background-color:#0044cc;}
|
||||
.btn-primary:active,.btn-primary.active{background-color:#003399 \9;}
|
||||
.btn-warning{background-color:#faa732;background-image:-moz-linear-gradient(top, #fbb450, #f89406);background-image:-ms-linear-gradient(top, #fbb450, #f89406);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));background-image:-webkit-linear-gradient(top, #fbb450, #f89406);background-image:-o-linear-gradient(top, #fbb450, #f89406);background-image:linear-gradient(top, #fbb450, #f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0);border-color:#f89406 #f89406 #ad6704;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-warning:hover,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{background-color:#f89406;}
|
||||
.btn-warning:active,.btn-warning.active{background-color:#c67605 \9;}
|
||||
.btn-danger{background-color:#da4f49;background-image:-moz-linear-gradient(top, #ee5f5b, #bd362f);background-image:-ms-linear-gradient(top, #ee5f5b, #bd362f);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));background-image:-webkit-linear-gradient(top, #ee5f5b, #bd362f);background-image:-o-linear-gradient(top, #ee5f5b, #bd362f);background-image:linear-gradient(top, #ee5f5b, #bd362f);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#bd362f', GradientType=0);border-color:#bd362f #bd362f #802420;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-danger:hover,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{background-color:#bd362f;}
|
||||
.btn-danger:active,.btn-danger.active{background-color:#942a25 \9;}
|
||||
.btn-success{background-color:#5bb75b;background-image:-moz-linear-gradient(top, #62c462, #51a351);background-image:-ms-linear-gradient(top, #62c462, #51a351);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));background-image:-webkit-linear-gradient(top, #62c462, #51a351);background-image:-o-linear-gradient(top, #62c462, #51a351);background-image:linear-gradient(top, #62c462, #51a351);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#51a351', GradientType=0);border-color:#51a351 #51a351 #387038;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-success:hover,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled]{background-color:#51a351;}
|
||||
.btn-success:active,.btn-success.active{background-color:#408140 \9;}
|
||||
.btn-info{background-color:#49afcd;background-image:-moz-linear-gradient(top, #5bc0de, #2f96b4);background-image:-ms-linear-gradient(top, #5bc0de, #2f96b4);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4));background-image:-webkit-linear-gradient(top, #5bc0de, #2f96b4);background-image:-o-linear-gradient(top, #5bc0de, #2f96b4);background-image:linear-gradient(top, #5bc0de, #2f96b4);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#2f96b4', GradientType=0);border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-info:hover,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled]{background-color:#2f96b4;}
|
||||
.btn-info:active,.btn-info.active{background-color:#24748c \9;}
|
||||
.btn-inverse{background-color:#393939;background-image:-moz-linear-gradient(top, #454545, #262626);background-image:-ms-linear-gradient(top, #454545, #262626);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#454545), to(#262626));background-image:-webkit-linear-gradient(top, #454545, #262626);background-image:-o-linear-gradient(top, #454545, #262626);background-image:linear-gradient(top, #454545, #262626);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#454545', endColorstr='#262626', GradientType=0);border-color:#262626 #262626 #000000;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);}.btn-inverse:hover,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled]{background-color:#262626;}
|
||||
.btn-inverse:active,.btn-inverse.active{background-color:#0c0c0c \9;}
|
||||
button.btn,input[type="submit"].btn{*padding-top:2px;*padding-bottom:2px;}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0;}
|
||||
button.btn.large,input[type="submit"].btn.large{*padding-top:7px;*padding-bottom:7px;}
|
||||
button.btn.small,input[type="submit"].btn.small{*padding-top:3px;*padding-bottom:3px;}
|
||||
.btn-group{position:relative;*zoom:1;*margin-left:.3em;}.btn-group:before,.btn-group:after{display:table;content:"";}
|
||||
.btn-group:after{clear:both;}
|
||||
.btn-group:first-child{*margin-left:0;}
|
||||
.btn-group+.btn-group{margin-left:5px;}
|
||||
.btn-toolbar{margin-top:9px;margin-bottom:9px;}.btn-toolbar .btn-group{display:inline-block;*display:inline;*zoom:1;}
|
||||
.btn-group .btn{position:relative;float:left;margin-left:-1px;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}
|
||||
.btn-group .btn:first-child{margin-left:0;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;}
|
||||
.btn-group .btn:last-child,.btn-group .dropdown-toggle{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;}
|
||||
.btn-group .btn.large:first-child{margin-left:0;-webkit-border-top-left-radius:6px;-moz-border-radius-topleft:6px;border-top-left-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomleft:6px;border-bottom-left-radius:6px;}
|
||||
.btn-group .btn.large:last-child,.btn-group .large.dropdown-toggle{-webkit-border-top-right-radius:6px;-moz-border-radius-topright:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;-moz-border-radius-bottomright:6px;border-bottom-right-radius:6px;}
|
||||
.btn-group .btn:hover,.btn-group .btn:focus,.btn-group .btn:active,.btn-group .btn.active{z-index:2;}
|
||||
.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0;}
|
||||
.btn-group .dropdown-toggle{padding-left:8px;padding-right:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255, 255, 255, 0.125),inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 1px 0 0 rgba(255, 255, 255, 0.125),inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 1px 0 0 rgba(255, 255, 255, 0.125),inset 0 1px 0 rgba(255, 255, 255, 0.2),0 1px 2px rgba(0, 0, 0, 0.05);*padding-top:5px;*padding-bottom:5px;}
|
||||
.btn-group.open{*z-index:1000;}.btn-group.open .dropdown-menu{display:block;margin-top:1px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;}
|
||||
.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 1px 6px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 6px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 6px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);}
|
||||
.btn .caret{margin-top:7px;margin-left:0;}
|
||||
.btn:hover .caret,.open.btn-group .caret{opacity:1;filter:alpha(opacity=100);}
|
||||
.btn-primary .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret{border-top-color:#ffffff;opacity:0.75;filter:alpha(opacity=75);}
|
||||
.btn-small .caret{margin-top:4px;}
|
||||
.alert{padding:8px 35px 8px 14px;margin-bottom:18px;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);background-color:#fcf8e3;border:1px solid #fbeed5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
|
||||
.alert,.alert-heading{color:#c09853;}
|
||||
.alert .close{position:relative;top:-2px;right:-21px;line-height:18px;}
|
||||
.alert-success{background-color:#dff0d8;border-color:#d6e9c6;}
|
||||
.alert-success,.alert-success .alert-heading{color:#468847;}
|
||||
.alert-danger,.alert-error{background-color:#f2dede;border-color:#eed3d7;}
|
||||
.alert-danger,.alert-error,.alert-danger .alert-heading,.alert-error .alert-heading{color:#b94a48;}
|
||||
.alert-info{background-color:#d9edf7;border-color:#bce8f1;}
|
||||
.alert-info,.alert-info .alert-heading{color:#3a87ad;}
|
||||
.alert-block{padding-top:14px;padding-bottom:14px;}
|
||||
.alert-block>p,.alert-block>ul{margin-bottom:0;}
|
||||
.alert-block p+p{margin-top:5px;}
|
||||
.nav{margin-left:0;margin-bottom:18px;list-style:none;}
|
||||
.nav>li>a{display:block;}
|
||||
.nav>li>a:hover{text-decoration:none;background-color:#eeeeee;}
|
||||
.nav .nav-header{display:block;padding:3px 15px;font-size:11px;font-weight:bold;line-height:18px;color:#999999;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);text-transform:uppercase;}
|
||||
.nav li+.nav-header{margin-top:9px;}
|
||||
.nav-list{padding-left:14px;padding-right:14px;margin-bottom:0;}
|
||||
.nav-list>li>a,.nav-list .nav-header{margin-left:-15px;margin-right:-15px;text-shadow:0 1px 0 rgba(255, 255, 255, 0.5);}
|
||||
.nav-list>li>a{padding:3px 15px;}
|
||||
.nav-list .active>a,.nav-list .active>a:hover{color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.2);background-color:#0088cc;}
|
||||
.nav-list [class^="icon-"]{margin-right:2px;}
|
||||
.nav-tabs,.nav-pills{*zoom:1;}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after{display:table;content:"";}
|
||||
.nav-tabs:after,.nav-pills:after{clear:both;}
|
||||
.nav-tabs>li,.nav-pills>li{float:left;}
|
||||
.nav-tabs>li>a,.nav-pills>li>a{padding-right:12px;padding-left:12px;margin-right:2px;line-height:14px;}
|
||||
.nav-tabs{border-bottom:1px solid #ddd;}
|
||||
.nav-tabs>li{margin-bottom:-1px;}
|
||||
.nav-tabs>li>a{padding-top:9px;padding-bottom:9px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;}.nav-tabs>li>a:hover{border-color:#eeeeee #eeeeee #dddddd;}
|
||||
.nav-tabs>.active>a,.nav-tabs>.active>a:hover{color:#555555;background-color:#ffffff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default;}
|
||||
.nav-pills>li>a{padding-top:8px;padding-bottom:8px;margin-top:2px;margin-bottom:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;}
|
||||
.nav-pills .active>a,.nav-pills .active>a:hover{color:#ffffff;background-color:#0088cc;}
|
||||
.nav-stacked>li{float:none;}
|
||||
.nav-stacked>li>a{margin-right:0;}
|
||||
.nav-tabs.nav-stacked{border-bottom:0;}
|
||||
.nav-tabs.nav-stacked>li>a{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}
|
||||
.nav-tabs.nav-stacked>li:first-child>a{-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0;}
|
||||
.nav-tabs.nav-stacked>li:last-child>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;}
|
||||
.nav-tabs.nav-stacked>li>a:hover{border-color:#ddd;z-index:2;}
|
||||
.nav-pills.nav-stacked>li>a{margin-bottom:3px;}
|
||||
.nav-pills.nav-stacked>li:last-child>a{margin-bottom:1px;}
|
||||
.nav-tabs .dropdown-menu,.nav-pills .dropdown-menu{margin-top:1px;border-width:1px;}
|
||||
.nav-pills .dropdown-menu{-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
|
||||
.nav-tabs .dropdown-toggle .caret,.nav-pills .dropdown-toggle .caret{border-top-color:#0088cc;margin-top:6px;}
|
||||
.nav-tabs .dropdown-toggle:hover .caret,.nav-pills .dropdown-toggle:hover .caret{border-top-color:#005580;}
|
||||
.nav-tabs .active .dropdown-toggle .caret,.nav-pills .active .dropdown-toggle .caret{border-top-color:#333333;}
|
||||
.nav>.dropdown.active>a:hover{color:#000000;cursor:pointer;}
|
||||
.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>.open.active>a:hover{color:#ffffff;background-color:#999999;border-color:#999999;}
|
||||
.nav .open .caret,.nav .open.active .caret,.nav .open a:hover .caret{border-top-color:#ffffff;opacity:1;filter:alpha(opacity=100);}
|
||||
.tabs-stacked .open>a:hover{border-color:#999999;}
|
||||
.tabbable{*zoom:1;}.tabbable:before,.tabbable:after{display:table;content:"";}
|
||||
.tabbable:after{clear:both;}
|
||||
.tab-content{overflow:hidden;}
|
||||
.tabs-below .nav-tabs,.tabs-right .nav-tabs,.tabs-left .nav-tabs{border-bottom:0;}
|
||||
.tab-content>.tab-pane,.pill-content>.pill-pane{display:none;}
|
||||
.tab-content>.active,.pill-content>.active{display:block;}
|
||||
.tabs-below .nav-tabs{border-top:1px solid #ddd;}
|
||||
.tabs-below .nav-tabs>li{margin-top:-1px;margin-bottom:0;}
|
||||
.tabs-below .nav-tabs>li>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;}.tabs-below .nav-tabs>li>a:hover{border-bottom-color:transparent;border-top-color:#ddd;}
|
||||
.tabs-below .nav-tabs .active>a,.tabs-below .nav-tabs .active>a:hover{border-color:transparent #ddd #ddd #ddd;}
|
||||
.tabs-left .nav-tabs>li,.tabs-right .nav-tabs>li{float:none;}
|
||||
.tabs-left .nav-tabs>li>a,.tabs-right .nav-tabs>li>a{min-width:74px;margin-right:0;margin-bottom:3px;}
|
||||
.tabs-left .nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd;}
|
||||
.tabs-left .nav-tabs>li>a{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px;}
|
||||
.tabs-left .nav-tabs>li>a:hover{border-color:#eeeeee #dddddd #eeeeee #eeeeee;}
|
||||
.tabs-left .nav-tabs .active>a,.tabs-left .nav-tabs .active>a:hover{border-color:#ddd transparent #ddd #ddd;*border-right-color:#ffffff;}
|
||||
.tabs-right .nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd;}
|
||||
.tabs-right .nav-tabs>li>a{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0;}
|
||||
.tabs-right .nav-tabs>li>a:hover{border-color:#eeeeee #eeeeee #eeeeee #dddddd;}
|
||||
.tabs-right .nav-tabs .active>a,.tabs-right .nav-tabs .active>a:hover{border-color:#ddd #ddd #ddd transparent;*border-left-color:#ffffff;}
|
||||
.navbar{overflow:visible;margin-bottom:18px;}
|
||||
.navbar-inner{padding-left:20px;padding-right:20px;background-color:#2c2c2c;background-image:-moz-linear-gradient(top, #333333, #222222);background-image:-ms-linear-gradient(top, #333333, #222222);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222));background-image:-webkit-linear-gradient(top, #333333, #222222);background-image:-o-linear-gradient(top, #333333, #222222);background-image:linear-gradient(top, #333333, #222222);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);-moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);box-shadow:0 1px 3px rgba(0, 0, 0, 0.25),inset 0 -1px 0 rgba(0, 0, 0, 0.1);}
|
||||
.btn-navbar{display:none;float:right;padding:7px 10px;margin-left:5px;margin-right:5px;background-color:#2c2c2c;background-image:-moz-linear-gradient(top, #333333, #222222);background-image:-ms-linear-gradient(top, #333333, #222222);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#333333), to(#222222));background-image:-webkit-linear-gradient(top, #333333, #222222);background-image:-o-linear-gradient(top, #333333, #222222);background-image:linear-gradient(top, #333333, #222222);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0);border-color:#222222 #222222 #000000;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.1),0 1px 0 rgba(255, 255, 255, 0.075);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.1),0 1px 0 rgba(255, 255, 255, 0.075);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.1),0 1px 0 rgba(255, 255, 255, 0.075);}.btn-navbar:hover,.btn-navbar:active,.btn-navbar.active,.btn-navbar.disabled,.btn-navbar[disabled]{background-color:#222222;}
|
||||
.btn-navbar:active,.btn-navbar.active{background-color:#080808 \9;}
|
||||
.btn-navbar .icon-bar{display:block;width:18px;height:2px;background-color:#f5f5f5;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;-webkit-box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);-moz-box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);box-shadow:0 1px 0 rgba(0, 0, 0, 0.25);}
|
||||
.btn-navbar .icon-bar+.icon-bar{margin-top:3px;}
|
||||
.nav-collapse.collapse{height:auto;}
|
||||
.navbar .brand:hover{text-decoration:none;}
|
||||
.navbar .brand{float:left;display:block;padding:8px 20px 12px;margin-left:-20px;font-size:20px;font-weight:200;line-height:1;color:#ffffff;}
|
||||
.navbar .navbar-text{margin-bottom:0;line-height:40px;color:#999999;}.navbar .navbar-text a:hover{color:#ffffff;background-color:transparent;}
|
||||
.navbar .btn,.navbar .btn-group{margin-top:5px;}
|
||||
.navbar .btn-group .btn{margin-top:0;}
|
||||
.navbar-form{margin-bottom:0;*zoom:1;}.navbar-form:before,.navbar-form:after{display:table;content:"";}
|
||||
.navbar-form:after{clear:both;}
|
||||
.navbar-form input,.navbar-form select{display:inline-block;margin-top:5px;margin-bottom:0;}
|
||||
.navbar-form .radio,.navbar-form .checkbox{margin-top:5px;}
|
||||
.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"]{margin-top:3px;}
|
||||
.navbar-form .input-append,.navbar-form .input-prepend{margin-top:6px;white-space:nowrap;}.navbar-form .input-append input,.navbar-form .input-prepend input{margin-top:0;}
|
||||
.navbar-search{position:relative;float:left;margin-top:6px;margin-bottom:0;}.navbar-search .search-query{padding:4px 9px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:1;color:#ffffff;color:rgba(255, 255, 255, 0.75);background:#666;background:rgba(255, 255, 255, 0.3);border:1px solid #111;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.15);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.15);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1),0 1px 0px rgba(255, 255, 255, 0.15);-webkit-transition:none;-moz-transition:none;-ms-transition:none;-o-transition:none;transition:none;}.navbar-search .search-query :-moz-placeholder{color:#eeeeee;}
|
||||
.navbar-search .search-query::-webkit-input-placeholder{color:#eeeeee;}
|
||||
.navbar-search .search-query:hover{color:#ffffff;background-color:#999999;background-color:rgba(255, 255, 255, 0.5);}
|
||||
.navbar-search .search-query:focus,.navbar-search .search-query.focused{padding:5px 10px;color:#333333;text-shadow:0 1px 0 #ffffff;background-color:#ffffff;border:0;-webkit-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);-moz-box-shadow:0 0 3px rgba(0, 0, 0, 0.15);box-shadow:0 0 3px rgba(0, 0, 0, 0.15);outline:0;}
|
||||
.navbar-fixed-top{position:fixed;top:0;right:0;left:0;z-index:1030;}
|
||||
.navbar-fixed-top .navbar-inner{padding-left:0;padding-right:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}
|
||||
.navbar .nav{position:relative;left:0;display:block;float:left;margin:0 10px 0 0;}
|
||||
.navbar .nav.pull-right{float:right;}
|
||||
.navbar .nav>li{display:block;float:left;}
|
||||
.navbar .nav>li>a{float:none;padding:10px 10px 11px;line-height:19px;color:#999999;text-decoration:none;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);}
|
||||
.navbar .nav>li>a:hover{background-color:transparent;color:#ffffff;text-decoration:none;}
|
||||
.navbar .nav .active>a,.navbar .nav .active>a:hover{color:#ffffff;text-decoration:none;background-color:#222222;}
|
||||
.navbar .divider-vertical{height:40px;width:1px;margin:0 9px;overflow:hidden;background-color:#222222;border-right:1px solid #333333;}
|
||||
.navbar .nav.pull-right{margin-left:10px;margin-right:0;}
|
||||
.navbar .dropdown-menu{margin-top:1px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}.navbar .dropdown-menu:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0, 0, 0, 0.2);position:absolute;top:-7px;left:9px;}
|
||||
.navbar .dropdown-menu:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #ffffff;position:absolute;top:-6px;left:10px;}
|
||||
.navbar .nav .dropdown-toggle .caret,.navbar .nav .open.dropdown .caret{border-top-color:#ffffff;}
|
||||
.navbar .nav .active .caret{opacity:1;filter:alpha(opacity=100);}
|
||||
.navbar .nav .open>.dropdown-toggle,.navbar .nav .active>.dropdown-toggle,.navbar .nav .open.active>.dropdown-toggle{background-color:transparent;}
|
||||
.navbar .nav .active>.dropdown-toggle:hover{color:#ffffff;}
|
||||
.navbar .nav.pull-right .dropdown-menu{left:auto;right:0;}.navbar .nav.pull-right .dropdown-menu:before{left:auto;right:12px;}
|
||||
.navbar .nav.pull-right .dropdown-menu:after{left:auto;right:13px;}
|
||||
.breadcrumb{padding:7px 14px;margin:0 0 18px;background-color:#fbfbfb;background-image:-moz-linear-gradient(top, #ffffff, #f5f5f5);background-image:-ms-linear-gradient(top, #ffffff, #f5f5f5);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f5f5f5));background-image:-webkit-linear-gradient(top, #ffffff, #f5f5f5);background-image:-o-linear-gradient(top, #ffffff, #f5f5f5);background-image:linear-gradient(top, #ffffff, #f5f5f5);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0);border:1px solid #ddd;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;}.breadcrumb li{display:inline-block;text-shadow:0 1px 0 #ffffff;}
|
||||
.breadcrumb .divider{padding:0 5px;color:#999999;}
|
||||
.breadcrumb .active a{color:#333333;}
|
||||
.pagination{height:36px;margin:18px 0;}
|
||||
.pagination ul{display:inline-block;*display:inline;*zoom:1;margin-left:0;margin-bottom:0;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:0 1px 2px rgba(0, 0, 0, 0.05);}
|
||||
.pagination li{display:inline;}
|
||||
.pagination a{float:left;padding:0 14px;line-height:34px;text-decoration:none;border:1px solid #ddd;border-left-width:0;}
|
||||
.pagination a:hover,.pagination .active a{background-color:#f5f5f5;}
|
||||
.pagination .active a{color:#999999;cursor:default;}
|
||||
.pagination .disabled a,.pagination .disabled a:hover{color:#999999;background-color:transparent;cursor:default;}
|
||||
.pagination li:first-child a{border-left-width:1px;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;}
|
||||
.pagination li:last-child a{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;}
|
||||
.pagination-centered{text-align:center;}
|
||||
.pagination-right{text-align:right;}
|
||||
.pager{margin-left:0;margin-bottom:18px;list-style:none;text-align:center;*zoom:1;}.pager:before,.pager:after{display:table;content:"";}
|
||||
.pager:after{clear:both;}
|
||||
.pager li{display:inline;}
|
||||
.pager a{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;}
|
||||
.pager a:hover{text-decoration:none;background-color:#f5f5f5;}
|
||||
.pager .next a{float:right;}
|
||||
.pager .previous a{float:left;}
|
||||
.modal-open .dropdown-menu{z-index:2050;}
|
||||
.modal-open .dropdown.open{*z-index:2050;}
|
||||
.modal-open .popover{z-index:2060;}
|
||||
.modal-open .tooltip{z-index:2070;}
|
||||
.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000000;}.modal-backdrop.fade{opacity:0;}
|
||||
.modal-backdrop,.modal-backdrop.fade.in{opacity:0.8;filter:alpha(opacity=80);}
|
||||
.modal{position:fixed;top:50%;left:50%;z-index:1050;max-height:500px;overflow:auto;width:560px;margin:-250px 0 0 -280px;background-color:#ffffff;border:1px solid #999;border:1px solid rgba(0, 0, 0, 0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.modal.fade{-webkit-transition:opacity .3s linear, top .3s ease-out;-moz-transition:opacity .3s linear, top .3s ease-out;-ms-transition:opacity .3s linear, top .3s ease-out;-o-transition:opacity .3s linear, top .3s ease-out;transition:opacity .3s linear, top .3s ease-out;top:-25%;}
|
||||
.modal.fade.in{top:50%;}
|
||||
.modal-header{padding:9px 15px;border-bottom:1px solid #eee;}.modal-header .close{margin-top:2px;}
|
||||
.modal-body{padding:15px;}
|
||||
.modal-body .modal-form{margin-bottom:0;}
|
||||
.modal-footer{padding:14px 15px 15px;margin-bottom:0;background-color:#f5f5f5;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;*zoom:1;}.modal-footer:before,.modal-footer:after{display:table;content:"";}
|
||||
.modal-footer:after{clear:both;}
|
||||
.modal-footer .btn{float:right;margin-left:5px;margin-bottom:0;}
|
||||
.tooltip{position:absolute;z-index:1020;display:block;visibility:visible;padding:5px;font-size:11px;opacity:0;filter:alpha(opacity=0);}.tooltip.in{opacity:0.8;filter:alpha(opacity=80);}
|
||||
.tooltip.top{margin-top:-2px;}
|
||||
.tooltip.right{margin-left:2px;}
|
||||
.tooltip.bottom{margin-top:2px;}
|
||||
.tooltip.left{margin-left:-2px;}
|
||||
.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
|
||||
.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;}
|
||||
.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;}
|
||||
.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;}
|
||||
.tooltip-inner{max-width:200px;padding:3px 8px;color:#ffffff;text-align:center;text-decoration:none;background-color:#000000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
|
||||
.tooltip-arrow{position:absolute;width:0;height:0;}
|
||||
.popover{position:absolute;top:0;left:0;z-index:1010;display:none;padding:5px;}.popover.top{margin-top:-5px;}
|
||||
.popover.right{margin-left:5px;}
|
||||
.popover.bottom{margin-top:5px;}
|
||||
.popover.left{margin-left:-5px;}
|
||||
.popover.top .arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
|
||||
.popover.right .arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;}
|
||||
.popover.bottom .arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;}
|
||||
.popover.left .arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;}
|
||||
.popover .arrow{position:absolute;width:0;height:0;}
|
||||
.popover-inner{padding:3px;width:280px;overflow:hidden;background:#000000;background:rgba(0, 0, 0, 0.8);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);}
|
||||
.popover-title{padding:9px 15px;line-height:1;background-color:#f5f5f5;border-bottom:1px solid #eee;-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;}
|
||||
.popover-content{padding:14px;background-color:#ffffff;-webkit-border-radius:0 0 3px 3px;-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;}.popover-content p,.popover-content ul,.popover-content ol{margin-bottom:0;}
|
||||
.thumbnails{margin-left:-20px;list-style:none;*zoom:1;}.thumbnails:before,.thumbnails:after{display:table;content:"";}
|
||||
.thumbnails:after{clear:both;}
|
||||
.thumbnails>li{float:left;margin:0 0 18px 20px;}
|
||||
.thumbnail{display:block;padding:4px;line-height:1;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:0 1px 1px rgba(0, 0, 0, 0.075);}
|
||||
a.thumbnail:hover{border-color:#0088cc;-webkit-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);-moz-box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);box-shadow:0 1px 4px rgba(0, 105, 214, 0.25);}
|
||||
.thumbnail>img{display:block;max-width:100%;margin-left:auto;margin-right:auto;}
|
||||
.thumbnail .caption{padding:9px;}
|
||||
.label{padding:2px 4px 3px;font-size:11.049999999999999px;font-weight:bold;color:#ffffff;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#999999;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
|
||||
.label:hover{color:#ffffff;text-decoration:none;}
|
||||
.label-important{background-color:#b94a48;}
|
||||
.label-important:hover{background-color:#953b39;}
|
||||
.label-warning{background-color:#f89406;}
|
||||
.label-warning:hover{background-color:#c67605;}
|
||||
.label-success{background-color:#468847;}
|
||||
.label-success:hover{background-color:#356635;}
|
||||
.label-info{background-color:#3a87ad;}
|
||||
.label-info:hover{background-color:#2d6987;}
|
||||
@-webkit-keyframes progress-bar-stripes{from{background-position:0 0;} to{background-position:40px 0;}}@-moz-keyframes progress-bar-stripes{from{background-position:0 0;} to{background-position:40px 0;}}@keyframes progress-bar-stripes{from{background-position:0 0;} to{background-position:40px 0;}}.progress{overflow:hidden;height:18px;margin-bottom:18px;background-color:#f7f7f7;background-image:-moz-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-ms-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9));background-image:-webkit-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:-o-linear-gradient(top, #f5f5f5, #f9f9f9);background-image:linear-gradient(top, #f5f5f5, #f9f9f9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#f9f9f9', GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.1);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
|
||||
.progress .bar{width:0%;height:18px;color:#ffffff;font-size:12px;text-align:center;text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);background-color:#0e90d2;background-image:-moz-linear-gradient(top, #149bdf, #0480be);background-image:-ms-linear-gradient(top, #149bdf, #0480be);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be));background-image:-webkit-linear-gradient(top, #149bdf, #0480be);background-image:-o-linear-gradient(top, #149bdf, #0480be);background-image:linear-gradient(top, #149bdf, #0480be);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#149bdf', endColorstr='#0480be', GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);-moz-box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);box-shadow:inset 0 -1px 0 rgba(0, 0, 0, 0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width 0.6s ease;-moz-transition:width 0.6s ease;-ms-transition:width 0.6s ease;-o-transition:width 0.6s ease;transition:width 0.6s ease;}
|
||||
.progress-striped .bar{background-color:#62c462;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);-webkit-background-size:40px 40px;-moz-background-size:40px 40px;-o-background-size:40px 40px;background-size:40px 40px;}
|
||||
.progress.active .bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-moz-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite;}
|
||||
.progress-danger .bar{background-color:#dd514c;background-image:-moz-linear-gradient(top, #ee5f5b, #c43c35);background-image:-ms-linear-gradient(top, #ee5f5b, #c43c35);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35));background-image:-webkit-linear-gradient(top, #ee5f5b, #c43c35);background-image:-o-linear-gradient(top, #ee5f5b, #c43c35);background-image:linear-gradient(top, #ee5f5b, #c43c35);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#c43c35', GradientType=0);}
|
||||
.progress-danger.progress-striped .bar{background-color:#ee5f5b;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);}
|
||||
.progress-success .bar{background-color:#5eb95e;background-image:-moz-linear-gradient(top, #62c462, #57a957);background-image:-ms-linear-gradient(top, #62c462, #57a957);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957));background-image:-webkit-linear-gradient(top, #62c462, #57a957);background-image:-o-linear-gradient(top, #62c462, #57a957);background-image:linear-gradient(top, #62c462, #57a957);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#57a957', GradientType=0);}
|
||||
.progress-success.progress-striped .bar{background-color:#62c462;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);}
|
||||
.progress-info .bar{background-color:#4bb1cf;background-image:-moz-linear-gradient(top, #5bc0de, #339bb9);background-image:-ms-linear-gradient(top, #5bc0de, #339bb9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9));background-image:-webkit-linear-gradient(top, #5bc0de, #339bb9);background-image:-o-linear-gradient(top, #5bc0de, #339bb9);background-image:linear-gradient(top, #5bc0de, #339bb9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', endColorstr='#339bb9', GradientType=0);}
|
||||
.progress-info.progress-striped .bar{background-color:#5bc0de;background-image:-webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));background-image:-webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);}
|
||||
.accordion{margin-bottom:18px;}
|
||||
.accordion-group{margin-bottom:2px;border:1px solid #e5e5e5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
|
||||
.accordion-heading{border-bottom:0;}
|
||||
.accordion-heading .accordion-toggle{display:block;padding:8px 15px;}
|
||||
.accordion-inner{padding:9px 15px;border-top:1px solid #e5e5e5;}
|
||||
.carousel{position:relative;margin-bottom:18px;line-height:1;}
|
||||
.carousel-inner{overflow:hidden;width:100%;position:relative;}
|
||||
.carousel .item{display:none;position:relative;-webkit-transition:0.6s ease-in-out left;-moz-transition:0.6s ease-in-out left;-ms-transition:0.6s ease-in-out left;-o-transition:0.6s ease-in-out left;transition:0.6s ease-in-out left;}
|
||||
.carousel .item>img{display:block;line-height:1;}
|
||||
.carousel .active,.carousel .next,.carousel .prev{display:block;}
|
||||
.carousel .active{left:0;}
|
||||
.carousel .next,.carousel .prev{position:absolute;top:0;width:100%;}
|
||||
.carousel .next{left:100%;}
|
||||
.carousel .prev{left:-100%;}
|
||||
.carousel .next.left,.carousel .prev.right{left:0;}
|
||||
.carousel .active.left{left:-100%;}
|
||||
.carousel .active.right{left:100%;}
|
||||
.carousel-control{position:absolute;top:40%;left:15px;width:40px;height:40px;margin-top:-20px;font-size:60px;font-weight:100;line-height:30px;color:#ffffff;text-align:center;background:#222222;border:3px solid #ffffff;-webkit-border-radius:23px;-moz-border-radius:23px;border-radius:23px;opacity:0.5;filter:alpha(opacity=50);}.carousel-control.right{left:auto;right:15px;}
|
||||
.carousel-control:hover{color:#ffffff;text-decoration:none;opacity:0.9;filter:alpha(opacity=90);}
|
||||
.carousel-caption{position:absolute;left:0;right:0;bottom:0;padding:10px 15px 5px;background:#333333;background:rgba(0, 0, 0, 0.75);}
|
||||
.carousel-caption h4,.carousel-caption p{color:#ffffff;}
|
||||
.hero-unit{padding:60px;margin-bottom:30px;background-color:#f5f5f5;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;letter-spacing:-1px;}
|
||||
.hero-unit p{font-size:18px;font-weight:200;line-height:27px;}
|
||||
.pull-right{float:right;}
|
||||
.pull-left{float:left;}
|
||||
.hide{display:none;}
|
||||
.show{display:block;}
|
||||
.invisible{visibility:hidden;}
|
Before Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 152 B |
Before Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 171 B |
|
@ -1,508 +0,0 @@
|
|||
body {
|
||||
padding: 40px 0 0 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
margin: 0.83em 0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.17em;
|
||||
margin: 1em 0 0.2em 0;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
a, a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
var {
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
color: #c09853;
|
||||
}
|
||||
|
||||
code {
|
||||
color: #000000;
|
||||
white-space: nowrap;
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
code:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
code a b {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
pre code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.deprecated {
|
||||
text-decoration: line-through;
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
.invalid {
|
||||
color: #dd1144;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Left side */
|
||||
#left {
|
||||
overflow: auto;
|
||||
width: 270px;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
/* Menu */
|
||||
#menu {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#menu h3 {
|
||||
border-bottom: 1px solid #cccccc;
|
||||
margin-left: -10px;
|
||||
margin-right: -10px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
#menu ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#menu ul ul {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
#menu li {
|
||||
white-space: nowrap;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#menu a {
|
||||
display: block;
|
||||
padding: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#menu a:hover {
|
||||
background-color: #0088cc;
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
#menu .active > a {
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#menu .active > a.invalid {
|
||||
color: #dd1144;
|
||||
}
|
||||
|
||||
#menu #groups span {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 3px;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background: url('collapsed.png') transparent 0 0 no-repeat;
|
||||
}
|
||||
|
||||
#menu #groups span:hover {
|
||||
background-position: -12px 0;
|
||||
}
|
||||
|
||||
#menu #groups span.collapsed {
|
||||
background-position: 0 -12px;
|
||||
}
|
||||
|
||||
#menu #groups span.collapsed:hover {
|
||||
background-position: -12px -12px;
|
||||
}
|
||||
|
||||
#menu #groups ul.collapsed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Search */
|
||||
#menu .form-search {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
#menu .search-query {
|
||||
height: auto;
|
||||
width: 100%;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Autocomplete */
|
||||
.ac_results {
|
||||
border-radius: 4px;
|
||||
margin-top: 2px;
|
||||
background-clip: padding-box;
|
||||
background-color: #ffffff;
|
||||
border-color: rgba(0, 0, 0, 0.2);
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
||||
overflow: hidden;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.ac_results ul {
|
||||
width: 100%;
|
||||
list-style-position: outside;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ac_results li {
|
||||
margin: 0;
|
||||
padding: 2px 5px;
|
||||
cursor: default;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ac_results li strong {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.ac_over {
|
||||
background-color: #0088cc;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.ac_results li.ac_over strong {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
|
||||
/* Right side */
|
||||
#right {
|
||||
overflow: auto;
|
||||
margin-left: 275px;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
#rightInner {
|
||||
max-width: 1000px;
|
||||
min-width: 350px;
|
||||
}
|
||||
|
||||
/* Navigation */
|
||||
.navbar-fixed-top .container {
|
||||
width: auto;
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
.navbar .nav > li > span {
|
||||
display: block;
|
||||
color: #999999;
|
||||
line-height: 19px;
|
||||
padding: 10px 10px 11px;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.navbar .nav > li.active > span {
|
||||
background-color: #222222;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Content */
|
||||
#content {
|
||||
clear: both;
|
||||
padding: 5px 15px;
|
||||
}
|
||||
|
||||
#content > .description {
|
||||
margin: 1.2em 0;
|
||||
}
|
||||
|
||||
#content .alert-info {
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
dl.tree {
|
||||
margin: 1.2em 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
dl.tree dd {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.elementList {
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
h2.switchable {
|
||||
background: transparent url('sort.png') no-repeat center right;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.summary td:first-child {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#packages.summary td:first-child, #namespaces.summary td:first-child, .inherited.summary td:first-child, .used.summary td:first-child {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.summary tr:hover td {
|
||||
background: #f6f6f4;
|
||||
}
|
||||
|
||||
.summary .description p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.class #methods.summary .description p:first-child, .summary .description.detailed h4:first-child {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.summary .description p + p, .summary .description ul, .summary .description pre, .summary .description.detailed h4 {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.summary dl {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.summary dd {
|
||||
margin: 0 0 0 25px;
|
||||
}
|
||||
|
||||
.summary dt, dd {
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.name, .attributes {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.value code {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
td.attributes {
|
||||
width: 1%;
|
||||
}
|
||||
|
||||
.class .methods .name, .class .properties .name, .class .constants .name {
|
||||
width: auto;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.class .methods .name > div > code {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.class .methods .name > div > code span, .function .value > code {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.class .methods td.name > div, .class td.value > div {
|
||||
position: relative;
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
.attributes code, .name code, dd code {
|
||||
color: #468847;
|
||||
}
|
||||
|
||||
.anchor {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
line-height: 1;
|
||||
font-size: 85%;
|
||||
margin: 0;
|
||||
color: #0088cc !important;
|
||||
}
|
||||
|
||||
.list {
|
||||
margin: 0 0 5px 25px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
/* Splitter */
|
||||
#splitter {
|
||||
position: fixed;
|
||||
height: 100%;
|
||||
width: 5px;
|
||||
left: 270px;
|
||||
background: #0088cc url('resize.png') left center no-repeat;
|
||||
cursor: e-resize;
|
||||
}
|
||||
|
||||
#splitter.active {
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
#footer {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
clear: both;
|
||||
color: #808080;
|
||||
text-align: right;
|
||||
padding: 2em 1em;
|
||||
margin: 3em 0 40px 0;
|
||||
}
|
||||
|
||||
/* Tree */
|
||||
div.tree ul {
|
||||
list-style: none;
|
||||
background: url('tree-vertical.png') left repeat-y;
|
||||
padding: 0;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
div.tree li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div.tree div {
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
div.tree div.notlast {
|
||||
background: url('tree-hasnext.png') left 10px no-repeat;
|
||||
}
|
||||
|
||||
div.tree div.last {
|
||||
background: url('tree-last.png') left -240px no-repeat;
|
||||
}
|
||||
|
||||
div.tree li.last {
|
||||
background: url('tree-cleaner.png') left center repeat-y;
|
||||
}
|
||||
|
||||
div.tree span.padding {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
/* Source code */
|
||||
#source {
|
||||
margin: 1em 0 1em 1em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.php-keyword1 {
|
||||
color: #468847;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.php-keyword2 {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.php-var {
|
||||
color: #c09853;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.php-num {
|
||||
color: #006dcc;
|
||||
}
|
||||
|
||||
.php-quote {
|
||||
color: #006dcc;
|
||||
}
|
||||
|
||||
.php-comment {
|
||||
color: #929292;
|
||||
}
|
||||
|
||||
.xlang {
|
||||
color: #468847;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
span.l {
|
||||
display: block;
|
||||
}
|
||||
|
||||
span.l.selected {
|
||||
background: #f9f2d2;
|
||||
}
|
||||
|
||||
span.l a {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
span.l a:hover, span.l a:active, span.l a:focus {
|
||||
background: transparent;
|
||||
color: #333333 !important;
|
||||
}
|
||||
|
||||
span.l .php-var a {
|
||||
color: #c09853;
|
||||
}
|
||||
|
||||
span.l .php-var a:hover, span.l .php-var a:active, span.l .php-var a:focus {
|
||||
color: #c09853 !important;
|
||||
}
|
||||
|
||||
span.l a.l {
|
||||
background: #fbfbfc;
|
||||
margin-right: 8px;
|
||||
padding: 2px 2px 2px 8px;
|
||||
color: #c0c0c0;
|
||||
}
|
||||
|
||||
span.l a.l:hover, span.l a.l:active, span.l a.l:focus {
|
||||
background: #fbfbfc;
|
||||
color: #c0c0c0 !important;
|
||||
}
|
||||
|
||||
/* Small screens */
|
||||
#rightInner.medium .name, #rightInner.medium .attributes {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/* global style */
|
||||
.left, .summary td.left {
|
||||
text-align: left;
|
||||
}
|
||||
.right, .summary td.right {
|
||||
text-align: right;
|
||||
}
|
Before Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 127 B |
|
@ -1,718 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex">
|
||||
|
||||
<title>File RetailCrm/ApiClient.php | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.html" title="Summary of RetailCrm"><span>Namespace</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="class-RetailCrm.ApiClient.html" title="Summary of RetailCrm\ApiClient"><span>Class</span></a>
|
||||
</li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li class="active"><a href="class-RetailCrm.ApiClient.html">ApiClient</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<pre id="source"><code><span id="1" class="l"><a class="l" href="#1"> 1 </a><span class="xlang"><?php</span>
|
||||
</span><span id="2" class="l"><a class="l" href="#2"> 2 </a>
|
||||
</span><span id="3" class="l"><a class="l" href="#3"> 3 </a><span class="php-keyword1">namespace</span> RetailCrm;
|
||||
</span><span id="4" class="l"><a class="l" href="#4"> 4 </a>
|
||||
</span><span id="5" class="l"><a class="l" href="#5"> 5 </a><span class="php-keyword1">use</span> RetailCrm\Http\Client;
|
||||
</span><span id="6" class="l"><a class="l" href="#6"> 6 </a><span class="php-keyword1">use</span> RetailCrm\Response\ApiResponse;
|
||||
</span><span id="7" class="l"><a class="l" href="#7"> 7 </a>
|
||||
</span><span id="8" class="l"><a class="l" href="#8"> 8 </a><span class="php-comment">/**
|
||||
</span></span><span id="9" class="l"><a class="l" href="#9"> 9 </a><span class="php-comment"> * retailCRM API client class
|
||||
</span></span><span id="10" class="l"><a class="l" href="#10"> 10 </a><span class="php-comment"> */</span>
|
||||
</span><span id="11" class="l"><a class="l" href="#11"> 11 </a><span class="php-keyword1">class</span> <a id="ApiClient" href="#ApiClient">ApiClient</a>
|
||||
</span><span id="12" class="l"><a class="l" href="#12"> 12 </a>{
|
||||
</span><span id="13" class="l"><a class="l" href="#13"> 13 </a> <span class="php-keyword1">const</span> <a id="VERSION" href="#VERSION">VERSION</a> = <span class="php-quote">'v3'</span>;
|
||||
</span><span id="14" class="l"><a class="l" href="#14"> 14 </a>
|
||||
</span><span id="15" class="l"><a class="l" href="#15"> 15 </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$client" href="#$client">$client</a></span>;
|
||||
</span><span id="16" class="l"><a class="l" href="#16"> 16 </a>
|
||||
</span><span id="17" class="l"><a class="l" href="#17"> 17 </a> <span class="php-comment">/**
|
||||
</span></span><span id="18" class="l"><a class="l" href="#18"> 18 </a><span class="php-comment"> * Client creating
|
||||
</span></span><span id="19" class="l"><a class="l" href="#19"> 19 </a><span class="php-comment"> *
|
||||
</span></span><span id="20" class="l"><a class="l" href="#20"> 20 </a><span class="php-comment"> * @param string $url
|
||||
</span></span><span id="21" class="l"><a class="l" href="#21"> 21 </a><span class="php-comment"> * @param string $apiKey
|
||||
</span></span><span id="22" class="l"><a class="l" href="#22"> 22 </a><span class="php-comment"> * @return mixed
|
||||
</span></span><span id="23" class="l"><a class="l" href="#23"> 23 </a><span class="php-comment"> */</span>
|
||||
</span><span id="24" class="l"><a class="l" href="#24"> 24 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>(<span class="php-var">$url</span>, <span class="php-var">$apiKey</span>)
|
||||
</span><span id="25" class="l"><a class="l" href="#25"> 25 </a> {
|
||||
</span><span id="26" class="l"><a class="l" href="#26"> 26 </a> <span class="php-keyword1">if</span> (<span class="php-quote">'/'</span> != <span class="php-keyword2">substr</span>(<span class="php-var">$url</span>, <span class="php-keyword2">strlen</span>(<span class="php-var">$url</span>) - <span class="php-num">1</span>, <span class="php-num">1</span>)) {
|
||||
</span><span id="27" class="l"><a class="l" href="#27"> 27 </a> <span class="php-var">$url</span> .= <span class="php-quote">'/'</span>;
|
||||
</span><span id="28" class="l"><a class="l" href="#28"> 28 </a> }
|
||||
</span><span id="29" class="l"><a class="l" href="#29"> 29 </a>
|
||||
</span><span id="30" class="l"><a class="l" href="#30"> 30 </a> <span class="php-var">$url</span> = <span class="php-var">$url</span> . <span class="php-quote">'api/'</span> . self::VERSION;
|
||||
</span><span id="31" class="l"><a class="l" href="#31"> 31 </a>
|
||||
</span><span id="32" class="l"><a class="l" href="#32"> 32 </a> <span class="php-var">$this</span>->client = <span class="php-keyword1">new</span> Client(<span class="php-var">$url</span>, <span class="php-keyword1">array</span>(<span class="php-quote">'apiKey'</span> => <span class="php-var">$apiKey</span>));
|
||||
</span><span id="33" class="l"><a class="l" href="#33"> 33 </a> }
|
||||
</span><span id="34" class="l"><a class="l" href="#34"> 34 </a>
|
||||
</span><span id="35" class="l"><a class="l" href="#35"> 35 </a> <span class="php-comment">/**
|
||||
</span></span><span id="36" class="l"><a class="l" href="#36"> 36 </a><span class="php-comment"> * Create a order
|
||||
</span></span><span id="37" class="l"><a class="l" href="#37"> 37 </a><span class="php-comment"> *
|
||||
</span></span><span id="38" class="l"><a class="l" href="#38"> 38 </a><span class="php-comment"> * @param array $order
|
||||
</span></span><span id="39" class="l"><a class="l" href="#39"> 39 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="40" class="l"><a class="l" href="#40"> 40 </a><span class="php-comment"> */</span>
|
||||
</span><span id="41" class="l"><a class="l" href="#41"> 41 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ordersCreate" href="#_ordersCreate">ordersCreate</a>(<span class="php-keyword1">array</span> <span class="php-var">$order</span>)
|
||||
</span><span id="42" class="l"><a class="l" href="#42"> 42 </a> {
|
||||
</span><span id="43" class="l"><a class="l" href="#43"> 43 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">sizeof</span>(<span class="php-var">$order</span>)) {
|
||||
</span><span id="44" class="l"><a class="l" href="#44"> 44 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Parameter `order` must contains a data'</span>);
|
||||
</span><span id="45" class="l"><a class="l" href="#45"> 45 </a> }
|
||||
</span><span id="46" class="l"><a class="l" href="#46"> 46 </a>
|
||||
</span><span id="47" class="l"><a class="l" href="#47"> 47 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">"/orders/create"</span>, Client::METHOD_POST, <span class="php-keyword1">array</span>(
|
||||
</span><span id="48" class="l"><a class="l" href="#48"> 48 </a> <span class="php-quote">'order'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$order</span>)
|
||||
</span><span id="49" class="l"><a class="l" href="#49"> 49 </a> ));
|
||||
</span><span id="50" class="l"><a class="l" href="#50"> 50 </a> }
|
||||
</span><span id="51" class="l"><a class="l" href="#51"> 51 </a>
|
||||
</span><span id="52" class="l"><a class="l" href="#52"> 52 </a> <span class="php-comment">/**
|
||||
</span></span><span id="53" class="l"><a class="l" href="#53"> 53 </a><span class="php-comment"> * Edit a order
|
||||
</span></span><span id="54" class="l"><a class="l" href="#54"> 54 </a><span class="php-comment"> *
|
||||
</span></span><span id="55" class="l"><a class="l" href="#55"> 55 </a><span class="php-comment"> * @param array $order
|
||||
</span></span><span id="56" class="l"><a class="l" href="#56"> 56 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="57" class="l"><a class="l" href="#57"> 57 </a><span class="php-comment"> */</span>
|
||||
</span><span id="58" class="l"><a class="l" href="#58"> 58 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ordersEdit" href="#_ordersEdit">ordersEdit</a>(<span class="php-keyword1">array</span> <span class="php-var">$order</span>, <span class="php-var">$by</span> = <span class="php-quote">'externalId'</span>)
|
||||
</span><span id="59" class="l"><a class="l" href="#59"> 59 </a> {
|
||||
</span><span id="60" class="l"><a class="l" href="#60"> 60 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">sizeof</span>(<span class="php-var">$order</span>)) {
|
||||
</span><span id="61" class="l"><a class="l" href="#61"> 61 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Parameter `order` must contains a data'</span>);
|
||||
</span><span id="62" class="l"><a class="l" href="#62"> 62 </a> }
|
||||
</span><span id="63" class="l"><a class="l" href="#63"> 63 </a>
|
||||
</span><span id="64" class="l"><a class="l" href="#64"> 64 </a> <span class="php-var">$this</span>->checkIdParameter(<span class="php-var">$by</span>);
|
||||
</span><span id="65" class="l"><a class="l" href="#65"> 65 </a>
|
||||
</span><span id="66" class="l"><a class="l" href="#66"> 66 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$order</span>[<span class="php-var">$by</span>])) {
|
||||
</span><span id="67" class="l"><a class="l" href="#67"> 67 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-keyword2">sprintf</span>(<span class="php-quote">'Order array must contain the "%s" parameter.'</span>, <span class="php-var">$by</span>));
|
||||
</span><span id="68" class="l"><a class="l" href="#68"> 68 </a> }
|
||||
</span><span id="69" class="l"><a class="l" href="#69"> 69 </a>
|
||||
</span><span id="70" class="l"><a class="l" href="#70"> 70 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">"/orders/"</span> . <span class="php-var">$order</span>[<span class="php-var">$by</span>] . <span class="php-quote">"/edit"</span>, Client::METHOD_POST, <span class="php-keyword1">array</span>(
|
||||
</span><span id="71" class="l"><a class="l" href="#71"> 71 </a> <span class="php-quote">'order'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$order</span>),
|
||||
</span><span id="72" class="l"><a class="l" href="#72"> 72 </a> <span class="php-quote">'by'</span> => <span class="php-var">$by</span>,
|
||||
</span><span id="73" class="l"><a class="l" href="#73"> 73 </a> ));
|
||||
</span><span id="74" class="l"><a class="l" href="#74"> 74 </a> }
|
||||
</span><span id="75" class="l"><a class="l" href="#75"> 75 </a>
|
||||
</span><span id="76" class="l"><a class="l" href="#76"> 76 </a> <span class="php-comment">/**
|
||||
</span></span><span id="77" class="l"><a class="l" href="#77"> 77 </a><span class="php-comment"> * Upload array of the orders
|
||||
</span></span><span id="78" class="l"><a class="l" href="#78"> 78 </a><span class="php-comment"> *
|
||||
</span></span><span id="79" class="l"><a class="l" href="#79"> 79 </a><span class="php-comment"> * @param array $orders
|
||||
</span></span><span id="80" class="l"><a class="l" href="#80"> 80 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="81" class="l"><a class="l" href="#81"> 81 </a><span class="php-comment"> */</span>
|
||||
</span><span id="82" class="l"><a class="l" href="#82"> 82 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ordersUpload" href="#_ordersUpload">ordersUpload</a>(<span class="php-keyword1">array</span> <span class="php-var">$orders</span>)
|
||||
</span><span id="83" class="l"><a class="l" href="#83"> 83 </a> {
|
||||
</span><span id="84" class="l"><a class="l" href="#84"> 84 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">sizeof</span>(<span class="php-var">$orders</span>)) {
|
||||
</span><span id="85" class="l"><a class="l" href="#85"> 85 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Parameter `orders` must contains array of the orders'</span>);
|
||||
</span><span id="86" class="l"><a class="l" href="#86"> 86 </a> }
|
||||
</span><span id="87" class="l"><a class="l" href="#87"> 87 </a>
|
||||
</span><span id="88" class="l"><a class="l" href="#88"> 88 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">"/orders/upload"</span>, Client::METHOD_POST, <span class="php-keyword1">array</span>(
|
||||
</span><span id="89" class="l"><a class="l" href="#89"> 89 </a> <span class="php-quote">'orders'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$orders</span>),
|
||||
</span><span id="90" class="l"><a class="l" href="#90"> 90 </a> ));
|
||||
</span><span id="91" class="l"><a class="l" href="#91"> 91 </a> }
|
||||
</span><span id="92" class="l"><a class="l" href="#92"> 92 </a>
|
||||
</span><span id="93" class="l"><a class="l" href="#93"> 93 </a> <span class="php-comment">/**
|
||||
</span></span><span id="94" class="l"><a class="l" href="#94"> 94 </a><span class="php-comment"> * Get order by id or externalId
|
||||
</span></span><span id="95" class="l"><a class="l" href="#95"> 95 </a><span class="php-comment"> *
|
||||
</span></span><span id="96" class="l"><a class="l" href="#96"> 96 </a><span class="php-comment"> * @param string $id
|
||||
</span></span><span id="97" class="l"><a class="l" href="#97"> 97 </a><span class="php-comment"> * @param string $by (default: 'externalId')
|
||||
</span></span><span id="98" class="l"><a class="l" href="#98"> 98 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="99" class="l"><a class="l" href="#99"> 99 </a><span class="php-comment"> */</span>
|
||||
</span><span id="100" class="l"><a class="l" href="#100">100 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ordersGet" href="#_ordersGet">ordersGet</a>(<span class="php-var">$id</span>, <span class="php-var">$by</span> = <span class="php-quote">'externalId'</span>)
|
||||
</span><span id="101" class="l"><a class="l" href="#101">101 </a> {
|
||||
</span><span id="102" class="l"><a class="l" href="#102">102 </a> <span class="php-var">$this</span>->checkIdParameter(<span class="php-var">$by</span>);
|
||||
</span><span id="103" class="l"><a class="l" href="#103">103 </a>
|
||||
</span><span id="104" class="l"><a class="l" href="#104">104 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">"/orders/</span><span class="php-var">$id</span><span class="php-quote">"</span>, Client::METHOD_GET, <span class="php-keyword1">array</span>(<span class="php-quote">'by'</span> => <span class="php-var">$by</span>));
|
||||
</span><span id="105" class="l"><a class="l" href="#105">105 </a> }
|
||||
</span><span id="106" class="l"><a class="l" href="#106">106 </a>
|
||||
</span><span id="107" class="l"><a class="l" href="#107">107 </a> <span class="php-comment">/**
|
||||
</span></span><span id="108" class="l"><a class="l" href="#108">108 </a><span class="php-comment"> * Returns a orders history
|
||||
</span></span><span id="109" class="l"><a class="l" href="#109">109 </a><span class="php-comment"> *
|
||||
</span></span><span id="110" class="l"><a class="l" href="#110">110 </a><span class="php-comment"> * @param \DateTime $startDate (default: null)
|
||||
</span></span><span id="111" class="l"><a class="l" href="#111">111 </a><span class="php-comment"> * @param \DateTime $endDate (default: null)
|
||||
</span></span><span id="112" class="l"><a class="l" href="#112">112 </a><span class="php-comment"> * @param int $limit (default: 100)
|
||||
</span></span><span id="113" class="l"><a class="l" href="#113">113 </a><span class="php-comment"> * @param int $offset (default: 0)
|
||||
</span></span><span id="114" class="l"><a class="l" href="#114">114 </a><span class="php-comment"> * @param bool $skipMyChanges (default: true)
|
||||
</span></span><span id="115" class="l"><a class="l" href="#115">115 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="116" class="l"><a class="l" href="#116">116 </a><span class="php-comment"> */</span>
|
||||
</span><span id="117" class="l"><a class="l" href="#117">117 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ordersHistory" href="#_ordersHistory">ordersHistory</a>(
|
||||
</span><span id="118" class="l"><a class="l" href="#118">118 </a> \DateTime <span class="php-var">$startDate</span> = <span class="php-keyword1">null</span>,
|
||||
</span><span id="119" class="l"><a class="l" href="#119">119 </a> \DateTime <span class="php-var">$endDate</span> = <span class="php-keyword1">null</span>,
|
||||
</span><span id="120" class="l"><a class="l" href="#120">120 </a> <span class="php-var">$limit</span> = <span class="php-num">100</span>,
|
||||
</span><span id="121" class="l"><a class="l" href="#121">121 </a> <span class="php-var">$offset</span> = <span class="php-num">0</span>,
|
||||
</span><span id="122" class="l"><a class="l" href="#122">122 </a> <span class="php-var">$skipMyChanges</span> = <span class="php-keyword1">true</span>
|
||||
</span><span id="123" class="l"><a class="l" href="#123">123 </a> ) {
|
||||
</span><span id="124" class="l"><a class="l" href="#124">124 </a> <span class="php-var">$parameters</span> = <span class="php-keyword1">array</span>();
|
||||
</span><span id="125" class="l"><a class="l" href="#125">125 </a>
|
||||
</span><span id="126" class="l"><a class="l" href="#126">126 </a> <span class="php-keyword1">if</span> (<span class="php-var">$startDate</span>) {
|
||||
</span><span id="127" class="l"><a class="l" href="#127">127 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'startDate'</span>] = <span class="php-var">$startDate</span>->format(<span class="php-quote">'Y-m-d H:i:s'</span>);
|
||||
</span><span id="128" class="l"><a class="l" href="#128">128 </a> }
|
||||
</span><span id="129" class="l"><a class="l" href="#129">129 </a> <span class="php-keyword1">if</span> (<span class="php-var">$endDate</span>) {
|
||||
</span><span id="130" class="l"><a class="l" href="#130">130 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'endDate'</span>] = <span class="php-var">$endDate</span>->format(<span class="php-quote">'Y-m-d H:i:s'</span>);
|
||||
</span><span id="131" class="l"><a class="l" href="#131">131 </a> }
|
||||
</span><span id="132" class="l"><a class="l" href="#132">132 </a> <span class="php-keyword1">if</span> (<span class="php-var">$limit</span>) {
|
||||
</span><span id="133" class="l"><a class="l" href="#133">133 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'limit'</span>] = (int) <span class="php-var">$limit</span>;
|
||||
</span><span id="134" class="l"><a class="l" href="#134">134 </a> }
|
||||
</span><span id="135" class="l"><a class="l" href="#135">135 </a> <span class="php-keyword1">if</span> (<span class="php-var">$offset</span>) {
|
||||
</span><span id="136" class="l"><a class="l" href="#136">136 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'offset'</span>] = (int) <span class="php-var">$offset</span>;
|
||||
</span><span id="137" class="l"><a class="l" href="#137">137 </a> }
|
||||
</span><span id="138" class="l"><a class="l" href="#138">138 </a> <span class="php-keyword1">if</span> (<span class="php-var">$skipMyChanges</span>) {
|
||||
</span><span id="139" class="l"><a class="l" href="#139">139 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'skipMyChanges'</span>] = (bool) <span class="php-var">$skipMyChanges</span>;
|
||||
</span><span id="140" class="l"><a class="l" href="#140">140 </a> }
|
||||
</span><span id="141" class="l"><a class="l" href="#141">141 </a>
|
||||
</span><span id="142" class="l"><a class="l" href="#142">142 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/orders/history'</span>, Client::METHOD_GET, <span class="php-var">$parameters</span>);
|
||||
</span><span id="143" class="l"><a class="l" href="#143">143 </a> }
|
||||
</span><span id="144" class="l"><a class="l" href="#144">144 </a>
|
||||
</span><span id="145" class="l"><a class="l" href="#145">145 </a> <span class="php-comment">/**
|
||||
</span></span><span id="146" class="l"><a class="l" href="#146">146 </a><span class="php-comment"> * Returns filtered orders list
|
||||
</span></span><span id="147" class="l"><a class="l" href="#147">147 </a><span class="php-comment"> *
|
||||
</span></span><span id="148" class="l"><a class="l" href="#148">148 </a><span class="php-comment"> * @param array $filter (default: array())
|
||||
</span></span><span id="149" class="l"><a class="l" href="#149">149 </a><span class="php-comment"> * @param int $page (default: null)
|
||||
</span></span><span id="150" class="l"><a class="l" href="#150">150 </a><span class="php-comment"> * @param int $limit (default: null)
|
||||
</span></span><span id="151" class="l"><a class="l" href="#151">151 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="152" class="l"><a class="l" href="#152">152 </a><span class="php-comment"> */</span>
|
||||
</span><span id="153" class="l"><a class="l" href="#153">153 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ordersList" href="#_ordersList">ordersList</a>(<span class="php-keyword1">array</span> <span class="php-var">$filter</span> = <span class="php-keyword1">array</span>(), <span class="php-var">$page</span> = <span class="php-keyword1">null</span>, <span class="php-var">$limit</span> = <span class="php-keyword1">null</span>)
|
||||
</span><span id="154" class="l"><a class="l" href="#154">154 </a> {
|
||||
</span><span id="155" class="l"><a class="l" href="#155">155 </a> <span class="php-var">$parameters</span> = <span class="php-keyword1">array</span>();
|
||||
</span><span id="156" class="l"><a class="l" href="#156">156 </a>
|
||||
</span><span id="157" class="l"><a class="l" href="#157">157 </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">sizeof</span>(<span class="php-var">$filter</span>)) {
|
||||
</span><span id="158" class="l"><a class="l" href="#158">158 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'filter'</span>] = <span class="php-var">$filter</span>;
|
||||
</span><span id="159" class="l"><a class="l" href="#159">159 </a> }
|
||||
</span><span id="160" class="l"><a class="l" href="#160">160 </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">null</span> !== <span class="php-var">$page</span>) {
|
||||
</span><span id="161" class="l"><a class="l" href="#161">161 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'page'</span>] = (int) <span class="php-var">$page</span>;
|
||||
</span><span id="162" class="l"><a class="l" href="#162">162 </a> }
|
||||
</span><span id="163" class="l"><a class="l" href="#163">163 </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">null</span> !== <span class="php-var">$limit</span>) {
|
||||
</span><span id="164" class="l"><a class="l" href="#164">164 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'limit'</span>] = (int) <span class="php-var">$limit</span>;
|
||||
</span><span id="165" class="l"><a class="l" href="#165">165 </a> }
|
||||
</span><span id="166" class="l"><a class="l" href="#166">166 </a>
|
||||
</span><span id="167" class="l"><a class="l" href="#167">167 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/orders'</span>, Client::METHOD_GET, <span class="php-var">$parameters</span>);
|
||||
</span><span id="168" class="l"><a class="l" href="#168">168 </a> }
|
||||
</span><span id="169" class="l"><a class="l" href="#169">169 </a>
|
||||
</span><span id="170" class="l"><a class="l" href="#170">170 </a> <span class="php-comment">/**
|
||||
</span></span><span id="171" class="l"><a class="l" href="#171">171 </a><span class="php-comment"> * Returns statuses of the orders
|
||||
</span></span><span id="172" class="l"><a class="l" href="#172">172 </a><span class="php-comment"> *
|
||||
</span></span><span id="173" class="l"><a class="l" href="#173">173 </a><span class="php-comment"> * @param array $ids (default: array())
|
||||
</span></span><span id="174" class="l"><a class="l" href="#174">174 </a><span class="php-comment"> * @param array $externalIds (default: array())
|
||||
</span></span><span id="175" class="l"><a class="l" href="#175">175 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="176" class="l"><a class="l" href="#176">176 </a><span class="php-comment"> */</span>
|
||||
</span><span id="177" class="l"><a class="l" href="#177">177 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ordersStatuses" href="#_ordersStatuses">ordersStatuses</a>(<span class="php-keyword1">array</span> <span class="php-var">$ids</span> = <span class="php-keyword1">array</span>(), <span class="php-keyword1">array</span> <span class="php-var">$externalIds</span> = <span class="php-keyword1">array</span>())
|
||||
</span><span id="178" class="l"><a class="l" href="#178">178 </a> {
|
||||
</span><span id="179" class="l"><a class="l" href="#179">179 </a> <span class="php-var">$parameters</span> = <span class="php-keyword1">array</span>();
|
||||
</span><span id="180" class="l"><a class="l" href="#180">180 </a>
|
||||
</span><span id="181" class="l"><a class="l" href="#181">181 </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">sizeof</span>(<span class="php-var">$ids</span>)) {
|
||||
</span><span id="182" class="l"><a class="l" href="#182">182 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'ids'</span>] = <span class="php-var">$ids</span>;
|
||||
</span><span id="183" class="l"><a class="l" href="#183">183 </a> }
|
||||
</span><span id="184" class="l"><a class="l" href="#184">184 </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">sizeof</span>(<span class="php-var">$externalIds</span>)) {
|
||||
</span><span id="185" class="l"><a class="l" href="#185">185 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'externalIds'</span>] = <span class="php-var">$externalIds</span>;
|
||||
</span><span id="186" class="l"><a class="l" href="#186">186 </a> }
|
||||
</span><span id="187" class="l"><a class="l" href="#187">187 </a>
|
||||
</span><span id="188" class="l"><a class="l" href="#188">188 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/orders/statuses'</span>, Client::METHOD_GET, <span class="php-var">$parameters</span>);
|
||||
</span><span id="189" class="l"><a class="l" href="#189">189 </a> }
|
||||
</span><span id="190" class="l"><a class="l" href="#190">190 </a>
|
||||
</span><span id="191" class="l"><a class="l" href="#191">191 </a> <span class="php-comment">/**
|
||||
</span></span><span id="192" class="l"><a class="l" href="#192">192 </a><span class="php-comment"> * Save order IDs' (id and externalId) association in the CRM
|
||||
</span></span><span id="193" class="l"><a class="l" href="#193">193 </a><span class="php-comment"> *
|
||||
</span></span><span id="194" class="l"><a class="l" href="#194">194 </a><span class="php-comment"> * @param array $ids
|
||||
</span></span><span id="195" class="l"><a class="l" href="#195">195 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="196" class="l"><a class="l" href="#196">196 </a><span class="php-comment"> */</span>
|
||||
</span><span id="197" class="l"><a class="l" href="#197">197 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_ordersFixExternalIds" href="#_ordersFixExternalIds">ordersFixExternalIds</a>(<span class="php-keyword1">array</span> <span class="php-var">$ids</span>)
|
||||
</span><span id="198" class="l"><a class="l" href="#198">198 </a> {
|
||||
</span><span id="199" class="l"><a class="l" href="#199">199 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">sizeof</span>(<span class="php-var">$ids</span>)) {
|
||||
</span><span id="200" class="l"><a class="l" href="#200">200 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Method parameter must contains at least one IDs pair'</span>);
|
||||
</span><span id="201" class="l"><a class="l" href="#201">201 </a> }
|
||||
</span><span id="202" class="l"><a class="l" href="#202">202 </a>
|
||||
</span><span id="203" class="l"><a class="l" href="#203">203 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">"/orders/fix-external-ids"</span>, Client::METHOD_POST, <span class="php-keyword1">array</span>(
|
||||
</span><span id="204" class="l"><a class="l" href="#204">204 </a> <span class="php-quote">'orders'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$ids</span>),
|
||||
</span><span id="205" class="l"><a class="l" href="#205">205 </a> ));
|
||||
</span><span id="206" class="l"><a class="l" href="#206">206 </a> }
|
||||
</span><span id="207" class="l"><a class="l" href="#207">207 </a>
|
||||
</span><span id="208" class="l"><a class="l" href="#208">208 </a> <span class="php-comment">/**
|
||||
</span></span><span id="209" class="l"><a class="l" href="#209">209 </a><span class="php-comment"> * Create a customer
|
||||
</span></span><span id="210" class="l"><a class="l" href="#210">210 </a><span class="php-comment"> *
|
||||
</span></span><span id="211" class="l"><a class="l" href="#211">211 </a><span class="php-comment"> * @param array $customer
|
||||
</span></span><span id="212" class="l"><a class="l" href="#212">212 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="213" class="l"><a class="l" href="#213">213 </a><span class="php-comment"> */</span>
|
||||
</span><span id="214" class="l"><a class="l" href="#214">214 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_customersCreate" href="#_customersCreate">customersCreate</a>(<span class="php-keyword1">array</span> <span class="php-var">$customer</span>)
|
||||
</span><span id="215" class="l"><a class="l" href="#215">215 </a> {
|
||||
</span><span id="216" class="l"><a class="l" href="#216">216 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">sizeof</span>(<span class="php-var">$customer</span>)) {
|
||||
</span><span id="217" class="l"><a class="l" href="#217">217 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Parameter `customer` must contains a data'</span>);
|
||||
</span><span id="218" class="l"><a class="l" href="#218">218 </a> }
|
||||
</span><span id="219" class="l"><a class="l" href="#219">219 </a>
|
||||
</span><span id="220" class="l"><a class="l" href="#220">220 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">"/customers/create"</span>, Client::METHOD_POST, <span class="php-keyword1">array</span>(
|
||||
</span><span id="221" class="l"><a class="l" href="#221">221 </a> <span class="php-quote">'customer'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$customer</span>)
|
||||
</span><span id="222" class="l"><a class="l" href="#222">222 </a> ));
|
||||
</span><span id="223" class="l"><a class="l" href="#223">223 </a> }
|
||||
</span><span id="224" class="l"><a class="l" href="#224">224 </a>
|
||||
</span><span id="225" class="l"><a class="l" href="#225">225 </a> <span class="php-comment">/**
|
||||
</span></span><span id="226" class="l"><a class="l" href="#226">226 </a><span class="php-comment"> * Edit a customer
|
||||
</span></span><span id="227" class="l"><a class="l" href="#227">227 </a><span class="php-comment"> *
|
||||
</span></span><span id="228" class="l"><a class="l" href="#228">228 </a><span class="php-comment"> * @param array $customer
|
||||
</span></span><span id="229" class="l"><a class="l" href="#229">229 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="230" class="l"><a class="l" href="#230">230 </a><span class="php-comment"> */</span>
|
||||
</span><span id="231" class="l"><a class="l" href="#231">231 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_customersEdit" href="#_customersEdit">customersEdit</a>(<span class="php-keyword1">array</span> <span class="php-var">$customer</span>, <span class="php-var">$by</span> = <span class="php-quote">'externalId'</span>)
|
||||
</span><span id="232" class="l"><a class="l" href="#232">232 </a> {
|
||||
</span><span id="233" class="l"><a class="l" href="#233">233 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">sizeof</span>(<span class="php-var">$customer</span>)) {
|
||||
</span><span id="234" class="l"><a class="l" href="#234">234 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Parameter `customer` must contains a data'</span>);
|
||||
</span><span id="235" class="l"><a class="l" href="#235">235 </a> }
|
||||
</span><span id="236" class="l"><a class="l" href="#236">236 </a>
|
||||
</span><span id="237" class="l"><a class="l" href="#237">237 </a> <span class="php-var">$this</span>->checkIdParameter(<span class="php-var">$by</span>);
|
||||
</span><span id="238" class="l"><a class="l" href="#238">238 </a>
|
||||
</span><span id="239" class="l"><a class="l" href="#239">239 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$customer</span>[<span class="php-var">$by</span>])) {
|
||||
</span><span id="240" class="l"><a class="l" href="#240">240 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-keyword2">sprintf</span>(<span class="php-quote">'Customer array must contain the "%s" parameter.'</span>, <span class="php-var">$by</span>));
|
||||
</span><span id="241" class="l"><a class="l" href="#241">241 </a> }
|
||||
</span><span id="242" class="l"><a class="l" href="#242">242 </a>
|
||||
</span><span id="243" class="l"><a class="l" href="#243">243 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">"/customers/"</span> . <span class="php-var">$customer</span>[<span class="php-var">$by</span>] . <span class="php-quote">"/edit"</span>, Client::METHOD_POST, <span class="php-keyword1">array</span>(
|
||||
</span><span id="244" class="l"><a class="l" href="#244">244 </a> <span class="php-quote">'customer'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$customer</span>),
|
||||
</span><span id="245" class="l"><a class="l" href="#245">245 </a> <span class="php-quote">'by'</span> => <span class="php-var">$by</span>,
|
||||
</span><span id="246" class="l"><a class="l" href="#246">246 </a> ));
|
||||
</span><span id="247" class="l"><a class="l" href="#247">247 </a> }
|
||||
</span><span id="248" class="l"><a class="l" href="#248">248 </a>
|
||||
</span><span id="249" class="l"><a class="l" href="#249">249 </a> <span class="php-comment">/**
|
||||
</span></span><span id="250" class="l"><a class="l" href="#250">250 </a><span class="php-comment"> * Upload array of the customers
|
||||
</span></span><span id="251" class="l"><a class="l" href="#251">251 </a><span class="php-comment"> *
|
||||
</span></span><span id="252" class="l"><a class="l" href="#252">252 </a><span class="php-comment"> * @param array $customers
|
||||
</span></span><span id="253" class="l"><a class="l" href="#253">253 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="254" class="l"><a class="l" href="#254">254 </a><span class="php-comment"> */</span>
|
||||
</span><span id="255" class="l"><a class="l" href="#255">255 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_customersUpload" href="#_customersUpload">customersUpload</a>(<span class="php-keyword1">array</span> <span class="php-var">$customers</span>)
|
||||
</span><span id="256" class="l"><a class="l" href="#256">256 </a> {
|
||||
</span><span id="257" class="l"><a class="l" href="#257">257 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">sizeof</span>(<span class="php-var">$customers</span>)) {
|
||||
</span><span id="258" class="l"><a class="l" href="#258">258 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Parameter `customers` must contains array of the customers'</span>);
|
||||
</span><span id="259" class="l"><a class="l" href="#259">259 </a> }
|
||||
</span><span id="260" class="l"><a class="l" href="#260">260 </a>
|
||||
</span><span id="261" class="l"><a class="l" href="#261">261 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">"/customers/upload"</span>, Client::METHOD_POST, <span class="php-keyword1">array</span>(
|
||||
</span><span id="262" class="l"><a class="l" href="#262">262 </a> <span class="php-quote">'customers'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$customers</span>),
|
||||
</span><span id="263" class="l"><a class="l" href="#263">263 </a> ));
|
||||
</span><span id="264" class="l"><a class="l" href="#264">264 </a> }
|
||||
</span><span id="265" class="l"><a class="l" href="#265">265 </a>
|
||||
</span><span id="266" class="l"><a class="l" href="#266">266 </a> <span class="php-comment">/**
|
||||
</span></span><span id="267" class="l"><a class="l" href="#267">267 </a><span class="php-comment"> * Get customer by id or externalId
|
||||
</span></span><span id="268" class="l"><a class="l" href="#268">268 </a><span class="php-comment"> *
|
||||
</span></span><span id="269" class="l"><a class="l" href="#269">269 </a><span class="php-comment"> * @param string $id
|
||||
</span></span><span id="270" class="l"><a class="l" href="#270">270 </a><span class="php-comment"> * @param string $by (default: 'externalId')
|
||||
</span></span><span id="271" class="l"><a class="l" href="#271">271 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="272" class="l"><a class="l" href="#272">272 </a><span class="php-comment"> */</span>
|
||||
</span><span id="273" class="l"><a class="l" href="#273">273 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_customersGet" href="#_customersGet">customersGet</a>(<span class="php-var">$id</span>, <span class="php-var">$by</span> = <span class="php-quote">'externalId'</span>)
|
||||
</span><span id="274" class="l"><a class="l" href="#274">274 </a> {
|
||||
</span><span id="275" class="l"><a class="l" href="#275">275 </a> <span class="php-var">$this</span>->checkIdParameter(<span class="php-var">$by</span>);
|
||||
</span><span id="276" class="l"><a class="l" href="#276">276 </a>
|
||||
</span><span id="277" class="l"><a class="l" href="#277">277 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">"/customers/</span><span class="php-var">$id</span><span class="php-quote">"</span>, Client::METHOD_GET, <span class="php-keyword1">array</span>(<span class="php-quote">'by'</span> => <span class="php-var">$by</span>));
|
||||
</span><span id="278" class="l"><a class="l" href="#278">278 </a> }
|
||||
</span><span id="279" class="l"><a class="l" href="#279">279 </a>
|
||||
</span><span id="280" class="l"><a class="l" href="#280">280 </a> <span class="php-comment">/**
|
||||
</span></span><span id="281" class="l"><a class="l" href="#281">281 </a><span class="php-comment"> * Returns filtered customers list
|
||||
</span></span><span id="282" class="l"><a class="l" href="#282">282 </a><span class="php-comment"> *
|
||||
</span></span><span id="283" class="l"><a class="l" href="#283">283 </a><span class="php-comment"> * @param array $filter (default: array())
|
||||
</span></span><span id="284" class="l"><a class="l" href="#284">284 </a><span class="php-comment"> * @param int $page (default: null)
|
||||
</span></span><span id="285" class="l"><a class="l" href="#285">285 </a><span class="php-comment"> * @param int $limit (default: null)
|
||||
</span></span><span id="286" class="l"><a class="l" href="#286">286 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="287" class="l"><a class="l" href="#287">287 </a><span class="php-comment"> */</span>
|
||||
</span><span id="288" class="l"><a class="l" href="#288">288 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_customersList" href="#_customersList">customersList</a>(<span class="php-keyword1">array</span> <span class="php-var">$filter</span> = <span class="php-keyword1">array</span>(), <span class="php-var">$page</span> = <span class="php-keyword1">null</span>, <span class="php-var">$limit</span> = <span class="php-keyword1">null</span>)
|
||||
</span><span id="289" class="l"><a class="l" href="#289">289 </a> {
|
||||
</span><span id="290" class="l"><a class="l" href="#290">290 </a> <span class="php-var">$parameters</span> = <span class="php-keyword1">array</span>();
|
||||
</span><span id="291" class="l"><a class="l" href="#291">291 </a>
|
||||
</span><span id="292" class="l"><a class="l" href="#292">292 </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">sizeof</span>(<span class="php-var">$filter</span>)) {
|
||||
</span><span id="293" class="l"><a class="l" href="#293">293 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'filter'</span>] = <span class="php-var">$filter</span>;
|
||||
</span><span id="294" class="l"><a class="l" href="#294">294 </a> }
|
||||
</span><span id="295" class="l"><a class="l" href="#295">295 </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">null</span> !== <span class="php-var">$page</span>) {
|
||||
</span><span id="296" class="l"><a class="l" href="#296">296 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'page'</span>] = (int) <span class="php-var">$page</span>;
|
||||
</span><span id="297" class="l"><a class="l" href="#297">297 </a> }
|
||||
</span><span id="298" class="l"><a class="l" href="#298">298 </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">null</span> !== <span class="php-var">$limit</span>) {
|
||||
</span><span id="299" class="l"><a class="l" href="#299">299 </a> <span class="php-var">$parameters</span>[<span class="php-quote">'limit'</span>] = (int) <span class="php-var">$limit</span>;
|
||||
</span><span id="300" class="l"><a class="l" href="#300">300 </a> }
|
||||
</span><span id="301" class="l"><a class="l" href="#301">301 </a>
|
||||
</span><span id="302" class="l"><a class="l" href="#302">302 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/customers'</span>, Client::METHOD_GET, <span class="php-var">$parameters</span>);
|
||||
</span><span id="303" class="l"><a class="l" href="#303">303 </a> }
|
||||
</span><span id="304" class="l"><a class="l" href="#304">304 </a>
|
||||
</span><span id="305" class="l"><a class="l" href="#305">305 </a> <span class="php-comment">/**
|
||||
</span></span><span id="306" class="l"><a class="l" href="#306">306 </a><span class="php-comment"> * Save customer IDs' (id and externalId) association in the CRM
|
||||
</span></span><span id="307" class="l"><a class="l" href="#307">307 </a><span class="php-comment"> *
|
||||
</span></span><span id="308" class="l"><a class="l" href="#308">308 </a><span class="php-comment"> * @param array $ids
|
||||
</span></span><span id="309" class="l"><a class="l" href="#309">309 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="310" class="l"><a class="l" href="#310">310 </a><span class="php-comment"> */</span>
|
||||
</span><span id="311" class="l"><a class="l" href="#311">311 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_customersFixExternalIds" href="#_customersFixExternalIds">customersFixExternalIds</a>(<span class="php-keyword1">array</span> <span class="php-var">$ids</span>)
|
||||
</span><span id="312" class="l"><a class="l" href="#312">312 </a> {
|
||||
</span><span id="313" class="l"><a class="l" href="#313">313 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">sizeof</span>(<span class="php-var">$ids</span>)) {
|
||||
</span><span id="314" class="l"><a class="l" href="#314">314 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Method parameter must contains at least one IDs pair'</span>);
|
||||
</span><span id="315" class="l"><a class="l" href="#315">315 </a> }
|
||||
</span><span id="316" class="l"><a class="l" href="#316">316 </a>
|
||||
</span><span id="317" class="l"><a class="l" href="#317">317 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">"/customers/fix-external-ids"</span>, Client::METHOD_POST, <span class="php-keyword1">array</span>(
|
||||
</span><span id="318" class="l"><a class="l" href="#318">318 </a> <span class="php-quote">'customers'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$ids</span>),
|
||||
</span><span id="319" class="l"><a class="l" href="#319">319 </a> ));
|
||||
</span><span id="320" class="l"><a class="l" href="#320">320 </a> }
|
||||
</span><span id="321" class="l"><a class="l" href="#321">321 </a>
|
||||
</span><span id="322" class="l"><a class="l" href="#322">322 </a> <span class="php-comment">/**
|
||||
</span></span><span id="323" class="l"><a class="l" href="#323">323 </a><span class="php-comment"> * Returns deliveryServices list
|
||||
</span></span><span id="324" class="l"><a class="l" href="#324">324 </a><span class="php-comment"> *
|
||||
</span></span><span id="325" class="l"><a class="l" href="#325">325 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="326" class="l"><a class="l" href="#326">326 </a><span class="php-comment"> */</span>
|
||||
</span><span id="327" class="l"><a class="l" href="#327">327 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_deliveryServicesList" href="#_deliveryServicesList">deliveryServicesList</a>()
|
||||
</span><span id="328" class="l"><a class="l" href="#328">328 </a> {
|
||||
</span><span id="329" class="l"><a class="l" href="#329">329 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/reference/delivery-services'</span>, Client::METHOD_GET);
|
||||
</span><span id="330" class="l"><a class="l" href="#330">330 </a> }
|
||||
</span><span id="331" class="l"><a class="l" href="#331">331 </a>
|
||||
</span><span id="332" class="l"><a class="l" href="#332">332 </a> <span class="php-comment">/**
|
||||
</span></span><span id="333" class="l"><a class="l" href="#333">333 </a><span class="php-comment"> * Returns deliveryTypes list
|
||||
</span></span><span id="334" class="l"><a class="l" href="#334">334 </a><span class="php-comment"> *
|
||||
</span></span><span id="335" class="l"><a class="l" href="#335">335 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="336" class="l"><a class="l" href="#336">336 </a><span class="php-comment"> */</span>
|
||||
</span><span id="337" class="l"><a class="l" href="#337">337 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_deliveryTypesList" href="#_deliveryTypesList">deliveryTypesList</a>()
|
||||
</span><span id="338" class="l"><a class="l" href="#338">338 </a> {
|
||||
</span><span id="339" class="l"><a class="l" href="#339">339 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/reference/delivery-types'</span>, Client::METHOD_GET);
|
||||
</span><span id="340" class="l"><a class="l" href="#340">340 </a> }
|
||||
</span><span id="341" class="l"><a class="l" href="#341">341 </a>
|
||||
</span><span id="342" class="l"><a class="l" href="#342">342 </a> <span class="php-comment">/**
|
||||
</span></span><span id="343" class="l"><a class="l" href="#343">343 </a><span class="php-comment"> * Returns orderMethods list
|
||||
</span></span><span id="344" class="l"><a class="l" href="#344">344 </a><span class="php-comment"> *
|
||||
</span></span><span id="345" class="l"><a class="l" href="#345">345 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="346" class="l"><a class="l" href="#346">346 </a><span class="php-comment"> */</span>
|
||||
</span><span id="347" class="l"><a class="l" href="#347">347 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_orderMethodsList" href="#_orderMethodsList">orderMethodsList</a>()
|
||||
</span><span id="348" class="l"><a class="l" href="#348">348 </a> {
|
||||
</span><span id="349" class="l"><a class="l" href="#349">349 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/reference/order-methods'</span>, Client::METHOD_GET);
|
||||
</span><span id="350" class="l"><a class="l" href="#350">350 </a> }
|
||||
</span><span id="351" class="l"><a class="l" href="#351">351 </a>
|
||||
</span><span id="352" class="l"><a class="l" href="#352">352 </a> <span class="php-comment">/**
|
||||
</span></span><span id="353" class="l"><a class="l" href="#353">353 </a><span class="php-comment"> * Returns orderTypes list
|
||||
</span></span><span id="354" class="l"><a class="l" href="#354">354 </a><span class="php-comment"> *
|
||||
</span></span><span id="355" class="l"><a class="l" href="#355">355 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="356" class="l"><a class="l" href="#356">356 </a><span class="php-comment"> */</span>
|
||||
</span><span id="357" class="l"><a class="l" href="#357">357 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_orderTypesList" href="#_orderTypesList">orderTypesList</a>()
|
||||
</span><span id="358" class="l"><a class="l" href="#358">358 </a> {
|
||||
</span><span id="359" class="l"><a class="l" href="#359">359 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/reference/order-types'</span>, Client::METHOD_GET);
|
||||
</span><span id="360" class="l"><a class="l" href="#360">360 </a> }
|
||||
</span><span id="361" class="l"><a class="l" href="#361">361 </a>
|
||||
</span><span id="362" class="l"><a class="l" href="#362">362 </a> <span class="php-comment">/**
|
||||
</span></span><span id="363" class="l"><a class="l" href="#363">363 </a><span class="php-comment"> * Returns paymentStatuses list
|
||||
</span></span><span id="364" class="l"><a class="l" href="#364">364 </a><span class="php-comment"> *
|
||||
</span></span><span id="365" class="l"><a class="l" href="#365">365 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="366" class="l"><a class="l" href="#366">366 </a><span class="php-comment"> */</span>
|
||||
</span><span id="367" class="l"><a class="l" href="#367">367 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_paymentStatusesList" href="#_paymentStatusesList">paymentStatusesList</a>()
|
||||
</span><span id="368" class="l"><a class="l" href="#368">368 </a> {
|
||||
</span><span id="369" class="l"><a class="l" href="#369">369 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/reference/payment-statuses'</span>, Client::METHOD_GET);
|
||||
</span><span id="370" class="l"><a class="l" href="#370">370 </a> }
|
||||
</span><span id="371" class="l"><a class="l" href="#371">371 </a>
|
||||
</span><span id="372" class="l"><a class="l" href="#372">372 </a> <span class="php-comment">/**
|
||||
</span></span><span id="373" class="l"><a class="l" href="#373">373 </a><span class="php-comment"> * Returns paymentTypes list
|
||||
</span></span><span id="374" class="l"><a class="l" href="#374">374 </a><span class="php-comment"> *
|
||||
</span></span><span id="375" class="l"><a class="l" href="#375">375 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="376" class="l"><a class="l" href="#376">376 </a><span class="php-comment"> */</span>
|
||||
</span><span id="377" class="l"><a class="l" href="#377">377 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_paymentTypesList" href="#_paymentTypesList">paymentTypesList</a>()
|
||||
</span><span id="378" class="l"><a class="l" href="#378">378 </a> {
|
||||
</span><span id="379" class="l"><a class="l" href="#379">379 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/reference/payment-types'</span>, Client::METHOD_GET);
|
||||
</span><span id="380" class="l"><a class="l" href="#380">380 </a> }
|
||||
</span><span id="381" class="l"><a class="l" href="#381">381 </a>
|
||||
</span><span id="382" class="l"><a class="l" href="#382">382 </a> <span class="php-comment">/**
|
||||
</span></span><span id="383" class="l"><a class="l" href="#383">383 </a><span class="php-comment"> * Returns productStatuses list
|
||||
</span></span><span id="384" class="l"><a class="l" href="#384">384 </a><span class="php-comment"> *
|
||||
</span></span><span id="385" class="l"><a class="l" href="#385">385 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="386" class="l"><a class="l" href="#386">386 </a><span class="php-comment"> */</span>
|
||||
</span><span id="387" class="l"><a class="l" href="#387">387 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_productStatusesList" href="#_productStatusesList">productStatusesList</a>()
|
||||
</span><span id="388" class="l"><a class="l" href="#388">388 </a> {
|
||||
</span><span id="389" class="l"><a class="l" href="#389">389 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/reference/product-statuses'</span>, Client::METHOD_GET);
|
||||
</span><span id="390" class="l"><a class="l" href="#390">390 </a> }
|
||||
</span><span id="391" class="l"><a class="l" href="#391">391 </a>
|
||||
</span><span id="392" class="l"><a class="l" href="#392">392 </a> <span class="php-comment">/**
|
||||
</span></span><span id="393" class="l"><a class="l" href="#393">393 </a><span class="php-comment"> * Returns statusGroups list
|
||||
</span></span><span id="394" class="l"><a class="l" href="#394">394 </a><span class="php-comment"> *
|
||||
</span></span><span id="395" class="l"><a class="l" href="#395">395 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="396" class="l"><a class="l" href="#396">396 </a><span class="php-comment"> */</span>
|
||||
</span><span id="397" class="l"><a class="l" href="#397">397 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_statusGroupsList" href="#_statusGroupsList">statusGroupsList</a>()
|
||||
</span><span id="398" class="l"><a class="l" href="#398">398 </a> {
|
||||
</span><span id="399" class="l"><a class="l" href="#399">399 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/reference/status-groups'</span>, Client::METHOD_GET);
|
||||
</span><span id="400" class="l"><a class="l" href="#400">400 </a> }
|
||||
</span><span id="401" class="l"><a class="l" href="#401">401 </a>
|
||||
</span><span id="402" class="l"><a class="l" href="#402">402 </a> <span class="php-comment">/**
|
||||
</span></span><span id="403" class="l"><a class="l" href="#403">403 </a><span class="php-comment"> * Returns statuses list
|
||||
</span></span><span id="404" class="l"><a class="l" href="#404">404 </a><span class="php-comment"> *
|
||||
</span></span><span id="405" class="l"><a class="l" href="#405">405 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="406" class="l"><a class="l" href="#406">406 </a><span class="php-comment"> */</span>
|
||||
</span><span id="407" class="l"><a class="l" href="#407">407 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_statusesList" href="#_statusesList">statusesList</a>()
|
||||
</span><span id="408" class="l"><a class="l" href="#408">408 </a> {
|
||||
</span><span id="409" class="l"><a class="l" href="#409">409 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/reference/statuses'</span>, Client::METHOD_GET);
|
||||
</span><span id="410" class="l"><a class="l" href="#410">410 </a> }
|
||||
</span><span id="411" class="l"><a class="l" href="#411">411 </a>
|
||||
</span><span id="412" class="l"><a class="l" href="#412">412 </a> <span class="php-comment">/**
|
||||
</span></span><span id="413" class="l"><a class="l" href="#413">413 </a><span class="php-comment"> * Edit deliveryService
|
||||
</span></span><span id="414" class="l"><a class="l" href="#414">414 </a><span class="php-comment"> *
|
||||
</span></span><span id="415" class="l"><a class="l" href="#415">415 </a><span class="php-comment"> * @param array $data delivery service data
|
||||
</span></span><span id="416" class="l"><a class="l" href="#416">416 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="417" class="l"><a class="l" href="#417">417 </a><span class="php-comment"> */</span>
|
||||
</span><span id="418" class="l"><a class="l" href="#418">418 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_deliveryServicesEdit" href="#_deliveryServicesEdit">deliveryServicesEdit</a>(<span class="php-keyword1">array</span> <span class="php-var">$data</span>)
|
||||
</span><span id="419" class="l"><a class="l" href="#419">419 </a> {
|
||||
</span><span id="420" class="l"><a class="l" href="#420">420 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$data</span>[<span class="php-quote">'code'</span>])) {
|
||||
</span><span id="421" class="l"><a class="l" href="#421">421 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Data must contain "code" parameter.'</span>);
|
||||
</span><span id="422" class="l"><a class="l" href="#422">422 </a> }
|
||||
</span><span id="423" class="l"><a class="l" href="#423">423 </a>
|
||||
</span><span id="424" class="l"><a class="l" href="#424">424 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(
|
||||
</span><span id="425" class="l"><a class="l" href="#425">425 </a> <span class="php-quote">'/reference/delivery-services/'</span> . <span class="php-var">$data</span>[<span class="php-quote">'code'</span>] . <span class="php-quote">'/edit'</span>,
|
||||
</span><span id="426" class="l"><a class="l" href="#426">426 </a> Client::METHOD_POST,
|
||||
</span><span id="427" class="l"><a class="l" href="#427">427 </a> <span class="php-keyword1">array</span>(
|
||||
</span><span id="428" class="l"><a class="l" href="#428">428 </a> <span class="php-quote">'deliveryService'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$data</span>)
|
||||
</span><span id="429" class="l"><a class="l" href="#429">429 </a> )
|
||||
</span><span id="430" class="l"><a class="l" href="#430">430 </a> );
|
||||
</span><span id="431" class="l"><a class="l" href="#431">431 </a> }
|
||||
</span><span id="432" class="l"><a class="l" href="#432">432 </a>
|
||||
</span><span id="433" class="l"><a class="l" href="#433">433 </a> <span class="php-comment">/**
|
||||
</span></span><span id="434" class="l"><a class="l" href="#434">434 </a><span class="php-comment"> * Edit deliveryType
|
||||
</span></span><span id="435" class="l"><a class="l" href="#435">435 </a><span class="php-comment"> *
|
||||
</span></span><span id="436" class="l"><a class="l" href="#436">436 </a><span class="php-comment"> * @param array $data delivery type data
|
||||
</span></span><span id="437" class="l"><a class="l" href="#437">437 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="438" class="l"><a class="l" href="#438">438 </a><span class="php-comment"> */</span>
|
||||
</span><span id="439" class="l"><a class="l" href="#439">439 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_deliveryTypesEdit" href="#_deliveryTypesEdit">deliveryTypesEdit</a>(<span class="php-keyword1">array</span> <span class="php-var">$data</span>)
|
||||
</span><span id="440" class="l"><a class="l" href="#440">440 </a> {
|
||||
</span><span id="441" class="l"><a class="l" href="#441">441 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$data</span>[<span class="php-quote">'code'</span>])) {
|
||||
</span><span id="442" class="l"><a class="l" href="#442">442 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Data must contain "code" parameter.'</span>);
|
||||
</span><span id="443" class="l"><a class="l" href="#443">443 </a> }
|
||||
</span><span id="444" class="l"><a class="l" href="#444">444 </a>
|
||||
</span><span id="445" class="l"><a class="l" href="#445">445 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(
|
||||
</span><span id="446" class="l"><a class="l" href="#446">446 </a> <span class="php-quote">'/reference/delivery-types/'</span> . <span class="php-var">$data</span>[<span class="php-quote">'code'</span>] . <span class="php-quote">'/edit'</span>,
|
||||
</span><span id="447" class="l"><a class="l" href="#447">447 </a> Client::METHOD_POST,
|
||||
</span><span id="448" class="l"><a class="l" href="#448">448 </a> <span class="php-keyword1">array</span>(
|
||||
</span><span id="449" class="l"><a class="l" href="#449">449 </a> <span class="php-quote">'deliveryType'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$data</span>)
|
||||
</span><span id="450" class="l"><a class="l" href="#450">450 </a> )
|
||||
</span><span id="451" class="l"><a class="l" href="#451">451 </a> );
|
||||
</span><span id="452" class="l"><a class="l" href="#452">452 </a> }
|
||||
</span><span id="453" class="l"><a class="l" href="#453">453 </a>
|
||||
</span><span id="454" class="l"><a class="l" href="#454">454 </a> <span class="php-comment">/**
|
||||
</span></span><span id="455" class="l"><a class="l" href="#455">455 </a><span class="php-comment"> * Edit orderMethod
|
||||
</span></span><span id="456" class="l"><a class="l" href="#456">456 </a><span class="php-comment"> *
|
||||
</span></span><span id="457" class="l"><a class="l" href="#457">457 </a><span class="php-comment"> * @param array $data order method data
|
||||
</span></span><span id="458" class="l"><a class="l" href="#458">458 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="459" class="l"><a class="l" href="#459">459 </a><span class="php-comment"> */</span>
|
||||
</span><span id="460" class="l"><a class="l" href="#460">460 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_orderMethodsEdit" href="#_orderMethodsEdit">orderMethodsEdit</a>(<span class="php-keyword1">array</span> <span class="php-var">$data</span>)
|
||||
</span><span id="461" class="l"><a class="l" href="#461">461 </a> {
|
||||
</span><span id="462" class="l"><a class="l" href="#462">462 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$data</span>[<span class="php-quote">'code'</span>])) {
|
||||
</span><span id="463" class="l"><a class="l" href="#463">463 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Data must contain "code" parameter.'</span>);
|
||||
</span><span id="464" class="l"><a class="l" href="#464">464 </a> }
|
||||
</span><span id="465" class="l"><a class="l" href="#465">465 </a>
|
||||
</span><span id="466" class="l"><a class="l" href="#466">466 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(
|
||||
</span><span id="467" class="l"><a class="l" href="#467">467 </a> <span class="php-quote">'/reference/order-methods/'</span> . <span class="php-var">$data</span>[<span class="php-quote">'code'</span>] . <span class="php-quote">'/edit'</span>,
|
||||
</span><span id="468" class="l"><a class="l" href="#468">468 </a> Client::METHOD_POST,
|
||||
</span><span id="469" class="l"><a class="l" href="#469">469 </a> <span class="php-keyword1">array</span>(
|
||||
</span><span id="470" class="l"><a class="l" href="#470">470 </a> <span class="php-quote">'orderMethod'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$data</span>)
|
||||
</span><span id="471" class="l"><a class="l" href="#471">471 </a> )
|
||||
</span><span id="472" class="l"><a class="l" href="#472">472 </a> );
|
||||
</span><span id="473" class="l"><a class="l" href="#473">473 </a> }
|
||||
</span><span id="474" class="l"><a class="l" href="#474">474 </a>
|
||||
</span><span id="475" class="l"><a class="l" href="#475">475 </a> <span class="php-comment">/**
|
||||
</span></span><span id="476" class="l"><a class="l" href="#476">476 </a><span class="php-comment"> * Edit orderType
|
||||
</span></span><span id="477" class="l"><a class="l" href="#477">477 </a><span class="php-comment"> *
|
||||
</span></span><span id="478" class="l"><a class="l" href="#478">478 </a><span class="php-comment"> * @param array $data order type data
|
||||
</span></span><span id="479" class="l"><a class="l" href="#479">479 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="480" class="l"><a class="l" href="#480">480 </a><span class="php-comment"> */</span>
|
||||
</span><span id="481" class="l"><a class="l" href="#481">481 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_orderTypesEdit" href="#_orderTypesEdit">orderTypesEdit</a>(<span class="php-keyword1">array</span> <span class="php-var">$data</span>)
|
||||
</span><span id="482" class="l"><a class="l" href="#482">482 </a> {
|
||||
</span><span id="483" class="l"><a class="l" href="#483">483 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$data</span>[<span class="php-quote">'code'</span>])) {
|
||||
</span><span id="484" class="l"><a class="l" href="#484">484 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Data must contain "code" parameter.'</span>);
|
||||
</span><span id="485" class="l"><a class="l" href="#485">485 </a> }
|
||||
</span><span id="486" class="l"><a class="l" href="#486">486 </a>
|
||||
</span><span id="487" class="l"><a class="l" href="#487">487 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(
|
||||
</span><span id="488" class="l"><a class="l" href="#488">488 </a> <span class="php-quote">'/reference/order-types/'</span> . <span class="php-var">$data</span>[<span class="php-quote">'code'</span>] . <span class="php-quote">'/edit'</span>,
|
||||
</span><span id="489" class="l"><a class="l" href="#489">489 </a> Client::METHOD_POST,
|
||||
</span><span id="490" class="l"><a class="l" href="#490">490 </a> <span class="php-keyword1">array</span>(
|
||||
</span><span id="491" class="l"><a class="l" href="#491">491 </a> <span class="php-quote">'orderType'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$data</span>)
|
||||
</span><span id="492" class="l"><a class="l" href="#492">492 </a> )
|
||||
</span><span id="493" class="l"><a class="l" href="#493">493 </a> );
|
||||
</span><span id="494" class="l"><a class="l" href="#494">494 </a> }
|
||||
</span><span id="495" class="l"><a class="l" href="#495">495 </a>
|
||||
</span><span id="496" class="l"><a class="l" href="#496">496 </a> <span class="php-comment">/**
|
||||
</span></span><span id="497" class="l"><a class="l" href="#497">497 </a><span class="php-comment"> * Edit paymentStatus
|
||||
</span></span><span id="498" class="l"><a class="l" href="#498">498 </a><span class="php-comment"> *
|
||||
</span></span><span id="499" class="l"><a class="l" href="#499">499 </a><span class="php-comment"> * @param array $data payment status data
|
||||
</span></span><span id="500" class="l"><a class="l" href="#500">500 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="501" class="l"><a class="l" href="#501">501 </a><span class="php-comment"> */</span>
|
||||
</span><span id="502" class="l"><a class="l" href="#502">502 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_paymentStatusesEdit" href="#_paymentStatusesEdit">paymentStatusesEdit</a>(<span class="php-keyword1">array</span> <span class="php-var">$data</span>)
|
||||
</span><span id="503" class="l"><a class="l" href="#503">503 </a> {
|
||||
</span><span id="504" class="l"><a class="l" href="#504">504 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$data</span>[<span class="php-quote">'code'</span>])) {
|
||||
</span><span id="505" class="l"><a class="l" href="#505">505 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Data must contain "code" parameter.'</span>);
|
||||
</span><span id="506" class="l"><a class="l" href="#506">506 </a> }
|
||||
</span><span id="507" class="l"><a class="l" href="#507">507 </a>
|
||||
</span><span id="508" class="l"><a class="l" href="#508">508 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(
|
||||
</span><span id="509" class="l"><a class="l" href="#509">509 </a> <span class="php-quote">'/reference/payment-statuses/'</span> . <span class="php-var">$data</span>[<span class="php-quote">'code'</span>] . <span class="php-quote">'/edit'</span>,
|
||||
</span><span id="510" class="l"><a class="l" href="#510">510 </a> Client::METHOD_POST,
|
||||
</span><span id="511" class="l"><a class="l" href="#511">511 </a> <span class="php-keyword1">array</span>(
|
||||
</span><span id="512" class="l"><a class="l" href="#512">512 </a> <span class="php-quote">'paymentStatus'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$data</span>)
|
||||
</span><span id="513" class="l"><a class="l" href="#513">513 </a> )
|
||||
</span><span id="514" class="l"><a class="l" href="#514">514 </a> );
|
||||
</span><span id="515" class="l"><a class="l" href="#515">515 </a> }
|
||||
</span><span id="516" class="l"><a class="l" href="#516">516 </a>
|
||||
</span><span id="517" class="l"><a class="l" href="#517">517 </a> <span class="php-comment">/**
|
||||
</span></span><span id="518" class="l"><a class="l" href="#518">518 </a><span class="php-comment"> * Edit paymentType
|
||||
</span></span><span id="519" class="l"><a class="l" href="#519">519 </a><span class="php-comment"> *
|
||||
</span></span><span id="520" class="l"><a class="l" href="#520">520 </a><span class="php-comment"> * @param array $data payment type data
|
||||
</span></span><span id="521" class="l"><a class="l" href="#521">521 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="522" class="l"><a class="l" href="#522">522 </a><span class="php-comment"> */</span>
|
||||
</span><span id="523" class="l"><a class="l" href="#523">523 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_paymentTypesEdit" href="#_paymentTypesEdit">paymentTypesEdit</a>(<span class="php-keyword1">array</span> <span class="php-var">$data</span>)
|
||||
</span><span id="524" class="l"><a class="l" href="#524">524 </a> {
|
||||
</span><span id="525" class="l"><a class="l" href="#525">525 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$data</span>[<span class="php-quote">'code'</span>])) {
|
||||
</span><span id="526" class="l"><a class="l" href="#526">526 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Data must contain "code" parameter.'</span>);
|
||||
</span><span id="527" class="l"><a class="l" href="#527">527 </a> }
|
||||
</span><span id="528" class="l"><a class="l" href="#528">528 </a>
|
||||
</span><span id="529" class="l"><a class="l" href="#529">529 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(
|
||||
</span><span id="530" class="l"><a class="l" href="#530">530 </a> <span class="php-quote">'/reference/payment-types/'</span> . <span class="php-var">$data</span>[<span class="php-quote">'code'</span>] . <span class="php-quote">'/edit'</span>,
|
||||
</span><span id="531" class="l"><a class="l" href="#531">531 </a> Client::METHOD_POST,
|
||||
</span><span id="532" class="l"><a class="l" href="#532">532 </a> <span class="php-keyword1">array</span>(
|
||||
</span><span id="533" class="l"><a class="l" href="#533">533 </a> <span class="php-quote">'paymentType'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$data</span>)
|
||||
</span><span id="534" class="l"><a class="l" href="#534">534 </a> )
|
||||
</span><span id="535" class="l"><a class="l" href="#535">535 </a> );
|
||||
</span><span id="536" class="l"><a class="l" href="#536">536 </a> }
|
||||
</span><span id="537" class="l"><a class="l" href="#537">537 </a>
|
||||
</span><span id="538" class="l"><a class="l" href="#538">538 </a> <span class="php-comment">/**
|
||||
</span></span><span id="539" class="l"><a class="l" href="#539">539 </a><span class="php-comment"> * Edit productStatus
|
||||
</span></span><span id="540" class="l"><a class="l" href="#540">540 </a><span class="php-comment"> *
|
||||
</span></span><span id="541" class="l"><a class="l" href="#541">541 </a><span class="php-comment"> * @param array $data product status data
|
||||
</span></span><span id="542" class="l"><a class="l" href="#542">542 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="543" class="l"><a class="l" href="#543">543 </a><span class="php-comment"> */</span>
|
||||
</span><span id="544" class="l"><a class="l" href="#544">544 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_productStatusesEdit" href="#_productStatusesEdit">productStatusesEdit</a>(<span class="php-keyword1">array</span> <span class="php-var">$data</span>)
|
||||
</span><span id="545" class="l"><a class="l" href="#545">545 </a> {
|
||||
</span><span id="546" class="l"><a class="l" href="#546">546 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$data</span>[<span class="php-quote">'code'</span>])) {
|
||||
</span><span id="547" class="l"><a class="l" href="#547">547 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Data must contain "code" parameter.'</span>);
|
||||
</span><span id="548" class="l"><a class="l" href="#548">548 </a> }
|
||||
</span><span id="549" class="l"><a class="l" href="#549">549 </a>
|
||||
</span><span id="550" class="l"><a class="l" href="#550">550 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(
|
||||
</span><span id="551" class="l"><a class="l" href="#551">551 </a> <span class="php-quote">'/reference/product-statuses/'</span> . <span class="php-var">$data</span>[<span class="php-quote">'code'</span>] . <span class="php-quote">'/edit'</span>,
|
||||
</span><span id="552" class="l"><a class="l" href="#552">552 </a> Client::METHOD_POST,
|
||||
</span><span id="553" class="l"><a class="l" href="#553">553 </a> <span class="php-keyword1">array</span>(
|
||||
</span><span id="554" class="l"><a class="l" href="#554">554 </a> <span class="php-quote">'productStatus'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$data</span>)
|
||||
</span><span id="555" class="l"><a class="l" href="#555">555 </a> )
|
||||
</span><span id="556" class="l"><a class="l" href="#556">556 </a> );
|
||||
</span><span id="557" class="l"><a class="l" href="#557">557 </a> }
|
||||
</span><span id="558" class="l"><a class="l" href="#558">558 </a>
|
||||
</span><span id="559" class="l"><a class="l" href="#559">559 </a> <span class="php-comment">/**
|
||||
</span></span><span id="560" class="l"><a class="l" href="#560">560 </a><span class="php-comment"> * Edit order status
|
||||
</span></span><span id="561" class="l"><a class="l" href="#561">561 </a><span class="php-comment"> *
|
||||
</span></span><span id="562" class="l"><a class="l" href="#562">562 </a><span class="php-comment"> * @param array $data status data
|
||||
</span></span><span id="563" class="l"><a class="l" href="#563">563 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="564" class="l"><a class="l" href="#564">564 </a><span class="php-comment"> */</span>
|
||||
</span><span id="565" class="l"><a class="l" href="#565">565 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_statusesEdit" href="#_statusesEdit">statusesEdit</a>(<span class="php-keyword1">array</span> <span class="php-var">$data</span>)
|
||||
</span><span id="566" class="l"><a class="l" href="#566">566 </a> {
|
||||
</span><span id="567" class="l"><a class="l" href="#567">567 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$data</span>[<span class="php-quote">'code'</span>])) {
|
||||
</span><span id="568" class="l"><a class="l" href="#568">568 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'Data must contain "code" parameter.'</span>);
|
||||
</span><span id="569" class="l"><a class="l" href="#569">569 </a> }
|
||||
</span><span id="570" class="l"><a class="l" href="#570">570 </a>
|
||||
</span><span id="571" class="l"><a class="l" href="#571">571 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(
|
||||
</span><span id="572" class="l"><a class="l" href="#572">572 </a> <span class="php-quote">'/reference/statuses/'</span> . <span class="php-var">$data</span>[<span class="php-quote">'code'</span>] . <span class="php-quote">'/edit'</span>,
|
||||
</span><span id="573" class="l"><a class="l" href="#573">573 </a> Client::METHOD_POST,
|
||||
</span><span id="574" class="l"><a class="l" href="#574">574 </a> <span class="php-keyword1">array</span>(
|
||||
</span><span id="575" class="l"><a class="l" href="#575">575 </a> <span class="php-quote">'status'</span> => <span class="php-keyword2">json_encode</span>(<span class="php-var">$data</span>)
|
||||
</span><span id="576" class="l"><a class="l" href="#576">576 </a> )
|
||||
</span><span id="577" class="l"><a class="l" href="#577">577 </a> );
|
||||
</span><span id="578" class="l"><a class="l" href="#578">578 </a> }
|
||||
</span><span id="579" class="l"><a class="l" href="#579">579 </a>
|
||||
</span><span id="580" class="l"><a class="l" href="#580">580 </a> <span class="php-comment">/**
|
||||
</span></span><span id="581" class="l"><a class="l" href="#581">581 </a><span class="php-comment"> * Update CRM basic statistic
|
||||
</span></span><span id="582" class="l"><a class="l" href="#582">582 </a><span class="php-comment"> *
|
||||
</span></span><span id="583" class="l"><a class="l" href="#583">583 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="584" class="l"><a class="l" href="#584">584 </a><span class="php-comment"> */</span>
|
||||
</span><span id="585" class="l"><a class="l" href="#585">585 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_statisticUpdate" href="#_statisticUpdate">statisticUpdate</a>()
|
||||
</span><span id="586" class="l"><a class="l" href="#586">586 </a> {
|
||||
</span><span id="587" class="l"><a class="l" href="#587">587 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->client->makeRequest(<span class="php-quote">'/statistic/update'</span>, Client::METHOD_GET);
|
||||
</span><span id="588" class="l"><a class="l" href="#588">588 </a> }
|
||||
</span><span id="589" class="l"><a class="l" href="#589">589 </a>
|
||||
</span><span id="590" class="l"><a class="l" href="#590">590 </a> <span class="php-comment">/**
|
||||
</span></span><span id="591" class="l"><a class="l" href="#591">591 </a><span class="php-comment"> * Check ID parameter
|
||||
</span></span><span id="592" class="l"><a class="l" href="#592">592 </a><span class="php-comment"> *
|
||||
</span></span><span id="593" class="l"><a class="l" href="#593">593 </a><span class="php-comment"> * @param string $by
|
||||
</span></span><span id="594" class="l"><a class="l" href="#594">594 </a><span class="php-comment"> * @return bool
|
||||
</span></span><span id="595" class="l"><a class="l" href="#595">595 </a><span class="php-comment"> */</span>
|
||||
</span><span id="596" class="l"><a class="l" href="#596">596 </a> <span class="php-keyword1">protected</span> <span class="php-keyword1">function</span> <a id="_checkIdParameter" href="#_checkIdParameter">checkIdParameter</a>(<span class="php-var">$by</span>)
|
||||
</span><span id="597" class="l"><a class="l" href="#597">597 </a> {
|
||||
</span><span id="598" class="l"><a class="l" href="#598">598 </a> <span class="php-var">$allowedForBy</span> = <span class="php-keyword1">array</span>(<span class="php-quote">'externalId'</span>, <span class="php-quote">'id'</span>);
|
||||
</span><span id="599" class="l"><a class="l" href="#599">599 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">in_array</span>(<span class="php-var">$by</span>, <span class="php-var">$allowedForBy</span>)) {
|
||||
</span><span id="600" class="l"><a class="l" href="#600">600 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-keyword2">sprintf</span>(
|
||||
</span><span id="601" class="l"><a class="l" href="#601">601 </a> <span class="php-quote">'Value "%s" for parameter "by" is not valid. Allowed values are %s.'</span>,
|
||||
</span><span id="602" class="l"><a class="l" href="#602">602 </a> <span class="php-var">$by</span>,
|
||||
</span><span id="603" class="l"><a class="l" href="#603">603 </a> <span class="php-keyword2">implode</span>(<span class="php-quote">', '</span>, <span class="php-var">$allowedForBy</span>)
|
||||
</span><span id="604" class="l"><a class="l" href="#604">604 </a> ));
|
||||
</span><span id="605" class="l"><a class="l" href="#605">605 </a> }
|
||||
</span><span id="606" class="l"><a class="l" href="#606">606 </a>
|
||||
</span><span id="607" class="l"><a class="l" href="#607">607 </a> <span class="php-keyword1">return</span> <span class="php-keyword1">true</span>;
|
||||
</span><span id="608" class="l"><a class="l" href="#608">608 </a> }
|
||||
</span><span id="609" class="l"><a class="l" href="#609">609 </a>}
|
||||
</span><span id="610" class="l"><a class="l" href="#610">610 </a></span></code></pre>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,117 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex">
|
||||
|
||||
<title>File RetailCrm/Exception/CurlException.php | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html" title="Summary of RetailCrm\Exception"><span>Namespace</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="class-RetailCrm.Exception.CurlException.html" title="Summary of RetailCrm\Exception\CurlException"><span>Class</span></a>
|
||||
</li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
|
||||
|
||||
|
||||
<h3>Exceptions</h3>
|
||||
<ul>
|
||||
<li class="active"><a href="class-RetailCrm.Exception.CurlException.html">CurlException</a></li>
|
||||
<li><a href="class-RetailCrm.Exception.InvalidJsonException.html">InvalidJsonException</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<pre id="source"><code><span id="1" class="l"><a class="l" href="#1">1 </a><span class="xlang"><?php</span>
|
||||
</span><span id="2" class="l"><a class="l" href="#2">2 </a>
|
||||
</span><span id="3" class="l"><a class="l" href="#3">3 </a><span class="php-keyword1">namespace</span> RetailCrm\Exception;
|
||||
</span><span id="4" class="l"><a class="l" href="#4">4 </a>
|
||||
</span><span id="5" class="l"><a class="l" href="#5">5 </a><span class="php-keyword1">class</span> <a id="CurlException" href="#CurlException">CurlException</a> <span class="php-keyword1">extends</span> \RuntimeException
|
||||
</span><span id="6" class="l"><a class="l" href="#6">6 </a>{
|
||||
</span><span id="7" class="l"><a class="l" href="#7">7 </a>}
|
||||
</span><span id="8" class="l"><a class="l" href="#8">8 </a></span></code></pre>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,117 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex">
|
||||
|
||||
<title>File RetailCrm/Exception/InvalidJsonException.php | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html" title="Summary of RetailCrm\Exception"><span>Namespace</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="class-RetailCrm.Exception.InvalidJsonException.html" title="Summary of RetailCrm\Exception\InvalidJsonException"><span>Class</span></a>
|
||||
</li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
|
||||
|
||||
|
||||
<h3>Exceptions</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.Exception.CurlException.html">CurlException</a></li>
|
||||
<li class="active"><a href="class-RetailCrm.Exception.InvalidJsonException.html">InvalidJsonException</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<pre id="source"><code><span id="1" class="l"><a class="l" href="#1">1 </a><span class="xlang"><?php</span>
|
||||
</span><span id="2" class="l"><a class="l" href="#2">2 </a>
|
||||
</span><span id="3" class="l"><a class="l" href="#3">3 </a><span class="php-keyword1">namespace</span> RetailCrm\Exception;
|
||||
</span><span id="4" class="l"><a class="l" href="#4">4 </a>
|
||||
</span><span id="5" class="l"><a class="l" href="#5">5 </a><span class="php-keyword1">class</span> <a id="InvalidJsonException" href="#InvalidJsonException">InvalidJsonException</a> <span class="php-keyword1">extends</span> \DomainException
|
||||
</span><span id="6" class="l"><a class="l" href="#6">6 </a>{
|
||||
</span><span id="7" class="l"><a class="l" href="#7">7 </a>}
|
||||
</span><span id="8" class="l"><a class="l" href="#8">8 </a></span></code></pre>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,191 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex">
|
||||
|
||||
<title>File RetailCrm/Http/Client.php | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html" title="Summary of RetailCrm\Http"><span>Namespace</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="class-RetailCrm.Http.Client.html" title="Summary of RetailCrm\Http\Client"><span>Class</span></a>
|
||||
</li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li class="active"><a href="class-RetailCrm.Http.Client.html">Client</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<pre id="source"><code><span id="1" class="l"><a class="l" href="#1"> 1 </a><span class="xlang"><?php</span>
|
||||
</span><span id="2" class="l"><a class="l" href="#2"> 2 </a>
|
||||
</span><span id="3" class="l"><a class="l" href="#3"> 3 </a><span class="php-keyword1">namespace</span> RetailCrm\Http;
|
||||
</span><span id="4" class="l"><a class="l" href="#4"> 4 </a>
|
||||
</span><span id="5" class="l"><a class="l" href="#5"> 5 </a><span class="php-keyword1">use</span> RetailCrm\Exception\CurlException;
|
||||
</span><span id="6" class="l"><a class="l" href="#6"> 6 </a><span class="php-keyword1">use</span> RetailCrm\Response\ApiResponse;
|
||||
</span><span id="7" class="l"><a class="l" href="#7"> 7 </a>
|
||||
</span><span id="8" class="l"><a class="l" href="#8"> 8 </a><span class="php-comment">/**
|
||||
</span></span><span id="9" class="l"><a class="l" href="#9"> 9 </a><span class="php-comment"> * HTTP client
|
||||
</span></span><span id="10" class="l"><a class="l" href="#10">10 </a><span class="php-comment"> */</span>
|
||||
</span><span id="11" class="l"><a class="l" href="#11">11 </a><span class="php-keyword1">class</span> <a id="Client" href="#Client">Client</a>
|
||||
</span><span id="12" class="l"><a class="l" href="#12">12 </a>{
|
||||
</span><span id="13" class="l"><a class="l" href="#13">13 </a> <span class="php-keyword1">const</span> <a id="METHOD_GET" href="#METHOD_GET">METHOD_GET</a> = <span class="php-quote">'GET'</span>;
|
||||
</span><span id="14" class="l"><a class="l" href="#14">14 </a> <span class="php-keyword1">const</span> <a id="METHOD_POST" href="#METHOD_POST">METHOD_POST</a> = <span class="php-quote">'POST'</span>;
|
||||
</span><span id="15" class="l"><a class="l" href="#15">15 </a>
|
||||
</span><span id="16" class="l"><a class="l" href="#16">16 </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$url" href="#$url">$url</a></span>;
|
||||
</span><span id="17" class="l"><a class="l" href="#17">17 </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$defaultParameters" href="#$defaultParameters">$defaultParameters</a></span>;
|
||||
</span><span id="18" class="l"><a class="l" href="#18">18 </a>
|
||||
</span><span id="19" class="l"><a class="l" href="#19">19 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>(<span class="php-var">$url</span>, <span class="php-keyword1">array</span> <span class="php-var">$defaultParameters</span> = <span class="php-keyword1">array</span>())
|
||||
</span><span id="20" class="l"><a class="l" href="#20">20 </a> {
|
||||
</span><span id="21" class="l"><a class="l" href="#21">21 </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">false</span> === <span class="php-keyword2">stripos</span>(<span class="php-var">$url</span>, <span class="php-quote">'https://'</span>)) {
|
||||
</span><span id="22" class="l"><a class="l" href="#22">22 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">'API schema requires HTTPS protocol'</span>);
|
||||
</span><span id="23" class="l"><a class="l" href="#23">23 </a> }
|
||||
</span><span id="24" class="l"><a class="l" href="#24">24 </a>
|
||||
</span><span id="25" class="l"><a class="l" href="#25">25 </a> <span class="php-var">$this</span>->url = <span class="php-var">$url</span>;
|
||||
</span><span id="26" class="l"><a class="l" href="#26">26 </a> <span class="php-var">$this</span>->defaultParameters = <span class="php-var">$defaultParameters</span>;
|
||||
</span><span id="27" class="l"><a class="l" href="#27">27 </a> }
|
||||
</span><span id="28" class="l"><a class="l" href="#28">28 </a>
|
||||
</span><span id="29" class="l"><a class="l" href="#29">29 </a> <span class="php-comment">/**
|
||||
</span></span><span id="30" class="l"><a class="l" href="#30">30 </a><span class="php-comment"> * Make HTTP request
|
||||
</span></span><span id="31" class="l"><a class="l" href="#31">31 </a><span class="php-comment"> *
|
||||
</span></span><span id="32" class="l"><a class="l" href="#32">32 </a><span class="php-comment"> * @param string $path
|
||||
</span></span><span id="33" class="l"><a class="l" href="#33">33 </a><span class="php-comment"> * @param string $method (default: 'GET')
|
||||
</span></span><span id="34" class="l"><a class="l" href="#34">34 </a><span class="php-comment"> * @param array $parameters (default: array())
|
||||
</span></span><span id="35" class="l"><a class="l" href="#35">35 </a><span class="php-comment"> * @param int $timeout
|
||||
</span></span><span id="36" class="l"><a class="l" href="#36">36 </a><span class="php-comment"> * @return ApiResponse
|
||||
</span></span><span id="37" class="l"><a class="l" href="#37">37 </a><span class="php-comment"> */</span>
|
||||
</span><span id="38" class="l"><a class="l" href="#38">38 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_makeRequest" href="#_makeRequest">makeRequest</a>(<span class="php-var">$path</span>, <span class="php-var">$method</span>, <span class="php-keyword1">array</span> <span class="php-var">$parameters</span> = <span class="php-keyword1">array</span>(), <span class="php-var">$timeout</span> = <span class="php-num">30</span>)
|
||||
</span><span id="39" class="l"><a class="l" href="#39">39 </a> {
|
||||
</span><span id="40" class="l"><a class="l" href="#40">40 </a> <span class="php-var">$allowedMethods</span> = <span class="php-keyword1">array</span>(self::METHOD_GET, self::METHOD_POST);
|
||||
</span><span id="41" class="l"><a class="l" href="#41">41 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">in_array</span>(<span class="php-var">$method</span>, <span class="php-var">$allowedMethods</span>)) {
|
||||
</span><span id="42" class="l"><a class="l" href="#42">42 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-keyword2">sprintf</span>(
|
||||
</span><span id="43" class="l"><a class="l" href="#43">43 </a> <span class="php-quote">'Method "%s" is not valid. Allowed methods are %s'</span>,
|
||||
</span><span id="44" class="l"><a class="l" href="#44">44 </a> <span class="php-var">$method</span>,
|
||||
</span><span id="45" class="l"><a class="l" href="#45">45 </a> <span class="php-keyword2">implode</span>(<span class="php-quote">', '</span>, <span class="php-var">$allowedMethods</span>)
|
||||
</span><span id="46" class="l"><a class="l" href="#46">46 </a> ));
|
||||
</span><span id="47" class="l"><a class="l" href="#47">47 </a> }
|
||||
</span><span id="48" class="l"><a class="l" href="#48">48 </a>
|
||||
</span><span id="49" class="l"><a class="l" href="#49">49 </a> <span class="php-var">$parameters</span> = <span class="php-keyword2">array_merge</span>(<span class="php-var">$this</span>->defaultParameters, <span class="php-var">$parameters</span>);
|
||||
</span><span id="50" class="l"><a class="l" href="#50">50 </a>
|
||||
</span><span id="51" class="l"><a class="l" href="#51">51 </a> <span class="php-var">$path</span> = <span class="php-var">$this</span>->url . <span class="php-var">$path</span>;
|
||||
</span><span id="52" class="l"><a class="l" href="#52">52 </a> <span class="php-keyword1">if</span> (self::METHOD_GET === <span class="php-var">$method</span> && <span class="php-keyword2">sizeof</span>(<span class="php-var">$parameters</span>)) {
|
||||
</span><span id="53" class="l"><a class="l" href="#53">53 </a> <span class="php-var">$path</span> .= <span class="php-quote">'?'</span> . <span class="php-keyword2">http_build_query</span>(<span class="php-var">$parameters</span>);
|
||||
</span><span id="54" class="l"><a class="l" href="#54">54 </a> }
|
||||
</span><span id="55" class="l"><a class="l" href="#55">55 </a>
|
||||
</span><span id="56" class="l"><a class="l" href="#56">56 </a> <span class="php-var">$ch</span> = <span class="php-keyword2">curl_init</span>();
|
||||
</span><span id="57" class="l"><a class="l" href="#57">57 </a> <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_URL, <span class="php-var">$path</span>);
|
||||
</span><span id="58" class="l"><a class="l" href="#58">58 </a> <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_FAILONERROR, <span class="php-keyword1">false</span>);
|
||||
</span><span id="59" class="l"><a class="l" href="#59">59 </a> <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_RETURNTRANSFER, <span class="php-num">1</span>); <span class="php-comment">// return into a variable</span>
|
||||
</span><span id="60" class="l"><a class="l" href="#60">60 </a> <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_TIMEOUT, (int) <span class="php-var">$timeout</span>); <span class="php-comment">// times out after 30s</span>
|
||||
</span><span id="61" class="l"><a class="l" href="#61">61 </a> <span class="php-comment">// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);</span>
|
||||
</span><span id="62" class="l"><a class="l" href="#62">62 </a> <span class="php-comment">// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects</span>
|
||||
</span><span id="63" class="l"><a class="l" href="#63">63 </a>
|
||||
</span><span id="64" class="l"><a class="l" href="#64">64 </a> <span class="php-keyword1">if</span> (self::METHOD_POST === <span class="php-var">$method</span>) {
|
||||
</span><span id="65" class="l"><a class="l" href="#65">65 </a> <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_POST, <span class="php-keyword1">true</span>);
|
||||
</span><span id="66" class="l"><a class="l" href="#66">66 </a> <span class="php-keyword2">curl_setopt</span>(<span class="php-var">$ch</span>, CURLOPT_POSTFIELDS, <span class="php-var">$parameters</span>);
|
||||
</span><span id="67" class="l"><a class="l" href="#67">67 </a> }
|
||||
</span><span id="68" class="l"><a class="l" href="#68">68 </a>
|
||||
</span><span id="69" class="l"><a class="l" href="#69">69 </a> <span class="php-var">$responseBody</span> = <span class="php-keyword2">curl_exec</span>(<span class="php-var">$ch</span>);
|
||||
</span><span id="70" class="l"><a class="l" href="#70">70 </a> <span class="php-var">$statusCode</span> = <span class="php-keyword2">curl_getinfo</span>(<span class="php-var">$ch</span>, CURLINFO_HTTP_CODE);
|
||||
</span><span id="71" class="l"><a class="l" href="#71">71 </a>
|
||||
</span><span id="72" class="l"><a class="l" href="#72">72 </a> <span class="php-var">$errno</span> = <span class="php-keyword2">curl_errno</span>(<span class="php-var">$ch</span>);
|
||||
</span><span id="73" class="l"><a class="l" href="#73">73 </a> <span class="php-var">$error</span> = <span class="php-keyword2">curl_error</span>(<span class="php-var">$ch</span>);
|
||||
</span><span id="74" class="l"><a class="l" href="#74">74 </a> <span class="php-keyword2">curl_close</span>(<span class="php-var">$ch</span>);
|
||||
</span><span id="75" class="l"><a class="l" href="#75">75 </a>
|
||||
</span><span id="76" class="l"><a class="l" href="#76">76 </a> <span class="php-keyword1">if</span> (<span class="php-var">$errno</span>) {
|
||||
</span><span id="77" class="l"><a class="l" href="#77">77 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> CurlException(<span class="php-var">$error</span>, <span class="php-var">$errno</span>);
|
||||
</span><span id="78" class="l"><a class="l" href="#78">78 </a> }
|
||||
</span><span id="79" class="l"><a class="l" href="#79">79 </a>
|
||||
</span><span id="80" class="l"><a class="l" href="#80">80 </a> <span class="php-keyword1">return</span> <span class="php-keyword1">new</span> ApiResponse(<span class="php-var">$statusCode</span>, <span class="php-var">$responseBody</span>);
|
||||
</span><span id="81" class="l"><a class="l" href="#81">81 </a> }
|
||||
</span><span id="82" class="l"><a class="l" href="#82">82 </a>}
|
||||
</span><span id="83" class="l"><a class="l" href="#83">83 </a></span></code></pre>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,236 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="robots" content="noindex">
|
||||
|
||||
<title>File RetailCrm/Response/ApiResponse.php | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html" title="Summary of RetailCrm\Response"><span>Namespace</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="class-RetailCrm.Response.ApiResponse.html" title="Summary of RetailCrm\Response\ApiResponse"><span>Class</span></a>
|
||||
</li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li class="active"><a href="class-RetailCrm.Response.ApiResponse.html">ApiResponse</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<pre id="source"><code><span id="1" class="l"><a class="l" href="#1"> 1 </a><span class="xlang"><?php</span>
|
||||
</span><span id="2" class="l"><a class="l" href="#2"> 2 </a>
|
||||
</span><span id="3" class="l"><a class="l" href="#3"> 3 </a><span class="php-keyword1">namespace</span> RetailCrm\Response;
|
||||
</span><span id="4" class="l"><a class="l" href="#4"> 4 </a>
|
||||
</span><span id="5" class="l"><a class="l" href="#5"> 5 </a><span class="php-keyword1">use</span> RetailCrm\Exception\InvalidJsonException;
|
||||
</span><span id="6" class="l"><a class="l" href="#6"> 6 </a>
|
||||
</span><span id="7" class="l"><a class="l" href="#7"> 7 </a><span class="php-comment">/**
|
||||
</span></span><span id="8" class="l"><a class="l" href="#8"> 8 </a><span class="php-comment"> * Response from retailCRM API
|
||||
</span></span><span id="9" class="l"><a class="l" href="#9"> 9 </a><span class="php-comment"> */</span>
|
||||
</span><span id="10" class="l"><a class="l" href="#10"> 10 </a><span class="php-keyword1">class</span> <a id="ApiResponse" href="#ApiResponse">ApiResponse</a> <span class="php-keyword1">implements</span> \ArrayAccess
|
||||
</span><span id="11" class="l"><a class="l" href="#11"> 11 </a>{
|
||||
</span><span id="12" class="l"><a class="l" href="#12"> 12 </a> <span class="php-comment">// HTTP response status code</span>
|
||||
</span><span id="13" class="l"><a class="l" href="#13"> 13 </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$statusCode" href="#$statusCode">$statusCode</a></span>;
|
||||
</span><span id="14" class="l"><a class="l" href="#14"> 14 </a>
|
||||
</span><span id="15" class="l"><a class="l" href="#15"> 15 </a> <span class="php-comment">// response assoc array</span>
|
||||
</span><span id="16" class="l"><a class="l" href="#16"> 16 </a> <span class="php-keyword1">protected</span> <span class="php-var"><a id="$response" href="#$response">$response</a></span>;
|
||||
</span><span id="17" class="l"><a class="l" href="#17"> 17 </a>
|
||||
</span><span id="18" class="l"><a class="l" href="#18"> 18 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___construct" href="#___construct">__construct</a>(<span class="php-var">$statusCode</span>, <span class="php-var">$responseBody</span> = <span class="php-keyword1">null</span>)
|
||||
</span><span id="19" class="l"><a class="l" href="#19"> 19 </a> {
|
||||
</span><span id="20" class="l"><a class="l" href="#20"> 20 </a> <span class="php-var">$this</span>->statusCode = (int) <span class="php-var">$statusCode</span>;
|
||||
</span><span id="21" class="l"><a class="l" href="#21"> 21 </a>
|
||||
</span><span id="22" class="l"><a class="l" href="#22"> 22 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">empty</span>(<span class="php-var">$responseBody</span>)) {
|
||||
</span><span id="23" class="l"><a class="l" href="#23"> 23 </a> <span class="php-var">$response</span> = <span class="php-keyword2">json_decode</span>(<span class="php-var">$responseBody</span>, <span class="php-keyword1">true</span>);
|
||||
</span><span id="24" class="l"><a class="l" href="#24"> 24 </a>
|
||||
</span><span id="25" class="l"><a class="l" href="#25"> 25 </a> <span class="php-keyword1">if</span> (!<span class="php-var">$response</span> && JSON_ERROR_NONE !== (<span class="php-var">$error</span> = <span class="php-keyword2">json_last_error</span>())) {
|
||||
</span><span id="26" class="l"><a class="l" href="#26"> 26 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> InvalidJsonException(
|
||||
</span><span id="27" class="l"><a class="l" href="#27"> 27 </a> <span class="php-quote">"Invalid JSON in the API response body. Error code #</span><span class="php-var">$error</span><span class="php-quote">"</span>,
|
||||
</span><span id="28" class="l"><a class="l" href="#28"> 28 </a> <span class="php-var">$error</span>
|
||||
</span><span id="29" class="l"><a class="l" href="#29"> 29 </a> );
|
||||
</span><span id="30" class="l"><a class="l" href="#30"> 30 </a> }
|
||||
</span><span id="31" class="l"><a class="l" href="#31"> 31 </a>
|
||||
</span><span id="32" class="l"><a class="l" href="#32"> 32 </a> <span class="php-var">$this</span>->response = <span class="php-var">$response</span>;
|
||||
</span><span id="33" class="l"><a class="l" href="#33"> 33 </a> }
|
||||
</span><span id="34" class="l"><a class="l" href="#34"> 34 </a> }
|
||||
</span><span id="35" class="l"><a class="l" href="#35"> 35 </a>
|
||||
</span><span id="36" class="l"><a class="l" href="#36"> 36 </a> <span class="php-comment">/**
|
||||
</span></span><span id="37" class="l"><a class="l" href="#37"> 37 </a><span class="php-comment"> * Return HTTP response status code
|
||||
</span></span><span id="38" class="l"><a class="l" href="#38"> 38 </a><span class="php-comment"> *
|
||||
</span></span><span id="39" class="l"><a class="l" href="#39"> 39 </a><span class="php-comment"> * @return int
|
||||
</span></span><span id="40" class="l"><a class="l" href="#40"> 40 </a><span class="php-comment"> */</span>
|
||||
</span><span id="41" class="l"><a class="l" href="#41"> 41 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_getStatusCode" href="#_getStatusCode">getStatusCode</a>()
|
||||
</span><span id="42" class="l"><a class="l" href="#42"> 42 </a> {
|
||||
</span><span id="43" class="l"><a class="l" href="#43"> 43 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->statusCode;
|
||||
</span><span id="44" class="l"><a class="l" href="#44"> 44 </a> }
|
||||
</span><span id="45" class="l"><a class="l" href="#45"> 45 </a>
|
||||
</span><span id="46" class="l"><a class="l" href="#46"> 46 </a> <span class="php-comment">/**
|
||||
</span></span><span id="47" class="l"><a class="l" href="#47"> 47 </a><span class="php-comment"> * HTTP request was successful
|
||||
</span></span><span id="48" class="l"><a class="l" href="#48"> 48 </a><span class="php-comment"> *
|
||||
</span></span><span id="49" class="l"><a class="l" href="#49"> 49 </a><span class="php-comment"> * @return bool
|
||||
</span></span><span id="50" class="l"><a class="l" href="#50"> 50 </a><span class="php-comment"> */</span>
|
||||
</span><span id="51" class="l"><a class="l" href="#51"> 51 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_isSuccessful" href="#_isSuccessful">isSuccessful</a>()
|
||||
</span><span id="52" class="l"><a class="l" href="#52"> 52 </a> {
|
||||
</span><span id="53" class="l"><a class="l" href="#53"> 53 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->statusCode < <span class="php-num">400</span>;
|
||||
</span><span id="54" class="l"><a class="l" href="#54"> 54 </a> }
|
||||
</span><span id="55" class="l"><a class="l" href="#55"> 55 </a>
|
||||
</span><span id="56" class="l"><a class="l" href="#56"> 56 </a> <span class="php-comment">/**
|
||||
</span></span><span id="57" class="l"><a class="l" href="#57"> 57 </a><span class="php-comment"> * Allow to access for the property throw class method
|
||||
</span></span><span id="58" class="l"><a class="l" href="#58"> 58 </a><span class="php-comment"> *
|
||||
</span></span><span id="59" class="l"><a class="l" href="#59"> 59 </a><span class="php-comment"> * @param string $name
|
||||
</span></span><span id="60" class="l"><a class="l" href="#60"> 60 </a><span class="php-comment"> * @return mixed
|
||||
</span></span><span id="61" class="l"><a class="l" href="#61"> 61 </a><span class="php-comment"> */</span>
|
||||
</span><span id="62" class="l"><a class="l" href="#62"> 62 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___call" href="#___call">__call</a>(<span class="php-var">$name</span>, <span class="php-var">$arguments</span>)
|
||||
</span><span id="63" class="l"><a class="l" href="#63"> 63 </a> {
|
||||
</span><span id="64" class="l"><a class="l" href="#64"> 64 </a> <span class="php-comment">// convert getSomeProperty to someProperty</span>
|
||||
</span><span id="65" class="l"><a class="l" href="#65"> 65 </a> <span class="php-var">$propertyName</span> = <span class="php-keyword2">strtolower</span>(<span class="php-keyword2">substr</span>(<span class="php-var">$name</span>, <span class="php-num">3</span>, <span class="php-num">1</span>)) . <span class="php-keyword2">substr</span>(<span class="php-var">$name</span>, <span class="php-num">4</span>);
|
||||
</span><span id="66" class="l"><a class="l" href="#66"> 66 </a>
|
||||
</span><span id="67" class="l"><a class="l" href="#67"> 67 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->response[<span class="php-var">$propertyName</span>])) {
|
||||
</span><span id="68" class="l"><a class="l" href="#68"> 68 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">"Method \"</span><span class="php-var">$name</span><span class="php-quote">\" not found"</span>);
|
||||
</span><span id="69" class="l"><a class="l" href="#69"> 69 </a> }
|
||||
</span><span id="70" class="l"><a class="l" href="#70"> 70 </a>
|
||||
</span><span id="71" class="l"><a class="l" href="#71"> 71 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->response[<span class="php-var">$propertyName</span>];
|
||||
</span><span id="72" class="l"><a class="l" href="#72"> 72 </a> }
|
||||
</span><span id="73" class="l"><a class="l" href="#73"> 73 </a>
|
||||
</span><span id="74" class="l"><a class="l" href="#74"> 74 </a> <span class="php-comment">/**
|
||||
</span></span><span id="75" class="l"><a class="l" href="#75"> 75 </a><span class="php-comment"> * Allow to access for the property throw object property
|
||||
</span></span><span id="76" class="l"><a class="l" href="#76"> 76 </a><span class="php-comment"> *
|
||||
</span></span><span id="77" class="l"><a class="l" href="#77"> 77 </a><span class="php-comment"> * @param string $name
|
||||
</span></span><span id="78" class="l"><a class="l" href="#78"> 78 </a><span class="php-comment"> * @return mixed
|
||||
</span></span><span id="79" class="l"><a class="l" href="#79"> 79 </a><span class="php-comment"> */</span>
|
||||
</span><span id="80" class="l"><a class="l" href="#80"> 80 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="___get" href="#___get">__get</a>(<span class="php-var">$name</span>)
|
||||
</span><span id="81" class="l"><a class="l" href="#81"> 81 </a> {
|
||||
</span><span id="82" class="l"><a class="l" href="#82"> 82 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->response[<span class="php-var">$name</span>])) {
|
||||
</span><span id="83" class="l"><a class="l" href="#83"> 83 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">"Property \"</span><span class="php-var">$name</span><span class="php-quote">\" not found"</span>);
|
||||
</span><span id="84" class="l"><a class="l" href="#84"> 84 </a> }
|
||||
</span><span id="85" class="l"><a class="l" href="#85"> 85 </a>
|
||||
</span><span id="86" class="l"><a class="l" href="#86"> 86 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->response[<span class="php-var">$name</span>];
|
||||
</span><span id="87" class="l"><a class="l" href="#87"> 87 </a> }
|
||||
</span><span id="88" class="l"><a class="l" href="#88"> 88 </a>
|
||||
</span><span id="89" class="l"><a class="l" href="#89"> 89 </a> <span class="php-comment">/**
|
||||
</span></span><span id="90" class="l"><a class="l" href="#90"> 90 </a><span class="php-comment"> * @param mixed $offset
|
||||
</span></span><span id="91" class="l"><a class="l" href="#91"> 91 </a><span class="php-comment"> * @param mixed $value
|
||||
</span></span><span id="92" class="l"><a class="l" href="#92"> 92 </a><span class="php-comment"> */</span>
|
||||
</span><span id="93" class="l"><a class="l" href="#93"> 93 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_offsetSet" href="#_offsetSet">offsetSet</a>(<span class="php-var">$offset</span>, <span class="php-var">$value</span>)
|
||||
</span><span id="94" class="l"><a class="l" href="#94"> 94 </a> {
|
||||
</span><span id="95" class="l"><a class="l" href="#95"> 95 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \BadMethodCallException(<span class="php-quote">'This activity not allowed'</span>);
|
||||
</span><span id="96" class="l"><a class="l" href="#96"> 96 </a> }
|
||||
</span><span id="97" class="l"><a class="l" href="#97"> 97 </a>
|
||||
</span><span id="98" class="l"><a class="l" href="#98"> 98 </a> <span class="php-comment">/**
|
||||
</span></span><span id="99" class="l"><a class="l" href="#99"> 99 </a><span class="php-comment"> * @param mixed $offset
|
||||
</span></span><span id="100" class="l"><a class="l" href="#100">100 </a><span class="php-comment"> */</span>
|
||||
</span><span id="101" class="l"><a class="l" href="#101">101 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_offsetUnset" href="#_offsetUnset">offsetUnset</a>(<span class="php-var">$offset</span>)
|
||||
</span><span id="102" class="l"><a class="l" href="#102">102 </a> {
|
||||
</span><span id="103" class="l"><a class="l" href="#103">103 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \BadMethodCallException(<span class="php-quote">'This call not allowed'</span>);
|
||||
</span><span id="104" class="l"><a class="l" href="#104">104 </a> }
|
||||
</span><span id="105" class="l"><a class="l" href="#105">105 </a>
|
||||
</span><span id="106" class="l"><a class="l" href="#106">106 </a> <span class="php-comment">/**
|
||||
</span></span><span id="107" class="l"><a class="l" href="#107">107 </a><span class="php-comment"> * @param mixed $offset
|
||||
</span></span><span id="108" class="l"><a class="l" href="#108">108 </a><span class="php-comment"> * @return bool
|
||||
</span></span><span id="109" class="l"><a class="l" href="#109">109 </a><span class="php-comment"> */</span>
|
||||
</span><span id="110" class="l"><a class="l" href="#110">110 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_offsetExists" href="#_offsetExists">offsetExists</a>(<span class="php-var">$offset</span>)
|
||||
</span><span id="111" class="l"><a class="l" href="#111">111 </a> {
|
||||
</span><span id="112" class="l"><a class="l" href="#112">112 </a> <span class="php-keyword1">return</span> <span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->response[<span class="php-var">$offset</span>]);
|
||||
</span><span id="113" class="l"><a class="l" href="#113">113 </a> }
|
||||
</span><span id="114" class="l"><a class="l" href="#114">114 </a>
|
||||
</span><span id="115" class="l"><a class="l" href="#115">115 </a> <span class="php-comment">/**
|
||||
</span></span><span id="116" class="l"><a class="l" href="#116">116 </a><span class="php-comment"> * @param mixed $offset
|
||||
</span></span><span id="117" class="l"><a class="l" href="#117">117 </a><span class="php-comment"> * @return mixed
|
||||
</span></span><span id="118" class="l"><a class="l" href="#118">118 </a><span class="php-comment"> */</span>
|
||||
</span><span id="119" class="l"><a class="l" href="#119">119 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> <a id="_offsetGet" href="#_offsetGet">offsetGet</a>(<span class="php-var">$offset</span>)
|
||||
</span><span id="120" class="l"><a class="l" href="#120">120 </a> {
|
||||
</span><span id="121" class="l"><a class="l" href="#121">121 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword1">isset</span>(<span class="php-var">$this</span>->response[<span class="php-var">$offset</span>])) {
|
||||
</span><span id="122" class="l"><a class="l" href="#122">122 </a> <span class="php-keyword1">throw</span> <span class="php-keyword1">new</span> \InvalidArgumentException(<span class="php-quote">"Property \"</span><span class="php-var">$offset</span><span class="php-quote">\" not found"</span>);
|
||||
</span><span id="123" class="l"><a class="l" href="#123">123 </a> }
|
||||
</span><span id="124" class="l"><a class="l" href="#124">124 </a>
|
||||
</span><span id="125" class="l"><a class="l" href="#125">125 </a> <span class="php-keyword1">return</span> <span class="php-var">$this</span>->response[<span class="php-var">$offset</span>];
|
||||
</span><span id="126" class="l"><a class="l" href="#126">126 </a> }
|
||||
</span><span id="127" class="l"><a class="l" href="#127">127 </a>}
|
||||
</span><span id="128" class="l"><a class="l" href="#128">128 </a></span></code></pre>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,123 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Todo | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<span>Namespace</span> </li>
|
||||
<li>
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li>
|
||||
<a href="tree.html" title="Tree view of classes, interfaces, traits and exceptions"><span>Tree</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<span>Todo</span> </li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.ApiClient.html">RetailCrm\ApiClient</a></li>
|
||||
<li><a href="class-RetailCrm.Http.Client.html">RetailCrm\Http\Client</a></li>
|
||||
<li><a href="class-RetailCrm.Response.ApiResponse.html">RetailCrm\Response\ApiResponse</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h3>Exceptions</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.Exception.CurlException.html">RetailCrm\Exception\CurlException</a></li>
|
||||
<li><a href="class-RetailCrm.Exception.InvalidJsonException.html">RetailCrm\Exception\InvalidJsonException</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content">
|
||||
<h1>Todo</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,191 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Tree | retailCRM PHP API client</title>
|
||||
|
||||
<link rel="stylesheet" href="resources/bootstrap.min.css?260161822">
|
||||
<link rel="stylesheet" href="resources/style.css?2608535020">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="navigation" class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a href="index.html" class="brand">retailCRM PHP API client</a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<span>Namespace</span> </li>
|
||||
<li>
|
||||
<span>Class</span> </li>
|
||||
|
||||
<li class="divider-vertical"></li>
|
||||
|
||||
<li class="active">
|
||||
<span>Tree</span> </li>
|
||||
<li>
|
||||
<a href="deprecated.html" title="List of deprecated elements"><span>Deprecated</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="todo.html" title="Todo list"><span>Todo</span></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="left">
|
||||
<div id="menu">
|
||||
<form id="search" class="form-search">
|
||||
<input type="hidden" name="cx" value="">
|
||||
<input type="hidden" name="ie" value="UTF-8">
|
||||
<input type="text" name="q" class="search-query" placeholder="Search">
|
||||
</form>
|
||||
|
||||
|
||||
<div id="groups">
|
||||
<h3>Namespaces</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.html">
|
||||
RetailCrm<span></span>
|
||||
</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Exception.html">
|
||||
Exception </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Http.html">
|
||||
Http </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="namespace-RetailCrm.Response.html">
|
||||
Response </a>
|
||||
</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="elements">
|
||||
<h3>Classes</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.ApiClient.html">RetailCrm\ApiClient</a></li>
|
||||
<li><a href="class-RetailCrm.Http.Client.html">RetailCrm\Http\Client</a></li>
|
||||
<li><a href="class-RetailCrm.Response.ApiResponse.html">RetailCrm\Response\ApiResponse</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h3>Exceptions</h3>
|
||||
<ul>
|
||||
<li><a href="class-RetailCrm.Exception.CurlException.html">RetailCrm\Exception\CurlException</a></li>
|
||||
<li><a href="class-RetailCrm.Exception.InvalidJsonException.html">RetailCrm\Exception\InvalidJsonException</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="splitter"></div>
|
||||
|
||||
<div id="right">
|
||||
<div id="rightInner">
|
||||
<div id="content">
|
||||
<h1>Tree</h1>
|
||||
|
||||
<h2>Classes</h2>
|
||||
<div class="tree">
|
||||
<ul>
|
||||
|
||||
<li><div class="notlast"><a href="class-RetailCrm.ApiClient.html"><span>RetailCrm\ApiClient</span></a>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li><div class="notlast"><a href="class-RetailCrm.Http.Client.html"><span>RetailCrm\Http\Client</span></a>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="last"><div class="last"><a href="class-RetailCrm.Response.ApiResponse.html"><span>RetailCrm\Response\ApiResponse</span></a>
|
||||
implements
|
||||
<span>ArrayAccess</span>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<h2>Exceptions</h2>
|
||||
<div class="tree">
|
||||
<ul>
|
||||
|
||||
<li class="last"><div class="last"><span>Exception</span>
|
||||
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
|
||||
<li><div class="notlast"><span>LogicException</span>
|
||||
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
|
||||
<li class="last"><div class="last"><span>DomainException</span>
|
||||
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
|
||||
<li class="last"><div class="last"><a href="class-RetailCrm.Exception.InvalidJsonException.html"><span>RetailCrm\Exception\InvalidJsonException</span></a>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</ul></li></ul></li>
|
||||
|
||||
<li class="last"><div class="last"><span>RuntimeException</span>
|
||||
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
|
||||
<li class="last"><div class="last"><a href="class-RetailCrm.Exception.CurlException.html"><span>RetailCrm\Exception\CurlException</span></a>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
</ul></li></ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
retailCRM PHP API client API documentation generated by <a href="http://apigen.org">ApiGen</a>
|
||||
</div>
|
||||
</div>
|
||||
<script src="resources/combined.js?371644040"></script>
|
||||
<script src="elementlist.js?1838453619"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,609 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace RetailCrm;
|
||||
|
||||
use RetailCrm\Http\Client;
|
||||
use RetailCrm\Response\ApiResponse;
|
||||
|
||||
/**
|
||||
* retailCRM API client class
|
||||
*/
|
||||
class ApiClient
|
||||
{
|
||||
const VERSION = 'v3';
|
||||
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* Client creating
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $apiKey
|
||||
* @return mixed
|
||||
*/
|
||||
public function __construct($url, $apiKey)
|
||||
{
|
||||
if ('/' != substr($url, strlen($url) - 1, 1)) {
|
||||
$url .= '/';
|
||||
}
|
||||
|
||||
$url = $url . 'api/' . self::VERSION;
|
||||
|
||||
$this->client = new Client($url, array('apiKey' => $apiKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a order
|
||||
*
|
||||
* @param array $order
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function ordersCreate(array $order)
|
||||
{
|
||||
if (!sizeof($order)) {
|
||||
throw new \InvalidArgumentException('Parameter `order` must contains a data');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest("/orders/create", Client::METHOD_POST, array(
|
||||
'order' => json_encode($order)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a order
|
||||
*
|
||||
* @param array $order
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function ordersEdit(array $order, $by = 'externalId')
|
||||
{
|
||||
if (!sizeof($order)) {
|
||||
throw new \InvalidArgumentException('Parameter `order` must contains a data');
|
||||
}
|
||||
|
||||
$this->checkIdParameter($by);
|
||||
|
||||
if (!isset($order[$by])) {
|
||||
throw new \InvalidArgumentException(sprintf('Order array must contain the "%s" parameter.', $by));
|
||||
}
|
||||
|
||||
return $this->client->makeRequest("/orders/" . $order[$by] . "/edit", Client::METHOD_POST, array(
|
||||
'order' => json_encode($order),
|
||||
'by' => $by,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload array of the orders
|
||||
*
|
||||
* @param array $orders
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function ordersUpload(array $orders)
|
||||
{
|
||||
if (!sizeof($orders)) {
|
||||
throw new \InvalidArgumentException('Parameter `orders` must contains array of the orders');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest("/orders/upload", Client::METHOD_POST, array(
|
||||
'orders' => json_encode($orders),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get order by id or externalId
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $by (default: 'externalId')
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function ordersGet($id, $by = 'externalId')
|
||||
{
|
||||
$this->checkIdParameter($by);
|
||||
|
||||
return $this->client->makeRequest("/orders/$id", Client::METHOD_GET, array('by' => $by));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a orders history
|
||||
*
|
||||
* @param \DateTime $startDate (default: null)
|
||||
* @param \DateTime $endDate (default: null)
|
||||
* @param int $limit (default: 100)
|
||||
* @param int $offset (default: 0)
|
||||
* @param bool $skipMyChanges (default: true)
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function ordersHistory(
|
||||
\DateTime $startDate = null,
|
||||
\DateTime $endDate = null,
|
||||
$limit = 100,
|
||||
$offset = 0,
|
||||
$skipMyChanges = true
|
||||
) {
|
||||
$parameters = array();
|
||||
|
||||
if ($startDate) {
|
||||
$parameters['startDate'] = $startDate->format('Y-m-d H:i:s');
|
||||
}
|
||||
if ($endDate) {
|
||||
$parameters['endDate'] = $endDate->format('Y-m-d H:i:s');
|
||||
}
|
||||
if ($limit) {
|
||||
$parameters['limit'] = (int) $limit;
|
||||
}
|
||||
if ($offset) {
|
||||
$parameters['offset'] = (int) $offset;
|
||||
}
|
||||
if ($skipMyChanges) {
|
||||
$parameters['skipMyChanges'] = (bool) $skipMyChanges;
|
||||
}
|
||||
|
||||
return $this->client->makeRequest('/orders/history', Client::METHOD_GET, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns filtered orders list
|
||||
*
|
||||
* @param array $filter (default: array())
|
||||
* @param int $page (default: null)
|
||||
* @param int $limit (default: null)
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function ordersList(array $filter = array(), $page = null, $limit = null)
|
||||
{
|
||||
$parameters = array();
|
||||
|
||||
if (sizeof($filter)) {
|
||||
$parameters['filter'] = $filter;
|
||||
}
|
||||
if (null !== $page) {
|
||||
$parameters['page'] = (int) $page;
|
||||
}
|
||||
if (null !== $limit) {
|
||||
$parameters['limit'] = (int) $limit;
|
||||
}
|
||||
|
||||
return $this->client->makeRequest('/orders', Client::METHOD_GET, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns statuses of the orders
|
||||
*
|
||||
* @param array $ids (default: array())
|
||||
* @param array $externalIds (default: array())
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function ordersStatuses(array $ids = array(), array $externalIds = array())
|
||||
{
|
||||
$parameters = array();
|
||||
|
||||
if (sizeof($ids)) {
|
||||
$parameters['ids'] = $ids;
|
||||
}
|
||||
if (sizeof($externalIds)) {
|
||||
$parameters['externalIds'] = $externalIds;
|
||||
}
|
||||
|
||||
return $this->client->makeRequest('/orders/statuses', Client::METHOD_GET, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save order IDs' (id and externalId) association in the CRM
|
||||
*
|
||||
* @param array $ids
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function ordersFixExternalIds(array $ids)
|
||||
{
|
||||
if (!sizeof($ids)) {
|
||||
throw new \InvalidArgumentException('Method parameter must contains at least one IDs pair');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest("/orders/fix-external-ids", Client::METHOD_POST, array(
|
||||
'orders' => json_encode($ids),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a customer
|
||||
*
|
||||
* @param array $customer
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function customersCreate(array $customer)
|
||||
{
|
||||
if (!sizeof($customer)) {
|
||||
throw new \InvalidArgumentException('Parameter `customer` must contains a data');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest("/customers/create", Client::METHOD_POST, array(
|
||||
'customer' => json_encode($customer)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a customer
|
||||
*
|
||||
* @param array $customer
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function customersEdit(array $customer, $by = 'externalId')
|
||||
{
|
||||
if (!sizeof($customer)) {
|
||||
throw new \InvalidArgumentException('Parameter `customer` must contains a data');
|
||||
}
|
||||
|
||||
$this->checkIdParameter($by);
|
||||
|
||||
if (!isset($customer[$by])) {
|
||||
throw new \InvalidArgumentException(sprintf('Customer array must contain the "%s" parameter.', $by));
|
||||
}
|
||||
|
||||
return $this->client->makeRequest("/customers/" . $customer[$by] . "/edit", Client::METHOD_POST, array(
|
||||
'customer' => json_encode($customer),
|
||||
'by' => $by,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload array of the customers
|
||||
*
|
||||
* @param array $customers
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function customersUpload(array $customers)
|
||||
{
|
||||
if (!sizeof($customers)) {
|
||||
throw new \InvalidArgumentException('Parameter `customers` must contains array of the customers');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest("/customers/upload", Client::METHOD_POST, array(
|
||||
'customers' => json_encode($customers),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get customer by id or externalId
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $by (default: 'externalId')
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function customersGet($id, $by = 'externalId')
|
||||
{
|
||||
$this->checkIdParameter($by);
|
||||
|
||||
return $this->client->makeRequest("/customers/$id", Client::METHOD_GET, array('by' => $by));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns filtered customers list
|
||||
*
|
||||
* @param array $filter (default: array())
|
||||
* @param int $page (default: null)
|
||||
* @param int $limit (default: null)
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function customersList(array $filter = array(), $page = null, $limit = null)
|
||||
{
|
||||
$parameters = array();
|
||||
|
||||
if (sizeof($filter)) {
|
||||
$parameters['filter'] = $filter;
|
||||
}
|
||||
if (null !== $page) {
|
||||
$parameters['page'] = (int) $page;
|
||||
}
|
||||
if (null !== $limit) {
|
||||
$parameters['limit'] = (int) $limit;
|
||||
}
|
||||
|
||||
return $this->client->makeRequest('/customers', Client::METHOD_GET, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save customer IDs' (id and externalId) association in the CRM
|
||||
*
|
||||
* @param array $ids
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function customersFixExternalIds(array $ids)
|
||||
{
|
||||
if (!sizeof($ids)) {
|
||||
throw new \InvalidArgumentException('Method parameter must contains at least one IDs pair');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest("/customers/fix-external-ids", Client::METHOD_POST, array(
|
||||
'customers' => json_encode($ids),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns deliveryServices list
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function deliveryServicesList()
|
||||
{
|
||||
return $this->client->makeRequest('/reference/delivery-services', Client::METHOD_GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns deliveryTypes list
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function deliveryTypesList()
|
||||
{
|
||||
return $this->client->makeRequest('/reference/delivery-types', Client::METHOD_GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns orderMethods list
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function orderMethodsList()
|
||||
{
|
||||
return $this->client->makeRequest('/reference/order-methods', Client::METHOD_GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns orderTypes list
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function orderTypesList()
|
||||
{
|
||||
return $this->client->makeRequest('/reference/order-types', Client::METHOD_GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns paymentStatuses list
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function paymentStatusesList()
|
||||
{
|
||||
return $this->client->makeRequest('/reference/payment-statuses', Client::METHOD_GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns paymentTypes list
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function paymentTypesList()
|
||||
{
|
||||
return $this->client->makeRequest('/reference/payment-types', Client::METHOD_GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns productStatuses list
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function productStatusesList()
|
||||
{
|
||||
return $this->client->makeRequest('/reference/product-statuses', Client::METHOD_GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns statusGroups list
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function statusGroupsList()
|
||||
{
|
||||
return $this->client->makeRequest('/reference/status-groups', Client::METHOD_GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns statuses list
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function statusesList()
|
||||
{
|
||||
return $this->client->makeRequest('/reference/statuses', Client::METHOD_GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit deliveryService
|
||||
*
|
||||
* @param array $data delivery service data
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function deliveryServicesEdit(array $data)
|
||||
{
|
||||
if (!isset($data['code'])) {
|
||||
throw new \InvalidArgumentException('Data must contain "code" parameter.');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
'/reference/delivery-services/' . $data['code'] . '/edit',
|
||||
Client::METHOD_POST,
|
||||
array(
|
||||
'deliveryService' => json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit deliveryType
|
||||
*
|
||||
* @param array $data delivery type data
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function deliveryTypesEdit(array $data)
|
||||
{
|
||||
if (!isset($data['code'])) {
|
||||
throw new \InvalidArgumentException('Data must contain "code" parameter.');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
'/reference/delivery-types/' . $data['code'] . '/edit',
|
||||
Client::METHOD_POST,
|
||||
array(
|
||||
'deliveryType' => json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit orderMethod
|
||||
*
|
||||
* @param array $data order method data
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function orderMethodsEdit(array $data)
|
||||
{
|
||||
if (!isset($data['code'])) {
|
||||
throw new \InvalidArgumentException('Data must contain "code" parameter.');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
'/reference/order-methods/' . $data['code'] . '/edit',
|
||||
Client::METHOD_POST,
|
||||
array(
|
||||
'orderMethod' => json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit orderType
|
||||
*
|
||||
* @param array $data order type data
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function orderTypesEdit(array $data)
|
||||
{
|
||||
if (!isset($data['code'])) {
|
||||
throw new \InvalidArgumentException('Data must contain "code" parameter.');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
'/reference/order-types/' . $data['code'] . '/edit',
|
||||
Client::METHOD_POST,
|
||||
array(
|
||||
'orderType' => json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit paymentStatus
|
||||
*
|
||||
* @param array $data payment status data
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function paymentStatusesEdit(array $data)
|
||||
{
|
||||
if (!isset($data['code'])) {
|
||||
throw new \InvalidArgumentException('Data must contain "code" parameter.');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
'/reference/payment-statuses/' . $data['code'] . '/edit',
|
||||
Client::METHOD_POST,
|
||||
array(
|
||||
'paymentStatus' => json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit paymentType
|
||||
*
|
||||
* @param array $data payment type data
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function paymentTypesEdit(array $data)
|
||||
{
|
||||
if (!isset($data['code'])) {
|
||||
throw new \InvalidArgumentException('Data must contain "code" parameter.');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
'/reference/payment-types/' . $data['code'] . '/edit',
|
||||
Client::METHOD_POST,
|
||||
array(
|
||||
'paymentType' => json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit productStatus
|
||||
*
|
||||
* @param array $data product status data
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function productStatusesEdit(array $data)
|
||||
{
|
||||
if (!isset($data['code'])) {
|
||||
throw new \InvalidArgumentException('Data must contain "code" parameter.');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
'/reference/product-statuses/' . $data['code'] . '/edit',
|
||||
Client::METHOD_POST,
|
||||
array(
|
||||
'productStatus' => json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit order status
|
||||
*
|
||||
* @param array $data status data
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function statusesEdit(array $data)
|
||||
{
|
||||
if (!isset($data['code'])) {
|
||||
throw new \InvalidArgumentException('Data must contain "code" parameter.');
|
||||
}
|
||||
|
||||
return $this->client->makeRequest(
|
||||
'/reference/statuses/' . $data['code'] . '/edit',
|
||||
Client::METHOD_POST,
|
||||
array(
|
||||
'status' => json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update CRM basic statistic
|
||||
*
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function statisticUpdate()
|
||||
{
|
||||
return $this->client->makeRequest('/statistic/update', Client::METHOD_GET);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check ID parameter
|
||||
*
|
||||
* @param string $by
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkIdParameter($by)
|
||||
{
|
||||
$allowedForBy = array('externalId', 'id');
|
||||
if (!in_array($by, $allowedForBy)) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'Value "%s" for parameter "by" is not valid. Allowed values are %s.',
|
||||
$by,
|
||||
implode(', ', $allowedForBy)
|
||||
));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace RetailCrm\Exception;
|
||||
|
||||
class CurlException extends \RuntimeException
|
||||
{
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace RetailCrm\Exception;
|
||||
|
||||
class InvalidJsonException extends \DomainException
|
||||
{
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace RetailCrm\Http;
|
||||
|
||||
use RetailCrm\Exception\CurlException;
|
||||
use RetailCrm\Response\ApiResponse;
|
||||
|
||||
/**
|
||||
* HTTP client
|
||||
*/
|
||||
class Client
|
||||
{
|
||||
const METHOD_GET = 'GET';
|
||||
const METHOD_POST = 'POST';
|
||||
|
||||
protected $url;
|
||||
protected $defaultParameters;
|
||||
|
||||
public function __construct($url, array $defaultParameters = array())
|
||||
{
|
||||
if (false === stripos($url, 'https://')) {
|
||||
throw new \InvalidArgumentException('API schema requires HTTPS protocol');
|
||||
}
|
||||
|
||||
$this->url = $url;
|
||||
$this->defaultParameters = $defaultParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make HTTP request
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $method (default: 'GET')
|
||||
* @param array $parameters (default: array())
|
||||
* @param int $timeout
|
||||
* @return ApiResponse
|
||||
*/
|
||||
public function makeRequest($path, $method, array $parameters = array(), $timeout = 30)
|
||||
{
|
||||
$allowedMethods = array(self::METHOD_GET, self::METHOD_POST);
|
||||
if (!in_array($method, $allowedMethods)) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'Method "%s" is not valid. Allowed methods are %s',
|
||||
$method,
|
||||
implode(', ', $allowedMethods)
|
||||
));
|
||||
}
|
||||
|
||||
$parameters = array_merge($this->defaultParameters, $parameters);
|
||||
|
||||
$path = $this->url . $path;
|
||||
if (self::METHOD_GET === $method && sizeof($parameters)) {
|
||||
$path .= '?' . http_build_query($parameters);
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $path);
|
||||
curl_setopt($ch, CURLOPT_FAILONERROR, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, (int) $timeout); // times out after 30s
|
||||
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
// curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects
|
||||
|
||||
if (self::METHOD_POST === $method) {
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
|
||||
}
|
||||
|
||||
$responseBody = curl_exec($ch);
|
||||
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
$errno = curl_errno($ch);
|
||||
$error = curl_error($ch);
|
||||
curl_close($ch);
|
||||
|
||||
if ($errno) {
|
||||
throw new CurlException($error, $errno);
|
||||
}
|
||||
|
||||
return new ApiResponse($statusCode, $responseBody);
|
||||
}
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace RetailCrm\Response;
|
||||
|
||||
use RetailCrm\Exception\InvalidJsonException;
|
||||
|
||||
/**
|
||||
* Response from retailCRM API
|
||||
*/
|
||||
class ApiResponse implements \ArrayAccess
|
||||
{
|
||||
// HTTP response status code
|
||||
protected $statusCode;
|
||||
|
||||
// response assoc array
|
||||
protected $response;
|
||||
|
||||
public function __construct($statusCode, $responseBody = null)
|
||||
{
|
||||
$this->statusCode = (int) $statusCode;
|
||||
|
||||
if (!empty($responseBody)) {
|
||||
$response = json_decode($responseBody, true);
|
||||
|
||||
if (!$response && JSON_ERROR_NONE !== ($error = json_last_error())) {
|
||||
throw new InvalidJsonException(
|
||||
"Invalid JSON in the API response body. Error code #$error",
|
||||
$error
|
||||
);
|
||||
}
|
||||
|
||||
$this->response = $response;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTTP response status code
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStatusCode()
|
||||
{
|
||||
return $this->statusCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* HTTP request was successful
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSuccessful()
|
||||
{
|
||||
return $this->statusCode < 400;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow to access for the property throw class method
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
// convert getSomeProperty to someProperty
|
||||
$propertyName = strtolower(substr($name, 3, 1)) . substr($name, 4);
|
||||
|
||||
if (!isset($this->response[$propertyName])) {
|
||||
throw new \InvalidArgumentException("Method \"$name\" not found");
|
||||
}
|
||||
|
||||
return $this->response[$propertyName];
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow to access for the property throw object property
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
if (!isset($this->response[$name])) {
|
||||
throw new \InvalidArgumentException("Property \"$name\" not found");
|
||||
}
|
||||
|
||||
return $this->response[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
throw new \BadMethodCallException('This activity not allowed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
throw new \BadMethodCallException('This call not allowed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->response[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
if (!isset($this->response[$offset])) {
|
||||
throw new \InvalidArgumentException("Property \"$offset\" not found");
|
||||
}
|
||||
|
||||
return $this->response[$offset];
|
||||
}
|
||||
}
|
0
models/.gitkeep
Normal file
17
phpcs.xml.dist
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
|
||||
<arg name="basepath" value="."/>
|
||||
<arg name="cache" value=".php_cs.cache"/>
|
||||
<arg name="colors"/>
|
||||
<arg name="extensions" value="php"/>
|
||||
|
||||
<rule ref="PSR12"/>
|
||||
|
||||
<file>src/</file>
|
||||
<file>tests/</file>
|
||||
|
||||
<exclude-pattern>src/Component/Serializer/Generator/*</exclude-pattern>
|
||||
<exclude-pattern>src/Component/Serializer/Parser/*</exclude-pattern>
|
||||
<exclude-pattern>src/Component/Serializer/ArraySupportDecorator.php</exclude-pattern>
|
||||
</ruleset>
|
21
phpdoc.dist.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<phpdocumentor
|
||||
configVersion="3"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://www.phpdoc.org"
|
||||
xsi:noNamespaceSchemaLocation="https://docs.phpdoc.org/latest/phpdoc.xsd"
|
||||
>
|
||||
<title>RetailCRM API Client</title>
|
||||
<paths>
|
||||
<output>docs/build/html</output>
|
||||
<cache>docs/build/cache</cache>
|
||||
</paths>
|
||||
<version number="latest">
|
||||
<api>
|
||||
<visibility>public</visibility>
|
||||
<source dsn=".">
|
||||
<path>src</path>
|
||||
</source>
|
||||
</api>
|
||||
</version>
|
||||
</phpdocumentor>
|
49
phpmd.xml
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ruleset name="Ruleset"
|
||||
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||
<description>Ruleset</description>
|
||||
<rule ref="rulesets/controversial.xml" />
|
||||
<rule ref="rulesets/unusedcode.xml" />
|
||||
|
||||
<rule ref="rulesets/design.xml">
|
||||
<exclude name="CouplingBetweenObjects" />
|
||||
</rule>
|
||||
<rule ref="rulesets/cleancode.xml">
|
||||
<exclude name="StaticAccess" />
|
||||
</rule>
|
||||
<rule ref="rulesets/codesize.xml">
|
||||
<exclude name="TooManyPublicMethods" />
|
||||
<exclude name="TooManyFields" />
|
||||
</rule>
|
||||
<rule ref="rulesets/naming.xml">
|
||||
<exclude name="ShortVariable" />
|
||||
</rule>
|
||||
|
||||
<rule ref="rulesets/naming.xml/ShortVariable">
|
||||
<properties>
|
||||
<property name="minimum" value="2" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="rulesets/codesize.xml/TooManyPublicMethods">
|
||||
<properties>
|
||||
<property name="maxmethods" value="20" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="rulesets/codesize.xml/TooManyFields">
|
||||
<properties>
|
||||
<property name="maxfields" value="30" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
|
||||
<properties>
|
||||
<property name="maximum" value="15" />
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<exclude-pattern>tests/*</exclude-pattern>
|
||||
<exclude-pattern>src/Component/Serializer/Generator/*</exclude-pattern>
|
||||
<exclude-pattern>src/Component/Serializer/Parser/*</exclude-pattern>
|
||||
</ruleset>
|
246
phpstan-baseline-serializer.neon
Normal file
|
@ -0,0 +1,246 @@
|
|||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$config of static method Liip\\\\Serializer\\\\Configuration\\\\GeneratorConfiguration\\:\\:createFomArray\\(\\) expects array\\{default_group_combinations\\?\\: array\\<int, array\\<int, string\\>\\>\\|null, default_versions\\?\\: array\\<int, string\\>\\|null, classes\\?\\: array\\<class\\-string, array\\<string, mixed\\>\\>\\|null, options\\?\\: array\\<string, mixed\\>\\}, array\\{default_group_combinations\\: array\\{\\}, default_versions\\: array\\{\\}, classes\\: non\\-empty\\-array\\<string, array\\{\\}\\>\\} given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/ModelsGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$classesToGenerate of class RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Generator\\\\DeserializerGenerator constructor expects array\\<int, class\\-string\\>, array\\<string\\> given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/ModelsGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$method of method Liip\\\\Serializer\\\\Template\\\\Deserialization\\:\\:renderSetter\\(\\) expects string, string\\|null given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Generator/DeserializerGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#4 \\$stack of method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Generator\\\\DeserializerGenerator\\:\\:generateCodeForClass\\(\\) expects array\\<string, int\\<1, max\\>\\>, array given\\.$#"
|
||||
count: 2
|
||||
path: src/Component/Serializer/Generator/DeserializerGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Generator\\\\SerializerGenerator\\:\\:buildSerializerFunctionName\\(\\) should return string but returns string\\|null\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Generator/SerializerGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$method of method Liip\\\\Serializer\\\\Template\\\\Serialization\\:\\:renderGetter\\(\\) expects string, string\\|null given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Generator/SerializerGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$serializerGroups of method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Generator\\\\SerializerGenerator\\:\\:generateCodeForClass\\(\\) expects array\\<int, string\\>, array given\\.$#"
|
||||
count: 4
|
||||
path: src/Component/Serializer/Generator/SerializerGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Class RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Lexer extends generic class Doctrine\\\\Common\\\\Lexer\\\\AbstractLexer but does not specify its types\\: T, V$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Lexer.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Lexer\\:\\:getType\\(\\) has parameter \\$value with no type specified\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Lexer.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Lexer\\:\\:parse\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Lexer.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$haystack of function stripos expects string, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Lexer.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$haystack of function strpos expects string, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Lexer.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Parser\\:\\:getConstant\\(\\) should return string but returns string\\|false\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Parser\\:\\:parse\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Parser\\:\\:parse\\(\\) should return array but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Parser\\:\\:visitArrayType\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Parser\\:\\:visitCompoundType\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Parser\\:\\:visitSimpleType\\(\\) never returns string so it can be removed from the return type\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\ParserInterface\\:\\:parse\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/ParserInterface.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSParser\\:\\:gatherClassAnnotations\\(\\) has parameter \\$reflectionClass with generic class ReflectionClass but does not specify its types\\: T$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSParser\\:\\:getMethodName\\(\\) has parameter \\$annotations with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSParser\\:\\:getProperty\\(\\) has parameter \\$annotations with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSParser\\:\\:getReturnType\\(\\) has parameter \\$reflClass with generic class ReflectionClass but does not specify its types\\: T$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSParser\\:\\:getSerializedName\\(\\) has parameter \\$annotations with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSParser\\:\\:isPostDeserializeMethod\\(\\) has parameter \\$annotations with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSParser\\:\\:isVirtualProperty\\(\\) has parameter \\$annotations with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSParser\\:\\:parseClass\\(\\) has parameter \\$reflClass with generic class ReflectionClass but does not specify its types\\: T$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSParser\\:\\:parseMethods\\(\\) has parameter \\$reflClass with generic class ReflectionClass but does not specify its types\\: T$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSParser\\:\\:parseProperties\\(\\) has parameter \\$reflClass with generic class ReflectionClass but does not specify its types\\: T$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSParser\\:\\:parsePropertyAnnotations\\(\\) has parameter \\$annotations with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\<T of object\\>\\|T of object, string given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Class Doctrine\\\\Common\\\\Collections\\\\ArrayCollection not found\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSTypeParser.php
|
||||
|
||||
-
|
||||
message: "#^Class Doctrine\\\\Common\\\\Collections\\\\Collection not found\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSTypeParser.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSTypeParser\\:\\:parseType\\(\\) has parameter \\$typeInfo with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSTypeParser.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#4 \\$traversableClass of class Liip\\\\MetadataParser\\\\Metadata\\\\PropertyTypeIterable constructor expects class\\-string\\<Traversable\\>\\|null, string\\|null given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSTypeParser.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access property \\$value on RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Token\\|null\\.$#"
|
||||
count: 2
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$string of function strlen expects string, int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$value of method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Parser\\:\\:getConstant\\(\\) expects int, int\\<min, 0\\>\\|int\\<4, 8\\>\\|int\\<11, max\\>\\|string\\|null given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$value of method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Parser\\:\\:getConstant\\(\\) expects int, int\\|string\\|null given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Parser\\:\\:\\$token with generic class RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Token does not specify its types\\: T, V$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Parser.php
|
||||
|
||||
-
|
||||
message: "#^Access to an undefined property object\\:\\:\\$position\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Token.php
|
||||
|
||||
-
|
||||
message: "#^Access to an undefined property object\\:\\:\\$type\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Token.php
|
||||
|
||||
-
|
||||
message: "#^Access to an undefined property object\\:\\:\\$value\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Token.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Token\\:\\:fromArray\\(\\) has parameter \\$source with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Token.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Token\\:\\:fromArray\\(\\) return type with generic class RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Token does not specify its types\\: T, V$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Token.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Token\\:\\:fromObject\\(\\) return type with generic class RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Token does not specify its types\\: T, V$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Token.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSCore\\\\Type\\\\Token\\<T of int\\|string,V of int\\|string\\>\\:\\:\\$type \\(\\(T of int\\|string\\)\\|null\\) does not accept int\\|string\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSCore/Type/Token.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method getParameters\\(\\) on ReflectionMethod\\|null\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSTypeParser.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\Parser\\\\JMSTypeParser\\:\\:\\$useArrayDateFormat has no type specified\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSTypeParser.php
|
329
phpstan-baseline.neon
Normal file
|
@ -0,0 +1,329 @@
|
|||
parameters:
|
||||
excludePaths:
|
||||
- src/Component/Serializer/ArraySupportDecorator.php
|
||||
ignoreErrors:
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Builder\\\\ClientBuilder\\:\\:buildHandlersChain\\(\\) through static\\:\\:\\.$#"
|
||||
count: 2
|
||||
path: src/Builder/ClientBuilder.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Builder\\\\FilesystemCacheBuilder\\:\\:getCacheDirPath\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Builder/FilesystemCacheBuilder.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Client\\:\\:getBaseUrl\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Client.php
|
||||
|
||||
-
|
||||
message: "#^Cannot assign new offset to array\\<string\\>\\|string\\.$#"
|
||||
count: 1
|
||||
path: src/Command/CompilerPromptCommand.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$array of function array_filter expects array, string given\\.$#"
|
||||
count: 1
|
||||
path: src/Command/CompilerPromptCommand.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$haystack of function in_array expects array, array\\<string\\>\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/Command/CompilerPromptCommand.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe access to private constant RetailCrm\\\\Api\\\\Command\\\\CompilerPromptCommand\\:\\:COMPILER_PLUGIN through static\\:\\:\\.$#"
|
||||
count: 3
|
||||
path: src/Command/CompilerPromptCommand.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Command\\\\CompilerPromptCommand\\:\\:activateAutoCompiler\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Command/CompilerPromptCommand.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Command\\\\CompilerPromptCommand\\:\\:activatePlugin\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Command/CompilerPromptCommand.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Command\\\\CompilerPromptCommand\\:\\:deactivateAutoCompiler\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Command/CompilerPromptCommand.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\ComposerLocator\\:\\:getBaseDirectory\\(\\) through static\\:\\:\\.$#"
|
||||
count: 2
|
||||
path: src/Component/ComposerLocator.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\ComposerLocator\\:\\:getPackageComposerJson\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/ComposerLocator.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Component\\\\FilesIteratorChecksumGenerator\\:\\:\\$fileNameAccessor \\(callable\\) on left side of \\?\\? is not nullable\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FilesIteratorChecksumGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Component\\\\FilesIteratorChecksumGenerator\\:\\:\\$hashFunc \\(callable\\) on left side of \\?\\? is not nullable\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FilesIteratorChecksumGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Component\\\\FilesIteratorChecksumGenerator\\:\\:\\$keyTransformer \\(callable\\) on left side of \\?\\? is not nullable\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FilesIteratorChecksumGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\FormData\\\\FormEncoder\\:\\:processPostSerialize\\(\\) should return array but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/FormEncoder.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$object of function get_class expects object, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/FormEncoder.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$object of method ReflectionMethod\\:\\:invokeArgs\\(\\) expects object\\|null, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/FormEncoder.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\<object\\>\\|object, class\\-string\\|false given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/FormEncoder.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$object of function get_class expects object, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/Strategy/Encode/EntityStrategy.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$object of method ReflectionProperty\\:\\:getValue\\(\\) expects object\\|null, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/Strategy/Encode/EntityStrategy.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\<object\\>\\|object, class\\-string\\|false given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/Strategy/Encode/EntityStrategy.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to float\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/Strategy/Encode/SimpleTypeStrategy.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/Strategy/Encode/SimpleTypeStrategy.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe access to private property RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\Encode\\\\TypedArrayStrategy\\:\\:\\$innerTypesMatcher through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/Strategy/Encode/TypedArrayStrategy.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\Encode\\\\TypedArrayStrategy\\:\\:getInnerTypes\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/Strategy/Encode/TypedArrayStrategy.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe access to private constant RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\StrategyFactory\\:\\:TYPED_MATCHER through static\\:\\:\\.$#"
|
||||
count: 2
|
||||
path: src/Component/FormData/Strategy/StrategyFactory.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe access to private property RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\StrategyFactory\\:\\:\\$simpleTypes through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/Strategy/StrategyFactory.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\StrategyFactory\\:\\:getArrayInnerTypes\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/Strategy/StrategyFactory.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\StrategyFactory\\:\\:getDateTimeFormat\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/Strategy/StrategyFactory.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\FormData\\\\Strategy\\\\StrategyFactory\\:\\:isDateTime\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/FormData/Strategy/StrategyFactory.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe access to private constant RetailCrm\\\\Api\\\\Component\\\\ModelsGenerator\\:\\:IGNORED_NAMESPACES through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/ModelsGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\ModelsGenerator\\:\\:createDir\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/ModelsGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\ModelsGenerator\\:\\:isNamespaceIgnored\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/ModelsGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Component\\\\PhpFilesIterator\\:\\:\\$parent \\(Iterator\\<int\\|string, array\\|string\\>\\) does not accept RegexIterator\\<mixed, mixed, Traversable\\<TKey, TValue\\>\\>\\.$#"
|
||||
count: 1
|
||||
path: src/Component/PhpFilesIterator.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Component\\\\PhpFilesIterator\\:\\:\\$parent type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Component/PhpFilesIterator.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe access to private constant RetailCrm\\\\Api\\\\Component\\\\PhpFilesIterator\\:\\:NAMESPACE_MATCHER through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/PhpFilesIterator.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:fromArray\\(\\) should return array\\<int\\|string, mixed\\>\\|object but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/ArraySupportDecorator.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:getArrayValueType\\(\\) should return string but returns array\\<string\\>\\.$#"
|
||||
count: 2
|
||||
path: src/Component/Serializer/ArraySupportDecorator.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$data of method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:decodeArray\\(\\) expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/ArraySupportDecorator.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:getArrayValueType\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/ArraySupportDecorator.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ArraySupportDecorator\\:\\:isArrayType\\(\\) through static\\:\\:\\.$#"
|
||||
count: 2
|
||||
path: src/Component/Serializer/ArraySupportDecorator.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ModelsChecksumGenerator\\:\\:getStoredChecksums\\(\\) should return array\\<string, string\\> but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/ModelsChecksumGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\Serializer\\\\ModelsChecksumGenerator\\:\\:getChecksumFileName\\(\\) through static\\:\\:\\.$#"
|
||||
count: 4
|
||||
path: src/Component/Serializer/ModelsChecksumGenerator.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$string2 of function strncmp expects string, class\\-string\\|false given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$annotation of static method Liip\\\\MetadataParser\\\\Exception\\\\ParseException\\:\\:unsupportedPropertyAnnotation\\(\\) expects string, class\\-string\\|false given\\.$#"
|
||||
count: 1
|
||||
path: src/Component/Serializer/Parser/JMSParser.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Component\\\\Transformer\\\\DateTimeTransformer\\:\\:createFromFormat\\(\\) through static\\:\\:\\.$#"
|
||||
count: 3
|
||||
path: src/Component/Transformer/DateTimeTransformer.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Event\\\\AbstractRequestEvent\\:\\:getApiKey\\(\\) should return string but returns array\\|string\\.$#"
|
||||
count: 1
|
||||
path: src/Event/AbstractRequestEvent.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Event\\\\AbstractRequestEvent\\:\\:\\$apiKey \\(string\\) does not accept array\\|string\\.$#"
|
||||
count: 1
|
||||
path: src/Event/AbstractRequestEvent.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Exception\\\\ApiException\\:\\:getErrorMessage\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Exception/ApiException.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Model\\\\Response\\\\ErrorResponse\\:\\:\\$errorMsg \\(string\\) on left side of \\?\\? is not nullable\\.$#"
|
||||
count: 2
|
||||
path: src/Factory/ApiExceptionFactory.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Model\\\\Response\\\\ErrorResponse\\:\\:\\$errors \\(array\\<string\\>\\) on left side of \\?\\? is not nullable\\.$#"
|
||||
count: 1
|
||||
path: src/Factory/ApiExceptionFactory.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe access to private property RetailCrm\\\\Api\\\\Handler\\\\Request\\\\PsrRequestHandler\\:\\:\\$methodsWithBody through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Handler/Request/PsrRequestHandler.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Request\\\\RequestDataHandler\\:\\:queryShouldBeUsed\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Handler/Request/RequestDataHandler.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Request\\\\RequestDataHandler\\:\\:throwEncodeException\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Handler/Request/RequestDataHandler.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\AbstractResponseHandler\\:\\:unmarshalBody\\(\\) should return RetailCrm\\\\Api\\\\Interfaces\\\\ResponseInterface but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Handler/Response/AbstractResponseHandler.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\AbstractResponseHandler\\:\\:unmarshalBody\\(\\) should return RetailCrm\\\\Api\\\\Interfaces\\\\ResponseInterface but returns object\\.$#"
|
||||
count: 1
|
||||
path: src/Handler/Response/AbstractResponseHandler.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\AbstractResponseHandler\\:\\:unmarshalBodyArray\\(\\) should return array\\<int\\|string, mixed\\> but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Handler/Response/AbstractResponseHandler.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\AbstractResponseHandler\\:\\:throwUnmarshalError\\(\\) through static\\:\\:\\.$#"
|
||||
count: 2
|
||||
path: src/Handler/Response/AbstractResponseHandler.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\AccountNotFoundHandler\\:\\:isContentType\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Handler/Response/AccountNotFoundHandler.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\FilesDownloadResponseHandler\\:\\:fileNameFromDisposition\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Handler/Response/FilesDownloadResponseHandler.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Handler\\\\Response\\\\FilesDownloadResponseHandler\\:\\:isFileRequest\\(\\) through static\\:\\:\\.$#"
|
||||
count: 1
|
||||
path: src/Handler/Response/FilesDownloadResponseHandler.php
|
||||
|
||||
-
|
||||
message: "#^Property RetailCrm\\\\Api\\\\Model\\\\ResponseData\\:\\:\\$responseArray \\(array\\<int\\|string, mixed\\>\\) on left side of \\?\\? is not nullable\\.$#"
|
||||
count: 1
|
||||
path: src/Handler/Response/UnmarshalResponseHandler.php
|
||||
|
||||
-
|
||||
message: "#^Unsafe call to private method RetailCrm\\\\Api\\\\Model\\\\Entity\\\\Delivery\\\\TimeInterval\\:\\:createTime\\(\\) through static\\:\\:\\.$#"
|
||||
count: 2
|
||||
path: src/Model/Entity/Delivery/TimeInterval.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Api\\\\ResourceGroup\\\\AbstractApiResourceGroup\\:\\:sendRequest\\(\\) should return RetailCrm\\\\Api\\\\Interfaces\\\\ResponseInterface but returns object\\.$#"
|
||||
count: 1
|
||||
path: src/ResourceGroup/AbstractApiResourceGroup.php
|
||||
|
9
phpstan.neon
Normal file
|
@ -0,0 +1,9 @@
|
|||
includes:
|
||||
- phpstan-baseline-serializer.neon
|
||||
- phpstan-baseline.neon # TODO: This should be removed eventually.
|
||||
|
||||
parameters:
|
||||
level: max
|
||||
paths:
|
||||
- src
|
||||
- tests
|
|
@ -1,21 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit bootstrap="./tests/bootstrap.php" colors="true">
|
||||
|
||||
<!-- Dummy values used to provide credentials. No need to change these. -->
|
||||
<php>
|
||||
<server name="CRM_URL" value="foo" />
|
||||
<server name="CRM_API_KEY" value="bar" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="RetailCrm">
|
||||
<directory>tests/RetailCrm/Tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">./src/RetailCrm</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="false"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
backupStaticAttributes="false"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="false"
|
||||
convertWarningsToExceptions="false"
|
||||
processIsolation="true"
|
||||
stopOnError="false"
|
||||
stopOnFailure="false"
|
||||
stopOnIncomplete="false"
|
||||
stopOnSkipped="false"
|
||||
stopOnRisky="false"
|
||||
>
|
||||
<coverage>
|
||||
<include>
|
||||
<directory>src</directory>
|
||||
<directory>dev</directory>
|
||||
</include>
|
||||
<report>
|
||||
<clover outputFile="coverage.xml"/>
|
||||
</report>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="Project Test Suite">
|
||||
<file>tests/src/Command/ClearModelsCommandTest.php</file>
|
||||
<file>tests/src/Command/GenerateModelsCommandTest.php</file>
|
||||
<file>tests/src/Command/VerifyModelsCommandTest.php</file>
|
||||
<directory>tests/src</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<logging>
|
||||
<junit outputFile="test-report.xml"/>
|
||||
</logging>
|
||||
<php>
|
||||
<ini name="memory_limit" value="4G" />
|
||||
</php>
|
||||
</phpunit>
|
||||
|
|
492
src/Builder/ClientBuilder.php
Normal file
|
@ -0,0 +1,492 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category ClientBuilder
|
||||
* @package RetailCrm\Api\Builder
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Api\Builder;
|
||||
|
||||
use Http\Discovery\Psr17FactoryDiscovery;
|
||||
use Http\Discovery\Psr18ClientDiscovery;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Psr\Http\Message\RequestFactoryInterface;
|
||||
use Psr\Http\Message\StreamFactoryInterface;
|
||||
use Psr\Http\Message\UriFactoryInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RetailCrm\Api\Client;
|
||||
use RetailCrm\Api\Component\Transformer\RequestTransformer;
|
||||
use RetailCrm\Api\Component\Transformer\ResponseTransformer;
|
||||
use RetailCrm\Api\Exception\Client\BuilderException;
|
||||
use RetailCrm\Api\Factory\ApiExceptionFactory;
|
||||
use RetailCrm\Api\Factory\RequestPipelineFactory;
|
||||
use RetailCrm\Api\Factory\ResponsePipelineFactory;
|
||||
use RetailCrm\Api\Interfaces\ApiExceptionFactoryAwareInterface;
|
||||
use RetailCrm\Api\Interfaces\BuilderInterface;
|
||||
use RetailCrm\Api\Interfaces\EventDispatcherAwareInterface;
|
||||
use RetailCrm\Api\Interfaces\FormEncoderInterface;
|
||||
use RetailCrm\Api\Interfaces\HandlerInterface;
|
||||
use RetailCrm\Api\Interfaces\PsrFactoriesAwareInterface;
|
||||
use RetailCrm\Api\Interfaces\RequestTransformerInterface;
|
||||
use RetailCrm\Api\Interfaces\ResponseTransformerInterface;
|
||||
use RetailCrm\Api\Interfaces\SerializerAwareInterface;
|
||||
use RetailCrm\Api\Traits\EventDispatcherAwareTrait;
|
||||
|
||||
/**
|
||||
* Class ClientBuilder
|
||||
*
|
||||
* @category ClientBuilder
|
||||
* @package RetailCrm\Api\Builder
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
|
||||
*/
|
||||
class ClientBuilder implements BuilderInterface, EventDispatcherAwareInterface
|
||||
{
|
||||
use EventDispatcherAwareTrait;
|
||||
|
||||
/** @var string */
|
||||
private $apiUrl;
|
||||
|
||||
/** @var HandlerInterface|null */
|
||||
private $authenticator;
|
||||
|
||||
/** @var ClientInterface|null */
|
||||
private $httpClient;
|
||||
|
||||
/** @var \Psr\Log\LoggerInterface|null */
|
||||
private $debugLogger;
|
||||
|
||||
/** @var RequestTransformerInterface|null */
|
||||
private $requestTransformer;
|
||||
|
||||
/** @var \RetailCrm\Api\Interfaces\ResponseTransformerInterface|null */
|
||||
protected $responseTransformer;
|
||||
|
||||
/** @var \RetailCrm\Api\Interfaces\FormEncoderInterface|null */
|
||||
private $formEncoder;
|
||||
|
||||
/** @var \Psr\Http\Message\StreamFactoryInterface|null */
|
||||
private $streamFactory;
|
||||
|
||||
/** @var \Psr\Http\Message\RequestFactoryInterface|null */
|
||||
private $requestFactory;
|
||||
|
||||
/** @var \Psr\Http\Message\UriFactoryInterface|null */
|
||||
private $uriFactory;
|
||||
|
||||
/** @var \RetailCrm\Api\Factory\ApiExceptionFactory|null */
|
||||
private $apiExceptionFactory;
|
||||
|
||||
/** @var \RetailCrm\Api\Interfaces\HandlerInterface[] */
|
||||
private $requestHandlers = [];
|
||||
|
||||
/** @var \RetailCrm\Api\Interfaces\HandlerInterface[] */
|
||||
private $responseHandlers = [];
|
||||
|
||||
/**
|
||||
* API URL. Looks like this: "https://test.retailcrm.pro/"
|
||||
*
|
||||
* @param string $apiUrl
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function setApiUrl(string $apiUrl): ClientBuilder
|
||||
{
|
||||
$this->apiUrl = $apiUrl;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request authenticator to append into request transformer pipeline.
|
||||
*
|
||||
* Do not use it if you already added a proper authenticator in the pipeline manually.
|
||||
* You can use this method to drop authenticator from client builder (use null).
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\HandlerInterface|null $authenticator
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function setAuthenticatorHandler(?HandlerInterface $authenticator): ClientBuilder
|
||||
{
|
||||
$this->authenticator = $authenticator;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set your PSR-18 HTTP client.
|
||||
*
|
||||
* Service discovery will be used if no client has been provided.
|
||||
*
|
||||
* @param \Psr\Http\Client\ClientInterface|null $httpClient
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function setHttpClient(?ClientInterface $httpClient): ClientBuilder
|
||||
{
|
||||
$this->httpClient = $httpClient;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set debug logger.
|
||||
*
|
||||
* The provided logger will be used to record all requests and responses.
|
||||
* This feature consumes a lot of resources and shouldn't be used in production.
|
||||
*
|
||||
* @param \Psr\Log\LoggerInterface|null $debugLogger
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function setDebugLogger(?LoggerInterface $debugLogger): ClientBuilder
|
||||
{
|
||||
$this->debugLogger = $debugLogger;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set request transformer into API client.
|
||||
*
|
||||
* You can use this method to set your request transformer which will execute the pipeline.
|
||||
* The default request transformer doesn't do anything besides calling provided chain of handlers.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\RequestTransformerInterface|null $requestTransformer
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function setRequestTransformer(?RequestTransformerInterface $requestTransformer): ClientBuilder
|
||||
{
|
||||
$this->requestTransformer = $requestTransformer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set response transformer into API client.
|
||||
*
|
||||
* You can use this method to set your response transformer which will execute the pipeline.
|
||||
* The default response transformer doesn't do anything besides calling provided chain of handlers.
|
||||
* The serializer instance for the request pipeline can be inferred from the provided FormEncoder instance.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\ResponseTransformerInterface|null $responseTransformer
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function setResponseTransformer(?ResponseTransformerInterface $responseTransformer): ClientBuilder
|
||||
{
|
||||
$this->responseTransformer = $responseTransformer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set form encoder into API client.
|
||||
*
|
||||
* Form encoder is a vital part of the API client. Its purpose is to transform provided request models
|
||||
* into form-data. The result will be used as a query or POST body (depends on request type).
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\FormEncoderInterface $formEncoder
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function setFormEncoder(FormEncoderInterface $formEncoder): ClientBuilder
|
||||
{
|
||||
$this->formEncoder = $formEncoder;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets PSR-17 compatible stream factory. You can skip this step if you want to use service discovery.
|
||||
*
|
||||
* @param \Psr\Http\Message\StreamFactoryInterface|null $streamFactory
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function setStreamFactory(?StreamFactoryInterface $streamFactory): ClientBuilder
|
||||
{
|
||||
$this->streamFactory = $streamFactory;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets PSR-17 compatible request factory. You can skip this step if you want to use service discovery.
|
||||
*
|
||||
* @param \Psr\Http\Message\RequestFactoryInterface|null $requestFactory
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function setRequestFactory(?RequestFactoryInterface $requestFactory): ClientBuilder
|
||||
{
|
||||
$this->requestFactory = $requestFactory;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets PSR-17 compatible URI factory. You can skip this step if you want to use service discovery.
|
||||
*
|
||||
* @param \Psr\Http\Message\UriFactoryInterface|null $uriFactory
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function setUriFactory(?UriFactoryInterface $uriFactory): ClientBuilder
|
||||
{
|
||||
$this->uriFactory = $uriFactory;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends an additional request handler into the request processing chain.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\HandlerInterface $handler
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function appendRequestHandler(HandlerInterface $handler): ClientBuilder
|
||||
{
|
||||
$this->requestHandlers[] = $handler;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends an additional response handler into the response processing chain.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\HandlerInterface $handler
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function appendResponseHandler(HandlerInterface $handler): ClientBuilder
|
||||
{
|
||||
$this->responseHandlers[] = $handler;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends additional request handlers into the request processing chain.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\HandlerInterface[] $handlers
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function appendRequestHandlers(array $handlers): ClientBuilder
|
||||
{
|
||||
foreach ($handlers as $handler) {
|
||||
$this->appendRequestHandler($handler);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends additional response handlers into the response processing chain.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\HandlerInterface[] $handlers
|
||||
*
|
||||
* @return ClientBuilder
|
||||
*/
|
||||
public function appendResponseHandlers(array $handlers): ClientBuilder
|
||||
{
|
||||
foreach ($handlers as $handler) {
|
||||
$this->appendResponseHandler($handler);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds client with provided dependencies.
|
||||
*
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function build(): Client
|
||||
{
|
||||
$this->validateBuilder();
|
||||
|
||||
if (
|
||||
null !== $this->authenticator &&
|
||||
null !== $this->requestTransformer &&
|
||||
null !== $this->requestTransformer->getHandler()
|
||||
) {
|
||||
$this->requestTransformer->getHandler()->append($this->authenticator);
|
||||
}
|
||||
|
||||
if (null === $this->requestTransformer) {
|
||||
$this->requestTransformer = $this->buildRequestTransformer();
|
||||
}
|
||||
|
||||
if (null === $this->responseTransformer) {
|
||||
$this->responseTransformer = $this->buildResponseTransformer();
|
||||
}
|
||||
|
||||
$this->appendAdditionalRequestHandlers();
|
||||
$this->appendAdditionalResponseHandlers();
|
||||
|
||||
return new Client(
|
||||
$this->apiUrl,
|
||||
$this->httpClient ?: Psr18ClientDiscovery::find(),
|
||||
$this->requestTransformer, // @phpstan-ignore-line
|
||||
$this->responseTransformer, // @phpstan-ignore-line
|
||||
$this->streamFactory ?: Psr17FactoryDiscovery::findStreamFactory(),
|
||||
$this->eventDispatcher,
|
||||
$this->debugLogger
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if builder is ready to build a Client instance.
|
||||
*
|
||||
* @throws \RetailCrm\Api\Exception\Client\BuilderException
|
||||
*/
|
||||
private function validateBuilder(): void
|
||||
{
|
||||
if (empty($this->apiUrl)) {
|
||||
throw new BuilderException('apiUrl must not be empty', ['apiUrl']);
|
||||
}
|
||||
|
||||
if (empty($this->authenticator) && empty($this->requestTransformer)) {
|
||||
throw new BuilderException(
|
||||
'Authenticator or RequestTransformer must be present',
|
||||
['authenticator', 'requestTransformer']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends additional request handlers into the request and response processor chain (if needed).
|
||||
*
|
||||
* @throws \RetailCrm\Api\Exception\Client\BuilderException
|
||||
*/
|
||||
private function appendAdditionalRequestHandlers(): void
|
||||
{
|
||||
if (
|
||||
null !== $this->requestTransformer &&
|
||||
null !== $this->requestTransformer->getHandler() &&
|
||||
count($this->requestHandlers) > 0
|
||||
) {
|
||||
foreach ($this->requestHandlers as $handler) {
|
||||
if ($handler instanceof PsrFactoriesAwareInterface) {
|
||||
$handler->setRequestFactory($this->requestFactory ?: Psr17FactoryDiscovery::findRequestFactory());
|
||||
$handler->setStreamFactory($this->streamFactory ?: Psr17FactoryDiscovery::findStreamFactory());
|
||||
$handler->setUriFactory($this->uriFactory ?: Psr17FactoryDiscovery::findUriFactory());
|
||||
}
|
||||
}
|
||||
|
||||
$this->requestTransformer->getHandler()->append(static::buildHandlersChain($this->requestHandlers));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends additional response handlers into the request and response processor chain (if needed).
|
||||
*
|
||||
* @throws \RetailCrm\Api\Exception\Client\BuilderException
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
private function appendAdditionalResponseHandlers(): void
|
||||
{
|
||||
if (
|
||||
null !== $this->responseTransformer &&
|
||||
null !== $this->responseTransformer->getHandler() &&
|
||||
count($this->responseHandlers) > 0
|
||||
) {
|
||||
foreach ($this->responseHandlers as $handler) {
|
||||
if ($handler instanceof SerializerAwareInterface && null !== $this->formEncoder) {
|
||||
$handler->setSerializer($this->formEncoder->getSerializer());
|
||||
}
|
||||
|
||||
if ($handler instanceof ApiExceptionFactoryAwareInterface && null !== $this->apiExceptionFactory) {
|
||||
$handler->setApiExceptionFactory($this->apiExceptionFactory);
|
||||
}
|
||||
|
||||
if ($handler instanceof EventDispatcherAwareInterface) {
|
||||
$handler->setEventDispatcher($this->eventDispatcher);
|
||||
}
|
||||
}
|
||||
|
||||
$this->responseTransformer->getHandler()->append(static::buildHandlersChain($this->responseHandlers));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds RequestTransformer with default pipeline and authenticator.
|
||||
*
|
||||
* @return \RetailCrm\Api\Component\Transformer\RequestTransformer
|
||||
* @throws \RetailCrm\Api\Exception\Client\BuilderException
|
||||
*/
|
||||
private function buildRequestTransformer(): RequestTransformer
|
||||
{
|
||||
if (null === $this->formEncoder) {
|
||||
throw new BuilderException(
|
||||
"You must provide a FormEncoder instance in order to delegate " .
|
||||
"RequestTransformer instantiation to the ClientBuilder."
|
||||
);
|
||||
}
|
||||
|
||||
if (null === $this->authenticator) {
|
||||
throw new BuilderException(
|
||||
"You must provide an authenticator handler instance in order to delegate " .
|
||||
"RequestTransformer instantiation to the ClientBuilder."
|
||||
);
|
||||
}
|
||||
|
||||
return new RequestTransformer(
|
||||
RequestPipelineFactory::createDefaultPipeline(
|
||||
$this->formEncoder,
|
||||
$this->uriFactory ?: Psr17FactoryDiscovery::findUriFactory(),
|
||||
$this->requestFactory ?: Psr17FactoryDiscovery::findRequestFactory(),
|
||||
$this->streamFactory ?: Psr17FactoryDiscovery::findStreamFactory(),
|
||||
$this->authenticator
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds ResponseTransformer.
|
||||
*
|
||||
* @return \RetailCrm\Api\Component\Transformer\ResponseTransformer
|
||||
* @throws \RetailCrm\Api\Exception\Client\BuilderException
|
||||
*/
|
||||
private function buildResponseTransformer(): ResponseTransformer
|
||||
{
|
||||
if (null === $this->formEncoder) {
|
||||
throw new BuilderException(
|
||||
"You must provide a FormEncoder instance in order to delegate " .
|
||||
"ResponseTransformer instantiation to the ClientBuilder."
|
||||
);
|
||||
}
|
||||
|
||||
if (null === $this->apiExceptionFactory) {
|
||||
$this->apiExceptionFactory = new ApiExceptionFactory();
|
||||
}
|
||||
|
||||
return new ResponseTransformer(ResponsePipelineFactory::createDefaultPipeline(
|
||||
$this->formEncoder->getSerializer(),
|
||||
$this->apiExceptionFactory,
|
||||
$this->eventDispatcher
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect all handlers in the array into chain, return first handler.
|
||||
*
|
||||
* @param HandlerInterface[] $handlers
|
||||
*
|
||||
* @return \RetailCrm\Api\Interfaces\HandlerInterface
|
||||
* @throws \RetailCrm\Api\Exception\Client\BuilderException
|
||||
*/
|
||||
private static function buildHandlersChain(array $handlers): HandlerInterface
|
||||
{
|
||||
if (empty($handlers)) {
|
||||
throw new BuilderException('Supplied handlers chain must contain at least one handler');
|
||||
}
|
||||
|
||||
if (1 === count($handlers)) {
|
||||
return $handlers[0];
|
||||
}
|
||||
|
||||
for ($i = 0, $iMax = count($handlers) - 1; $i < $iMax; $i++) {
|
||||
$handlers[$i]->setNext($handlers[$i + 1]);
|
||||
}
|
||||
|
||||
return $handlers[0];
|
||||
}
|
||||
}
|
89
src/Builder/FilesystemCacheBuilder.php
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category FilesystemCacheBuilder
|
||||
* @package RetailCrm\Api\Builder
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Api\Builder;
|
||||
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
|
||||
use RetailCrm\Api\Enum\CacheDirectories;
|
||||
use RetailCrm\Api\Exception\Client\BuilderException;
|
||||
use RetailCrm\Api\Interfaces\BuilderInterface;
|
||||
|
||||
/**
|
||||
* Class FilesystemCacheBuilder
|
||||
*
|
||||
* @category FilesystemCacheBuilder
|
||||
* @package RetailCrm\Api\Builder
|
||||
*/
|
||||
class FilesystemCacheBuilder implements BuilderInterface
|
||||
{
|
||||
/** @var string */
|
||||
private $cacheDir;
|
||||
|
||||
/**
|
||||
* @param string $cacheDir
|
||||
*
|
||||
* @return FilesystemCacheBuilder
|
||||
*/
|
||||
public function setCacheDir(string $cacheDir): FilesystemCacheBuilder
|
||||
{
|
||||
$this->cacheDir = $cacheDir;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds and returns filesystem cache.
|
||||
*
|
||||
* @return CacheItemPoolInterface
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function build(): CacheItemPoolInterface
|
||||
{
|
||||
if (empty($this->cacheDir)) {
|
||||
return new FilesystemAdapter(CacheDirectories::DIR_NAME);
|
||||
}
|
||||
|
||||
$cacheDir = static::getCacheDirPath($this->cacheDir);
|
||||
$this->createDir($cacheDir);
|
||||
|
||||
return new FilesystemAdapter('', 0, $cacheDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dir
|
||||
*
|
||||
* @throws \RetailCrm\Api\Exception\Client\BuilderException
|
||||
*/
|
||||
private function createDir(string $dir): void
|
||||
{
|
||||
if (is_dir($dir)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (false === mkdir($dir, 0777, true) && false === is_dir($dir)) {
|
||||
throw new BuilderException(sprintf('Could not create directory "%s".', $dir));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns target cache dir for cache.
|
||||
*
|
||||
* @param string $cacheDir
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getCacheDirPath(string $cacheDir): string
|
||||
{
|
||||
if ('' !== $cacheDir && DIRECTORY_SEPARATOR !== $cacheDir[strlen($cacheDir) - 1]) {
|
||||
$cacheDir .= DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
return $cacheDir . CacheDirectories::MAIN_DIR . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
}
|
148
src/Builder/FormEncoderBuilder.php
Normal file
|
@ -0,0 +1,148 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category FormEncoderBuilder
|
||||
* @package RetailCrm\Api\Builder
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Api\Builder;
|
||||
|
||||
use Doctrine\Common\Annotations\AnnotationReader;
|
||||
use Doctrine\Common\Annotations\PsrCachedReader;
|
||||
use Liip\Serializer\SerializerInterface;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use RetailCrm\Api\Component\FormData\FormEncoder;
|
||||
use RetailCrm\Api\Factory\SerializerFactory;
|
||||
use RetailCrm\Api\Interfaces\BuilderInterface;
|
||||
use RetailCrm\Api\Interfaces\FormEncoderInterface;
|
||||
|
||||
/**
|
||||
* Class FormEncoderBuilder
|
||||
*
|
||||
* @category FormEncoderBuilder
|
||||
* @package RetailCrm\Api\Builder
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*/
|
||||
class FormEncoderBuilder implements BuilderInterface
|
||||
{
|
||||
/** @var CacheItemPoolInterface|null */
|
||||
private $cache;
|
||||
|
||||
/** @var \Doctrine\Common\Annotations\Reader */
|
||||
private $annotationReader;
|
||||
|
||||
/** @var \RetailCrm\Api\Builder\FilesystemCacheBuilder */
|
||||
private $fsCacheBuilder;
|
||||
|
||||
/** @var \Liip\Serializer\SerializerInterface */
|
||||
private $serializer;
|
||||
|
||||
/**
|
||||
* FormEncoderBuilder constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->fsCacheBuilder = new FilesystemCacheBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets cache directory.
|
||||
*
|
||||
* This directory will be used by FormEncoder component and underlying serializer to store annotations cache.
|
||||
* Annotations parsing consumes a lot of resources, which is the reason why you should cache results.
|
||||
*
|
||||
* @param string $cacheDir
|
||||
*
|
||||
* @return FormEncoderBuilder
|
||||
*/
|
||||
public function setCacheDir(string $cacheDir): FormEncoderBuilder
|
||||
{
|
||||
$this->fsCacheBuilder->setCacheDir($cacheDir);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets cache implementation.
|
||||
*
|
||||
* This cache implementation will be used by FormEncoder component and underlying serializer to store
|
||||
* annotations cache. Any cache from `symfony/cache` should work just fine.
|
||||
*
|
||||
* @param \Psr\Cache\CacheItemPoolInterface $cache
|
||||
*
|
||||
* @return FormEncoderBuilder
|
||||
*/
|
||||
public function setCache(CacheItemPoolInterface $cache): FormEncoderBuilder
|
||||
{
|
||||
$this->cache = $cache;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets serializer implementation.
|
||||
*
|
||||
* This serializer implementation will be used by FormEncoder component.
|
||||
*
|
||||
* @param \Liip\Serializer\SerializerInterface $serializer
|
||||
*
|
||||
* @return FormEncoderBuilder
|
||||
*/
|
||||
public function setSerializer(SerializerInterface $serializer): FormEncoderBuilder
|
||||
{
|
||||
$this->serializer = $serializer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds FormEncoder.
|
||||
*
|
||||
* **Note:** Cache won't be set into provided serializer instance. It only works for instance built by
|
||||
* this builder. You must manually inject the proper cache into the custom JMS Serializer instance.
|
||||
*
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function build(): FormEncoderInterface
|
||||
{
|
||||
$this->buildCache();
|
||||
$this->buildAnnotationReader();
|
||||
$this->buildSerializer();
|
||||
|
||||
return new FormEncoder($this->serializer, $this->annotationReader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds cache if needed.
|
||||
*
|
||||
* @throws \RetailCrm\Api\Exception\Client\BuilderException
|
||||
*/
|
||||
private function buildCache(): void
|
||||
{
|
||||
if (null === $this->cache) {
|
||||
$this->cache = $this->fsCacheBuilder->build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds annotation reader.
|
||||
*/
|
||||
private function buildAnnotationReader(): void
|
||||
{
|
||||
$this->annotationReader = new AnnotationReader();
|
||||
|
||||
if (null !== $this->cache) {
|
||||
$this->annotationReader = new PsrCachedReader(new AnnotationReader(), $this->cache);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds serializer.
|
||||
*/
|
||||
private function buildSerializer(): void
|
||||
{
|
||||
if (null === $this->serializer) {
|
||||
$this->serializer = SerializerFactory::create();
|
||||
}
|
||||
}
|
||||
}
|
403
src/Client.php
Normal file
|
@ -0,0 +1,403 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category Client
|
||||
* @package RetailCrm\Api
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Api;
|
||||
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
use Psr\Http\Message\StreamFactoryInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RetailCrm\Api\Component\Utils;
|
||||
use RetailCrm\Api\Interfaces\RequestTransformerInterface;
|
||||
use RetailCrm\Api\Interfaces\ResponseTransformerInterface;
|
||||
use RetailCrm\Api\ResourceGroup\Api;
|
||||
use RetailCrm\Api\ResourceGroup\Costs;
|
||||
use RetailCrm\Api\ResourceGroup\CustomerInteraction;
|
||||
use RetailCrm\Api\ResourceGroup\Customers;
|
||||
use RetailCrm\Api\ResourceGroup\CustomersCorporate;
|
||||
use RetailCrm\Api\ResourceGroup\CustomFields;
|
||||
use RetailCrm\Api\ResourceGroup\CustomMethods;
|
||||
use RetailCrm\Api\ResourceGroup\Delivery;
|
||||
use RetailCrm\Api\ResourceGroup\Features;
|
||||
use RetailCrm\Api\ResourceGroup\Files;
|
||||
use RetailCrm\Api\ResourceGroup\Integration;
|
||||
use RetailCrm\Api\ResourceGroup\Inventories;
|
||||
use RetailCrm\Api\ResourceGroup\Loyalty;
|
||||
use RetailCrm\Api\ResourceGroup\Notifications;
|
||||
use RetailCrm\Api\ResourceGroup\Orders;
|
||||
use RetailCrm\Api\ResourceGroup\Packs;
|
||||
use RetailCrm\Api\ResourceGroup\Payments;
|
||||
use RetailCrm\Api\ResourceGroup\References;
|
||||
use RetailCrm\Api\ResourceGroup\Segments;
|
||||
use RetailCrm\Api\ResourceGroup\Settings;
|
||||
use RetailCrm\Api\ResourceGroup\Statistics;
|
||||
use RetailCrm\Api\ResourceGroup\Store;
|
||||
use RetailCrm\Api\ResourceGroup\Tasks;
|
||||
use RetailCrm\Api\ResourceGroup\Telephony;
|
||||
use RetailCrm\Api\ResourceGroup\Users;
|
||||
use RetailCrm\Api\ResourceGroup\Verification;
|
||||
use RetailCrm\Api\ResourceGroup\WebAnalytics;
|
||||
|
||||
/**
|
||||
* Class Client
|
||||
*
|
||||
* Do not instantiate API client directly! Use `ClientFactory`, `SimpleClientFactory` or `ClientBuilder`.
|
||||
*
|
||||
* @category Client
|
||||
* @package RetailCrm\Api
|
||||
* @see \RetailCrm\Api\Factory\ClientFactory
|
||||
* @see \RetailCrm\Api\Factory\SimpleClientFactory
|
||||
* @see \RetailCrm\Api\Builder\ClientBuilder
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*/
|
||||
class Client
|
||||
{
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Api */
|
||||
public $api;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Costs */
|
||||
public $costs;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\CustomFields */
|
||||
public $customFields;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\CustomerInteraction */
|
||||
public $customerInteraction;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Customers */
|
||||
public $customers;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\CustomersCorporate */
|
||||
public $customersCorporate;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Delivery */
|
||||
public $delivery;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Features */
|
||||
public $features;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Files */
|
||||
public $files;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Integration */
|
||||
public $integration;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Loyalty */
|
||||
public $loyalty;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Notifications */
|
||||
public $notifications;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Orders */
|
||||
public $orders;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Packs */
|
||||
public $packs;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Payments */
|
||||
public $payments;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\References */
|
||||
public $references;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Segments */
|
||||
public $segments;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Settings */
|
||||
public $settings;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Store */
|
||||
public $store;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Tasks */
|
||||
public $tasks;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Telephony */
|
||||
public $telephony;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Users */
|
||||
public $users;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Verification */
|
||||
public $verification;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\Statistics */
|
||||
public $statistics;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\CustomMethods */
|
||||
public $customMethods;
|
||||
|
||||
/** @var \RetailCrm\Api\ResourceGroup\WebAnalytics */
|
||||
public $webAnalytics;
|
||||
|
||||
/** @var StreamFactoryInterface */
|
||||
private $streamFactory;
|
||||
|
||||
/**
|
||||
* Client constructor.
|
||||
*
|
||||
* @param string $apiUrl
|
||||
* @param \Psr\Http\Client\ClientInterface $httpClient
|
||||
* @param \RetailCrm\Api\Interfaces\RequestTransformerInterface $requestTransformer
|
||||
* @param \RetailCrm\Api\Interfaces\ResponseTransformerInterface $responseTransformer
|
||||
* @param \Psr\Http\Message\StreamFactoryInterface $streamFactory
|
||||
* @param \Psr\EventDispatcher\EventDispatcherInterface|null $eventDispatcher
|
||||
* @param \Psr\Log\LoggerInterface|null $logger
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @todo Maybe initialize children groups using different method?
|
||||
*/
|
||||
public function __construct(
|
||||
string $apiUrl,
|
||||
ClientInterface $httpClient,
|
||||
RequestTransformerInterface $requestTransformer,
|
||||
ResponseTransformerInterface $responseTransformer,
|
||||
StreamFactoryInterface $streamFactory,
|
||||
?EventDispatcherInterface $eventDispatcher = null,
|
||||
?LoggerInterface $logger = null
|
||||
) {
|
||||
$url = static::getBaseUrl($apiUrl);
|
||||
|
||||
$this->streamFactory = $streamFactory;
|
||||
|
||||
$this->api = new Api(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->costs = new Costs(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->customFields = new CustomFields(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->customerInteraction = new CustomerInteraction(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->customers = new Customers(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->customersCorporate = new CustomersCorporate(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->delivery = new Delivery(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->features = new Features(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->files = new Files(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->integration = new Integration(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->loyalty = new Loyalty(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->notifications = new Notifications(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->orders = new Orders(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->packs = new Packs(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->payments = new Payments(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->references = new References(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->segments = new Segments(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->settings = new Settings(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->store = new Store(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->tasks = new Tasks(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->telephony = new Telephony(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->users = new Users(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->verification = new Verification(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->statistics = new Statistics(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->customMethods = new CustomMethods(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
$this->webAnalytics = new WebAnalytics(
|
||||
$url,
|
||||
$httpClient,
|
||||
$requestTransformer,
|
||||
$responseTransformer,
|
||||
$eventDispatcher,
|
||||
$logger
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns PSR-17 stream factory.
|
||||
*
|
||||
* StreamFactory can be used to create a PSR-7 StreamInterface from various sources.
|
||||
*
|
||||
* @return \Psr\Http\Message\StreamFactoryInterface
|
||||
*/
|
||||
public function getStreamFactory(): StreamFactoryInterface
|
||||
{
|
||||
return $this->streamFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses provided URL, builds API url with version out of it.
|
||||
*
|
||||
* @param string $url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getBaseUrl(string $url): string
|
||||
{
|
||||
return Utils::removeTrailingSlash($url) . '/api/v5';
|
||||
}
|
||||
}
|
54
src/Command/AbstractModelsProcessorCommand.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category AbstractModelsProcessorCommand
|
||||
* @package RetailCrm\Api\Command
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Api\Command;
|
||||
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Class AbstractModelsProcessorCommand
|
||||
*
|
||||
* @category AbstractModelsProcessorCommand
|
||||
* @package RetailCrm\Api\Command
|
||||
* @internal
|
||||
*/
|
||||
abstract class AbstractModelsProcessorCommand extends Command
|
||||
{
|
||||
/**
|
||||
* Returns true if "-v" was provided.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected static function isVerbose(OutputInterface $output): bool
|
||||
{
|
||||
return $output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create directory
|
||||
*
|
||||
* @param string $dir
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected static function createDir(string $dir): void
|
||||
{
|
||||
if (is_dir($dir)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (false === mkdir($dir, 0777, true) && false === is_dir($dir)) {
|
||||
throw new RuntimeException(sprintf('Could not create directory "%s".', $dir));
|
||||
}
|
||||
}
|
||||
}
|
86
src/Command/ClearModelsCommand.php
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category ClearModelsCommand
|
||||
* @package RetailCrm\Api\Command
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Api\Command;
|
||||
|
||||
use RetailCrm\Api\Component\Utils;
|
||||
use RetailCrm\Api\Component\PhpFilesIterator;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Class ClearModelsCommand
|
||||
*
|
||||
* @category ClearModelsCommand
|
||||
* @package RetailCrm\Api\Command
|
||||
* @internal
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
class ClearModelsCommand extends AbstractModelsProcessorCommand
|
||||
{
|
||||
/**
|
||||
* Sets description and help for a command.
|
||||
*/
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->setName('models:clear')
|
||||
->setDescription('Removes all generated models, leaves only empty directory behind.')
|
||||
->setHelp('Use this command if you want to remove existing model cache.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$target = Utils::getModelsCacheDirectory();
|
||||
|
||||
if (!is_dir($target)) {
|
||||
$output->writeln('<error>The target directory does not exist.</error>');
|
||||
$output->writeln('<info>You can safely use "bin/console models:generate" to generate models.</info>');
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
$output->writeln(sprintf('Cleaning up <fg=magenta>"%s"</>...', $target));
|
||||
|
||||
if (self::isVerbose($output)) {
|
||||
$output->writeln('');
|
||||
}
|
||||
|
||||
$checksumFile = implode(DIRECTORY_SEPARATOR, [$target, 'checksum.json']);
|
||||
$models = new PhpFilesIterator($target);
|
||||
|
||||
foreach ($models as $model) {
|
||||
if (file_exists($model['file'])) {
|
||||
unlink($model['file']);
|
||||
|
||||
if (self::isVerbose($output)) {
|
||||
$output->writeln(sprintf('- Removed <fg=magenta>"%s"</>', $model['file']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($checksumFile)) {
|
||||
unlink($checksumFile);
|
||||
}
|
||||
|
||||
if (self::isVerbose($output)) {
|
||||
$output->writeln('');
|
||||
}
|
||||
|
||||
$output->writeln('<fg=black;bg=green> ✓ Done!</>');
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
206
src/Command/CompilerPromptCommand.php
Normal file
|
@ -0,0 +1,206 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category CompilerPromptCommand
|
||||
* @package RetailCrm\Api\Command
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Api\Command;
|
||||
|
||||
use JsonException;
|
||||
use RetailCrm\Api\Component\ComposerLocator;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Class CompilerPromptCommand
|
||||
*
|
||||
* @category CompilerPromptCommand
|
||||
* @package RetailCrm\Api\Command
|
||||
*/
|
||||
class CompilerPromptCommand extends Command
|
||||
{
|
||||
private const PACKAGE_NAME = 'retailcrm/api-client-php';
|
||||
private const COMPILER_PLUGIN = 'civicrm/composer-compile-plugin';
|
||||
|
||||
/**
|
||||
* Sets description and help for a command.
|
||||
*/
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->setName('compiler:prompt')
|
||||
->setDescription('Enable or disable code generation during client installation & update.')
|
||||
->setHelp(
|
||||
'Use this command to enable or disable automatic code generation.'
|
||||
)->addOption(
|
||||
'revert',
|
||||
'r',
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'You will need to run ./vendor/bin/retailcrm-client models:generate -a after each update.',
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the command.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ElseExpression)
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$composerJson = ComposerLocator::findComposerJson();
|
||||
|
||||
if ('' === $composerJson) {
|
||||
$output->writeln('<fg=black;bg=red> ❌ Cannot find composer.json</>');
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
try {
|
||||
$json = json_decode((string) file_get_contents($composerJson), true, 512, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $exception) {
|
||||
$output->writeln(sprintf('<fg=black;bg=red> ❌ Invalid JSON: %s</>', $exception->getMessage()));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
$revert = false !== $input->getOption('revert');
|
||||
|
||||
if ($revert) {
|
||||
static::deactivateAutoCompiler($json);
|
||||
} else {
|
||||
static::activateAutoCompiler($json);
|
||||
static::activatePlugin($json);
|
||||
}
|
||||
|
||||
try {
|
||||
$result = json_encode($json, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||
} catch (JsonException $exception) {
|
||||
$output->writeln(sprintf('<fg=black;bg=red> ❌ Cannot encode JSON: %s</>', $exception->getMessage()));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (false === file_put_contents($composerJson, $result)) {
|
||||
$output->writeln('<fg=black;bg=red> ❌ Cannot write to file.</>');
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
$output->writeln(sprintf(
|
||||
'<fg=black;bg=green> ✓ Done, code generation has been %s.</>',
|
||||
$revert ? 'disabled' : 'enabled'
|
||||
));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate plugin in the provided composer.json
|
||||
*
|
||||
* @param array<string, array<string, array<string>|string>> $composerJson
|
||||
*/
|
||||
private static function activatePlugin(array &$composerJson): void
|
||||
{
|
||||
if (!array_key_exists('config', $composerJson)) {
|
||||
$composerJson['config'] = [
|
||||
'allow-plugins' => [
|
||||
static::COMPILER_PLUGIN => true
|
||||
]
|
||||
];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!array_key_exists('allow-plugins', $composerJson['config'])) {
|
||||
$composerJson['config']['allow-plugins'] = [
|
||||
static::COMPILER_PLUGIN => true
|
||||
];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$composerJson['config']['allow-plugins'][static::COMPILER_PLUGIN] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate auto compiler in the provided composer.json
|
||||
*
|
||||
* @param array<string, array<string, array<string>|string>> $composerJson
|
||||
*/
|
||||
private static function activateAutoCompiler(array &$composerJson): void
|
||||
{
|
||||
if (!array_key_exists('extra', $composerJson)) {
|
||||
$composerJson['extra'] = [
|
||||
'compile-mode' => 'whitelist',
|
||||
'compile-whitelist' => [self::PACKAGE_NAME]
|
||||
];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (array_key_exists('compile-mode', $composerJson['extra'])) {
|
||||
if (
|
||||
'prompt' === $composerJson['extra']['compile-mode'] ||
|
||||
'none' === $composerJson['extra']['compile-mode']
|
||||
) {
|
||||
$composerJson['extra']['compile-mode'] = 'whitelist';
|
||||
}
|
||||
|
||||
if ('all' === $composerJson['extra']['compile-mode']) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$composerJson['extra']['compile-mode'] = 'whitelist';
|
||||
|
||||
if (!array_key_exists('compile-whitelist', $composerJson['extra'])) {
|
||||
$composerJson['extra']['compile-whitelist'] = [self::PACKAGE_NAME];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!in_array(self::PACKAGE_NAME, $composerJson['extra']['compile-whitelist'])) {
|
||||
$composerJson['extra']['compile-whitelist'][] = self::PACKAGE_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivate prompt in the provided composer.json
|
||||
*
|
||||
* @param array<string, array<string>> $composerJson
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ElseExpression)
|
||||
*/
|
||||
private static function deactivateAutoCompiler(array &$composerJson): void
|
||||
{
|
||||
if (!array_key_exists('extra', $composerJson)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
array_key_exists('compile-whitelist', $composerJson['extra']) &&
|
||||
null !== $composerJson['extra']['compile-whitelist']
|
||||
) {
|
||||
$composerJson['extra']['compile-whitelist'] = array_filter(
|
||||
$composerJson['extra']['compile-whitelist'],
|
||||
static function (string $item) {
|
||||
return $item !== self::PACKAGE_NAME;
|
||||
}
|
||||
);
|
||||
|
||||
if (0 === count($composerJson['extra']['compile-whitelist'])) {
|
||||
unset($composerJson['extra']['compile-whitelist']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
103
src/Command/GenerateModelsCommand.php
Normal file
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category GenerateModelsCommand
|
||||
* @package RetailCrm\Api\Command
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Api\Command;
|
||||
|
||||
use RetailCrm\Api\Component\ModelsGenerator;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
/**
|
||||
* Class GenerateModelsCommand
|
||||
*
|
||||
* @category GenerateModelsCommand
|
||||
* @package RetailCrm\Api\Command
|
||||
* @internal
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*
|
||||
* @see There is no need to refactor generator into separate service. Its logic won't be used anywhere else.
|
||||
*/
|
||||
class GenerateModelsCommand extends AbstractModelsProcessorCommand
|
||||
{
|
||||
/**
|
||||
* Sets description and help for a command.
|
||||
*/
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->setName('models:generate')
|
||||
->setDescription('Converts all JMS models to static (de)serialization code.')
|
||||
->setHelp('Use this command after making any changes to the models.')
|
||||
->addOption(
|
||||
'all',
|
||||
'a',
|
||||
InputOption::VALUE_OPTIONAL,
|
||||
'Generate cache for all models instead of changed models only.',
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the command.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$verbose = static::isVerbose($output);
|
||||
$generator = new ModelsGenerator(false !== $input->getOption('all'));
|
||||
|
||||
$output->writeln('Preparing a list of models to generate cache files...');
|
||||
$output->writeln(
|
||||
'<options=bold>Note:</> Request models will be omitted ' .
|
||||
'because they are being handled by FormEncoder.'
|
||||
);
|
||||
$output->writeln('');
|
||||
|
||||
$generator->loadModelsList();
|
||||
|
||||
if ($verbose) {
|
||||
foreach ($generator->getModels() as $model) {
|
||||
$output->writeln(sprintf('- Added <fg=magenta>%s</>', $model));
|
||||
}
|
||||
}
|
||||
|
||||
if ($verbose && count($generator->getModels()) > 0) {
|
||||
$output->writeln('');
|
||||
}
|
||||
|
||||
if (count($generator->getModels()) === 0) {
|
||||
$output->writeln('<info>No changes were found; skipping generation...</info>');
|
||||
$output->writeln('');
|
||||
}
|
||||
|
||||
try {
|
||||
$generator->generate();
|
||||
} catch (\Throwable $throwable) {
|
||||
$styled = new SymfonyStyle($input, $output);
|
||||
$styled->error($throwable->getMessage());
|
||||
$styled->writeln($throwable->getTraceAsString());
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
$output->writeln(sprintf(
|
||||
'<fg=black;bg=green> ✓ Done, generated code for %d models.</>',
|
||||
count($generator->getModels())
|
||||
));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
57
src/Command/VerifyModelsCommand.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category VerifyModelsCommand
|
||||
* @package RetailCrm\Api\Command
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Api\Command;
|
||||
|
||||
use RetailCrm\Api\Component\Serializer\ModelsChecksumGenerator;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
/**
|
||||
* Class VerifyModelsCommand
|
||||
*
|
||||
* @category VerifyModelsCommand
|
||||
* @package RetailCrm\Api\Command
|
||||
* @internal
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
*/
|
||||
class VerifyModelsCommand extends AbstractModelsProcessorCommand
|
||||
{
|
||||
/**
|
||||
* Sets description and help for a command.
|
||||
*/
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->setName('models:verify')
|
||||
->setDescription('Verify models cache. This command will fail if model cache is not up-to-date.')
|
||||
->setHelp('Use this command if you want to check existing model cache.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
*
|
||||
* @return int
|
||||
* @throws \JsonException
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
if (ModelsChecksumGenerator::verifyChecksum()) {
|
||||
$io->success("Models are up to date.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
$io->error("Outdated models! Run \"models:generate\" command to fix that.");
|
||||
return -1;
|
||||
}
|
||||
}
|
97
src/Component/ComposerLocator.php
Normal file
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category ComposerLocator
|
||||
* @package RetailCrm\Api\Component
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Api\Component;
|
||||
|
||||
/**
|
||||
* Class ComposerLocator
|
||||
*
|
||||
* @category ComposerLocator
|
||||
* @package RetailCrm\Api\Component
|
||||
*/
|
||||
class ComposerLocator
|
||||
{
|
||||
/**
|
||||
* Locate Composer autoloader.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function findAutoloader(): string
|
||||
{
|
||||
$counter = 0;
|
||||
$dir = static::getBaseDirectory();
|
||||
|
||||
for (;;) {
|
||||
if (file_exists($dir . '/autoload.php')) {
|
||||
return $dir . '/autoload.php';
|
||||
}
|
||||
|
||||
if (file_exists($dir . '/vendor/autoload.php')) {
|
||||
return $dir . '/vendor/autoload.php';
|
||||
}
|
||||
|
||||
$counter++;
|
||||
$dir = dirname($dir);
|
||||
|
||||
if (5 < $counter) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate `composer.json`.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function findComposerJson(): string
|
||||
{
|
||||
$counter = 0;
|
||||
$dir = static::getBaseDirectory();
|
||||
|
||||
for (;;) {
|
||||
$fileName = implode(DIRECTORY_SEPARATOR, [$dir, 'composer.json']);
|
||||
|
||||
if (file_exists($fileName) && static::getPackageComposerJson() !== $fileName) {
|
||||
return $fileName;
|
||||
}
|
||||
|
||||
$counter++;
|
||||
$dir = dirname($dir);
|
||||
|
||||
if (2 < $counter) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private static function getBaseDirectory(): string
|
||||
{
|
||||
$cwd = getcwd();
|
||||
|
||||
return false === $cwd ? (string) realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '..', '..'])) : $cwd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns full path to the composer.json of this package.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getPackageComposerJson(): string
|
||||
{
|
||||
return (string) realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, '..', '..', 'composer.json']));
|
||||
}
|
||||
}
|
80
src/Component/CustomApiMethod.php
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.3
|
||||
*
|
||||
* @category CustomApiMethod
|
||||
* @package RetailCrm\Api\Component
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Api\Component;
|
||||
|
||||
use RetailCrm\Api\Exception\Client\HandlerException;
|
||||
use RetailCrm\Api\Interfaces\RequestSenderInterface;
|
||||
|
||||
/**
|
||||
* Class CustomApiMethod
|
||||
*
|
||||
* This class can be used to implement custom methods without any hassle. It is useful if you don't want to
|
||||
* do anything besides sending the request and reading the response.
|
||||
*
|
||||
* @see \RetailCrm\Api\ResourceGroup\CustomMethods::register() for the usage example.
|
||||
*
|
||||
* @category CustomApiMethod
|
||||
* @package RetailCrm\Api\Component
|
||||
*/
|
||||
class CustomApiMethod
|
||||
{
|
||||
/** @var string */
|
||||
protected $method;
|
||||
|
||||
/** @var string */
|
||||
protected $route;
|
||||
|
||||
/** @var bool */
|
||||
protected $rawRouteUri;
|
||||
|
||||
/**
|
||||
* Instantiates new instance of the CustomApiMethod.
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $route
|
||||
*/
|
||||
public function __construct(string $method, string $route)
|
||||
{
|
||||
$this->method = $method;
|
||||
$this->route = $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use provided route as if it was full URL.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function useRouteAsUri(): self
|
||||
{
|
||||
$this->rawRouteUri = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the request, returns the response.
|
||||
*
|
||||
* @param \RetailCrm\Api\Interfaces\RequestSenderInterface $sender
|
||||
* @param array<int|string, mixed>|object $data
|
||||
*
|
||||
* @return array<int|string, mixed>|mixed
|
||||
* @throws \RetailCrm\Api\Exception\ApiException
|
||||
* @throws \RetailCrm\Api\Exception\ClientException
|
||||
* @throws \RetailCrm\Api\Exception\Client\HandlerException
|
||||
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
|
||||
*/
|
||||
public function __invoke(RequestSenderInterface $sender, $data = [])
|
||||
{
|
||||
if (!is_array($data)) {
|
||||
throw new HandlerException(__CLASS__ . ' only supports array data');
|
||||
}
|
||||
|
||||
return $sender->send($this->method, $this->rawRouteUri ? $this->route : $sender->route($this->route), $data);
|
||||
}
|
||||
}
|