Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

API client updates #177

Merged
merged 4 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
target_directory: 'src'
phpstan:
name: PHPStan
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Check out code into the workspace
uses: actions/checkout@v2
Expand Down
8 changes: 8 additions & 0 deletions src/Model/Entity/Loyalty/SerializedLoyaltyOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,12 @@ class SerializedLoyaltyOrder
* @JMS\SerializedName("items")
*/
public $items;

/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("currency")
*/
public $currency;
}
45 changes: 45 additions & 0 deletions src/Model/Entity/Orders/LinkedOrder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* PHP version 7.3
*
* @category LinkedOrder
* @package RetailCrm\Api\Model\Entity\Orders
*/

namespace RetailCrm\Api\Model\Entity\Orders;

use RetailCrm\Api\Component\Serializer\Annotation as JMS;

/**
* Class LinkedOrder
*
* @category LinkedOrder
* @package RetailCrm\Api\Model\Entity\Orders
*/
class LinkedOrder
{
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("id")
*/
public $id;

/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("externalId")
*/
public $externalId;

/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("number")
*/
public $number;
}
8 changes: 8 additions & 0 deletions src/Model/Entity/Orders/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,14 @@ class Order
*/
public $payments;

/**
* @var \RetailCrm\Api\Model\Entity\Orders\OrderLink[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\Orders\OrderLink>")
* @JMS\SerializedName("links")
*/
public $links;

/**
* @var bool
*
Expand Down
46 changes: 46 additions & 0 deletions src/Model/Entity/Orders/OrderLink.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/**
* PHP version 7.3
*
* @category OrderLink
* @package RetailCrm\Api\Model\Entity\Orders
*/

namespace RetailCrm\Api\Model\Entity\Orders;

use DateTime;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;

/**
* Class OrderLink
*
* @category OrderLink
* @package RetailCrm\Api\Model\Entity\Orders
*/
class OrderLink
{
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("comment")
*/
public $comment;

/**
* @var \RetailCrm\Api\Model\Entity\Orders\LinkedOrder
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\Delivery\SerializedEntityOrder>")
* @JMS\SerializedName("order")
*/
public $order;

/**
* @var DateTime
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("createdAt")
*/
public $createdAt;
}
8 changes: 8 additions & 0 deletions src/Model/Entity/References/PriceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ class PriceType
*/
public $filterExpression;

/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("currency")
*/
public $currency;

/**
* @var \RetailCrm\Api\Model\Entity\References\GeoHierarchyRow[]
*
Expand Down
8 changes: 8 additions & 0 deletions src/Model/Entity/Store/OfferPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,12 @@ class OfferPrice
* @JMS\SerializedName("ordering")
*/
public $ordering;

/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("currency")
*/
public $currency;
}
8 changes: 8 additions & 0 deletions src/Model/Entity/Users/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ class User
*/
public $patronymic;

/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("position")
*/
public $position;

/**
* @var string
*
Expand Down
8 changes: 8 additions & 0 deletions src/Model/Filter/Orders/OrderFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,14 @@ class OrderFilter
*/
public $deliveryTypes;

/**
* @var string[]
*
* @Form\Type("string[]")
* @Form\SerializedName("deliveryServices")
*/
public $deliveryServices;

/**
* @var string[]
*
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Request/References/CurrenciesCreateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class CurrenciesCreateRequest implements RequestInterface
{
/**
* @var \RetailCrm\Api\Model\Entity\References\Currency
* @var \RetailCrm\Api\Model\Entity\References\Currency|null
*
* @Form\Type("RetailCrm\Api\Model\Entity\References\Currency")
* @Form\SerializedName("currency")
Expand Down
95 changes: 95 additions & 0 deletions src/ResourceGroup/WebAnalytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,56 @@
class WebAnalytics extends AbstractApiResourceGroup
{
/**
*
* Makes POST "/api/v5/web-analytics/client-ids/upload" request.
*
* Example:
* ```php
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
* use RetailCrm\Api\Model\Entity\WebAnalytics\Customer;
* use RetailCrm\Api\Model\Entity\WebAnalytics\Order;
* use RetailCrm\Api\Model\Entity\WebAnalytics\Source;
* use RetailCrm\Api\Model\Request\WebAnalytics\SourcesUploadRequest;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* $entity = new Source();
* $entity->source = "sourse";
* $entity->medium = "medium";
* $entity->campaign = "campaign";
* $entity->keyword = "keyword";
* $entity->content = "content";
* $entity->clientId = "10";
* $entity->order = new Order();
* $entity->order->id = 10;
* $entity->order->externalId = "externalId";
* $entity->order->number = "number";
* $entity->customer = new Customer();
* $entity->customer->id = 10;
* $entity->customer->externalId = 'externalId';
*
* $request = new SourcesUploadRequest([$entity]);
*
* try {
* $response = $client->webAnalytics->sourcesUpload($request);
* } 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 'Upload is successful';
* ```
*
* @param \RetailCrm\Api\Model\Request\WebAnalytics\SourcesUploadRequest $request
*
* @return \RetailCrm\Api\Model\Response\WebAnalytics\SourcesUploadResponse
Expand Down Expand Up @@ -53,6 +103,51 @@ public function sourcesUpload(SourcesUploadRequest $request): SourcesUploadRespo
}

/**
*
* Makes POST "/api/v5/web-analytics/client-ids/upload" request.
*
* Example:
* ```php
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
* use RetailCrm\Api\Model\Entity\WebAnalytics\ClientId;
* use RetailCrm\Api\Model\Entity\WebAnalytics\Customer;
* use RetailCrm\Api\Model\Entity\WebAnalytics\Order;
* use RetailCrm\Api\Model\Request\WebAnalytics\ClientIdUploadRequest;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* $entity = new ClientId();
* $entity->value = 'value';
* $entity->order = new Order();
* $entity->order->id = 10;
* $entity->order->externalId = 'externalId';
* $entity->order->number = 'number';
* $entity->customer = new Customer();
* $entity->customer->id = 10;
* $entity->customer->externalId = 'externalId';
*
* $request = new ClientIdUploadRequest([$entity]);
*
* try {
* $response = $client->webAnalytics->clientIdsUpload($request);
* } 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 'Upload is successful';
* ```
*
* @param \RetailCrm\Api\Model\Request\WebAnalytics\ClientIdUploadRequest $request
*
* @return \RetailCrm\Api\Model\Response\WebAnalytics\ClientIdUploadResponse
Expand Down
Loading
Loading