Skip to content
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
3 changes: 3 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@
- added type `PaymentSetMethodInfoCustomTypeAction`
- added type `PaymentSetMethodInfoInterfaceAccountAction`
- added type `PaymentSetMethodInfoTokenAction`
- added type `ProductSearchFacetResultStats`
- added type `ProductSearchFacetStatsExpression`
- added type `ProductSearchFacetStatsValue`
- added type `ProductTailoringSetProductAttributeAction`
- added type `AttributeLevelEnum`
- added type `ProductSetProductAttributeAction`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

declare(strict_types=1);
/**
* This file has been auto generated
* Do not change it.
*/

namespace Commercetools\Api\Models\ProductSearch;

use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;

interface ProductSearchFacetResultStats extends ProductSearchFacetResult
{
public const FIELD_MIN = 'min';
public const FIELD_MAX = 'max';
public const FIELD_MEAN = 'mean';
public const FIELD_SUM = 'sum';
public const FIELD_COUNT = 'count';

/**
* <p>The minimum value of the field, scoped to the faceted results.</p>
*

* @return null|mixed
*/
public function getMin();

/**
* <p>The maximum value of the field, scoped to the faceted results.</p>
*

* @return null|mixed
*/
public function getMax();

/**
* <p>The average value of the field calculated as <code>sum</code> / <code>count</code>.</p>
* <p>Only returned for number fields.</p>
*

* @return null|mixed
*/
public function getMean();

/**
* <p>The sum of values of the field that match the <a href="ctp:api:type:ProductSearchFacetStatsExpression">facet expression</a>.</p>
* <p>Only returned for number fields.</p>
*

* @return null|mixed
*/
public function getSum();

/**
* <p>The total number of values counted that match the facet expression.</p>
*

* @return null|int
*/
public function getCount();

/**
* @param mixed $min
*/
public function setMin($min): void;

/**
* @param mixed $max
*/
public function setMax($max): void;

/**
* @param mixed $mean
*/
public function setMean($mean): void;

/**
* @param mixed $sum
*/
public function setSum($sum): void;

/**
* @param ?int $count
*/
public function setCount(?int $count): void;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
<?php

declare(strict_types=1);
/**
* This file has been auto generated
* Do not change it.
*/

namespace Commercetools\Api\Models\ProductSearch;

use Commercetools\Base\Builder;
use Commercetools\Base\DateTimeImmutableCollection;
use Commercetools\Base\JsonObject;
use Commercetools\Base\JsonObjectModel;
use Commercetools\Base\MapperFactory;
use stdClass;

/**
* @implements Builder<ProductSearchFacetResultStats>
*/
final class ProductSearchFacetResultStatsBuilder implements Builder
{
/**

* @var ?string
*/
private $name;

/**

* @var null|mixed|mixed
*/
private $min;

/**

* @var null|mixed|mixed
*/
private $max;

/**

* @var null|mixed|mixed
*/
private $mean;

/**

* @var null|mixed|mixed
*/
private $sum;

/**

* @var ?int
*/
private $count;

/**
* <p>Name of the facet.</p>
*

* @return null|string
*/
public function getName()
{
return $this->name;
}

/**
* <p>The minimum value of the field, scoped to the faceted results.</p>
*

* @return null|mixed
*/
public function getMin()
{
return $this->min;
}

/**
* <p>The maximum value of the field, scoped to the faceted results.</p>
*

* @return null|mixed
*/
public function getMax()
{
return $this->max;
}

/**
* <p>The average value of the field calculated as <code>sum</code> / <code>count</code>.</p>
* <p>Only returned for number fields.</p>
*

* @return null|mixed
*/
public function getMean()
{
return $this->mean;
}

/**
* <p>The sum of values of the field that match the <a href="ctp:api:type:ProductSearchFacetStatsExpression">facet expression</a>.</p>
* <p>Only returned for number fields.</p>
*

* @return null|mixed
*/
public function getSum()
{
return $this->sum;
}

/**
* <p>The total number of values counted that match the facet expression.</p>
*

* @return null|int
*/
public function getCount()
{
return $this->count;
}

/**
* @param ?string $name
* @return $this
*/
public function withName(?string $name)
{
$this->name = $name;

return $this;
}

/**
* @param mixed $min
* @return $this
*/
public function withMin($min)
{
$this->min = $min;

return $this;
}

/**
* @param mixed $max
* @return $this
*/
public function withMax($max)
{
$this->max = $max;

return $this;
}

/**
* @param mixed $mean
* @return $this
*/
public function withMean($mean)
{
$this->mean = $mean;

return $this;
}

/**
* @param mixed $sum
* @return $this
*/
public function withSum($sum)
{
$this->sum = $sum;

return $this;
}

/**
* @param ?int $count
* @return $this
*/
public function withCount(?int $count)
{
$this->count = $count;

return $this;
}


public function build(): ProductSearchFacetResultStats
{
return new ProductSearchFacetResultStatsModel(
$this->name,
$this->min,
$this->max,
$this->mean,
$this->sum,
$this->count
);
}

public static function of(): ProductSearchFacetResultStatsBuilder
{
return new self();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

declare(strict_types=1);
/**
* This file has been auto generated
* Do not change it.
*/

namespace Commercetools\Api\Models\ProductSearch;

use Commercetools\Api\Models\ProductSearch\ProductSearchFacetResultCollection;
use Commercetools\Exception\InvalidArgumentException;
use stdClass;

/**
* @extends ProductSearchFacetResultCollection<ProductSearchFacetResultStats>
* @method ProductSearchFacetResultStats current()
* @method ProductSearchFacetResultStats end()
* @method ProductSearchFacetResultStats at($offset)
*/
class ProductSearchFacetResultStatsCollection extends ProductSearchFacetResultCollection
{
/**
* @psalm-assert ProductSearchFacetResultStats $value
* @psalm-param ProductSearchFacetResultStats|stdClass $value
* @throws InvalidArgumentException
*
* @return ProductSearchFacetResultStatsCollection
*/
public function add($value)
{
if (!$value instanceof ProductSearchFacetResultStats) {
throw new InvalidArgumentException();
}
$this->store($value);

return $this;
}

/**
* @psalm-return callable(int):?ProductSearchFacetResultStats
*/
protected function mapper()
{
return function (?int $index): ?ProductSearchFacetResultStats {
$data = $this->get($index);
if ($data instanceof stdClass) {
/** @var ProductSearchFacetResultStats $data */
$data = ProductSearchFacetResultStatsModel::of($data);
$this->set($data, $index);
}

return $data;
};
}
}
Loading