src/Sell/Compliance/V1/Model/PagedComplianceViolationCollection.php
<?php
/**
* This file is part of the trollandtoad/ebay-sdk-php package.
*
* MIT License
*
* Copyright (c) 2022 Brandon Clothier
*
* 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.
*
*/
declare(strict_types=1);
/**
* PagedComplianceViolationCollection.
*
* PHP version ^7.2 || ^8.0
*
* @category Class
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*/
/**
* Compliance API.
*
* Service for providing information to sellers about their listings being non-compliant, or at risk for becoming non-compliant, against eBay listing policies.
*
* The version of the OpenAPI document: 1.4.1
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 5.4.0
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace TNT\Ebay\Sell\Compliance\V1\Model;
use TNT\Ebay\Sell\Compliance\V1\ObjectSerializer;
/**
* PagedComplianceViolationCollection Class Doc Comment.
*
* @category Class
*
* @description This type is the base response type of the getListingViolations method.
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*
* @implements \ArrayAccess<TKey, TValue>
*
* @template TKey int|null
* @template TValue mixed|null
*/
class PagedComplianceViolationCollection implements ModelInterface, \ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'PagedComplianceViolationCollection';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $openAPITypes = [
'offset' => 'int',
'href' => 'string',
'total' => 'int',
'next' => 'string',
'prev' => 'string',
'limit' => 'int',
'listing_violations' => '\TNT\Ebay\Sell\Compliance\V1\Model\ComplianceViolation[]',
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*
* @phpstan-var array<string, string|null>
*
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'offset' => 'int32',
'href' => null,
'total' => 'int32',
'next' => null,
'prev' => null,
'limit' => 'int32',
'listing_violations' => null,
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'offset' => 'offset',
'href' => 'href',
'total' => 'total',
'next' => 'next',
'prev' => 'prev',
'limit' => 'limit',
'listing_violations' => 'listingViolations',
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'offset' => 'setOffset',
'href' => 'setHref',
'total' => 'setTotal',
'next' => 'setNext',
'prev' => 'setPrev',
'limit' => 'setLimit',
'listing_violations' => 'setListingViolations',
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'offset' => 'getOffset',
'href' => 'getHref',
'total' => 'getTotal',
'next' => 'getNext',
'prev' => 'getPrev',
'limit' => 'getLimit',
'listing_violations' => 'getListingViolations',
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['offset'] = $data['offset'] ?? null;
$this->container['href'] = $data['href'] ?? null;
$this->container['total'] = $data['total'] ?? null;
$this->container['next'] = $data['next'] ?? null;
$this->container['prev'] = $data['prev'] ?? null;
$this->container['limit'] = $data['limit'] ?? null;
$this->container['listing_violations'] = $data['listing_violations'] ?? null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets offset.
*
* @return int|null
*/
public function getOffset()
{
return $this->container['offset'];
}
/**
* Sets offset.
*
* @param int|null $offset This integer value shows the offset of the current page of results. The offset value controls the first listing violation in the result set that will be displayed at the top of the response. The offset and limit query parameters are used to control the pagination of the output. For example, if offset is set to 10 and limit is set to 10, the call retrieves listing violations 11 thru 20 from the resulting collection of violations. Note: This feature employs a zero-based index, where the first item in the list has an offset of 0. Default: 0 {zero)
*
* @return self
*/
public function setOffset($offset)
{
$this->container['offset'] = $offset;
return $this;
}
/**
* Gets href.
*
* @return string|null
*/
public function getHref()
{
return $this->container['href'];
}
/**
* Sets href.
*
* @param string|null $href the URI of the getListingViolations call request that produced the current page of the result set
*
* @return self
*/
public function setHref($href)
{
$this->container['href'] = $href;
return $this;
}
/**
* Gets total.
*
* @return int|null
*/
public function getTotal()
{
return $this->container['total'];
}
/**
* Sets total.
*
* @param int|null $total The total number of listing violations in the result set. If this value is higher than the limit value, there are multiple pages in the result set to view.
*
* @return self
*/
public function setTotal($total)
{
$this->container['total'] = $total;
return $this;
}
/**
* Gets next.
*
* @return string|null
*/
public function getNext()
{
return $this->container['next'];
}
/**
* Sets next.
*
* @param string|null $next The getListingViolations call URI to use to view the next page of the result set. For example, the following URI returns listing violations 21 thru 30 from the collection of policy violations: path/listing_violation?limit=10&offset=20 This field is only returned if an additional page of listing violations exists.
*
* @return self
*/
public function setNext($next)
{
$this->container['next'] = $next;
return $this;
}
/**
* Gets prev.
*
* @return string|null
*/
public function getPrev()
{
return $this->container['prev'];
}
/**
* Sets prev.
*
* @param string|null $prev The getListingViolations call URI to use to view the previous page of the result set. For example, the following URI returns listing violations 1 thru 10 from the collection of policy violations: path/listing_violation?limit=10&offset=0 This field is only returned if an previous page of listing violations exists.
*
* @return self
*/
public function setPrev($prev)
{
$this->container['prev'] = $prev;
return $this;
}
/**
* Gets limit.
*
* @return int|null
*/
public function getLimit()
{
return $this->container['limit'];
}
/**
* Sets limit.
*
* @param int|null $limit The maximum number of listing violations returned per page of the result set. The limit and offset query parameters are used to control the pagination of the output. Note: If this is the last or only page in the result set, it may contain fewer listing violations than the limit value. To determine the number of pages in the result set, divide this value into the value of total and round up to the next integer. Default: 50 Max: 200
*
* @return self
*/
public function setLimit($limit)
{
$this->container['limit'] = $limit;
return $this;
}
/**
* Gets listing_violations.
*
* @return \TNT\Ebay\Sell\Compliance\V1\Model\ComplianceViolation[]|null
*/
public function getListingViolations()
{
return $this->container['listing_violations'];
}
/**
* Sets listing_violations.
*
* @param \TNT\Ebay\Sell\Compliance\V1\Model\ComplianceViolation[]|null $listing_violations An array of listing violations that match the criteria in the call request, including pagination control {if set). As long as there is at least one listing violation that matches the input criteria, this container will be returned. If no listing violations are found for the seller, an HTTP status code of 204 No Content is returned, and there is no response body.
*
* @return self
*/
public function setListingViolations($listing_violations)
{
$this->container['listing_violations'] = $listing_violations;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*/
public function offsetSet($offset, $value): void
{
if (null === $offset) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
*
* @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object.
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}