| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554 |
- <?php
- /**
- * User
- *
- * PHP version 5
- *
- * @category Class
- * @package XeroAPI\XeroPHP
- * @author OpenAPI Generator team
- * @link https://openapi-generator.tech
- */
- /**
- * Xero Accounting API
- *
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
- *
- * Contact: api@xero.com
- * 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 XeroAPI\XeroPHP\Models\Accounting;
- use \ArrayAccess;
- use \XeroAPI\XeroPHP\AccountingObjectSerializer;
- use \XeroAPI\XeroPHP\StringUtil;
- use ReturnTypeWillChange;
- /**
- * User Class Doc Comment
- *
- * @category Class
- * @package XeroAPI\XeroPHP
- * @author OpenAPI Generator team
- * @link https://openapi-generator.tech
- */
- class User implements ModelInterface, ArrayAccess
- {
- const DISCRIMINATOR = null;
- /**
- * The original name of the model.
- *
- * @var string
- */
- protected static $openAPIModelName = 'User';
- /**
- * Array of property to type mappings. Used for (de)serialization
- *
- * @var string[]
- */
- protected static $openAPITypes = [
- 'user_id' => 'string',
- 'email_address' => 'string',
- 'first_name' => 'string',
- 'last_name' => 'string',
- 'updated_date_utc' => 'string',
- 'is_subscriber' => 'bool',
- 'organisation_role' => 'string'
- ];
- /**
- * Array of property to format mappings. Used for (de)serialization
- *
- * @var string[]
- */
- protected static $openAPIFormats = [
- 'user_id' => 'uuid',
- 'email_address' => null,
- 'first_name' => null,
- 'last_name' => null,
- 'updated_date_utc' => null,
- 'is_subscriber' => null,
- 'organisation_role' => 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 = [
- 'user_id' => 'UserID',
- 'email_address' => 'EmailAddress',
- 'first_name' => 'FirstName',
- 'last_name' => 'LastName',
- 'updated_date_utc' => 'UpdatedDateUTC',
- 'is_subscriber' => 'IsSubscriber',
- 'organisation_role' => 'OrganisationRole'
- ];
- /**
- * Array of attributes to setter functions (for deserialization of responses)
- *
- * @var string[]
- */
- protected static $setters = [
- 'user_id' => 'setUserId',
- 'email_address' => 'setEmailAddress',
- 'first_name' => 'setFirstName',
- 'last_name' => 'setLastName',
- 'updated_date_utc' => 'setUpdatedDateUtc',
- 'is_subscriber' => 'setIsSubscriber',
- 'organisation_role' => 'setOrganisationRole'
- ];
- /**
- * Array of attributes to getter functions (for serialization of requests)
- *
- * @var string[]
- */
- protected static $getters = [
- 'user_id' => 'getUserId',
- 'email_address' => 'getEmailAddress',
- 'first_name' => 'getFirstName',
- 'last_name' => 'getLastName',
- 'updated_date_utc' => 'getUpdatedDateUtc',
- 'is_subscriber' => 'getIsSubscriber',
- 'organisation_role' => 'getOrganisationRole'
- ];
- /**
- * 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;
- }
- const ORGANISATION_ROLE_READONLY = 'READONLY';
- const ORGANISATION_ROLE_INVOICEONLY = 'INVOICEONLY';
- const ORGANISATION_ROLE_STANDARD = 'STANDARD';
- const ORGANISATION_ROLE_FINANCIALADVISER = 'FINANCIALADVISER';
- const ORGANISATION_ROLE_MANAGEDCLIENT = 'MANAGEDCLIENT';
- const ORGANISATION_ROLE_CASHBOOKCLIENT = 'CASHBOOKCLIENT';
- const ORGANISATION_ROLE_UNKNOWN = 'UNKNOWN';
- const ORGANISATION_ROLE_REMOVED = 'REMOVED';
-
-
- /**
- * Gets allowable values of the enum
- *
- * @return string[]
- */
- public function getOrganisationRoleAllowableValues()
- {
- return [
- self::ORGANISATION_ROLE_READONLY,
- self::ORGANISATION_ROLE_INVOICEONLY,
- self::ORGANISATION_ROLE_STANDARD,
- self::ORGANISATION_ROLE_FINANCIALADVISER,
- self::ORGANISATION_ROLE_MANAGEDCLIENT,
- self::ORGANISATION_ROLE_CASHBOOKCLIENT,
- self::ORGANISATION_ROLE_UNKNOWN,
- self::ORGANISATION_ROLE_REMOVED,
- ];
- }
-
- /**
- * 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['user_id'] = isset($data['user_id']) ? $data['user_id'] : null;
- $this->container['email_address'] = isset($data['email_address']) ? $data['email_address'] : null;
- $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null;
- $this->container['last_name'] = isset($data['last_name']) ? $data['last_name'] : null;
- $this->container['updated_date_utc'] = isset($data['updated_date_utc']) ? $data['updated_date_utc'] : null;
- $this->container['is_subscriber'] = isset($data['is_subscriber']) ? $data['is_subscriber'] : null;
- $this->container['organisation_role'] = isset($data['organisation_role']) ? $data['organisation_role'] : null;
- }
- /**
- * Show all the invalid properties with reasons.
- *
- * @return array invalid properties with reasons
- */
- public function listInvalidProperties()
- {
- $invalidProperties = [];
- $allowedValues = $this->getOrganisationRoleAllowableValues();
- if (!is_null($this->container['organisation_role']) && !in_array($this->container['organisation_role'], $allowedValues, true)) {
- $invalidProperties[] = sprintf(
- "invalid value for 'organisation_role', must be one of '%s'",
- implode("', '", $allowedValues)
- );
- }
- 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 user_id
- *
- * @return string|null
- */
- public function getUserId()
- {
- return $this->container['user_id'];
- }
- /**
- * Sets user_id
- *
- * @param string|null $user_id Xero identifier
- *
- * @return $this
- */
- public function setUserId($user_id)
- {
- $this->container['user_id'] = $user_id;
- return $this;
- }
- /**
- * Gets email_address
- *
- * @return string|null
- */
- public function getEmailAddress()
- {
- return $this->container['email_address'];
- }
- /**
- * Sets email_address
- *
- * @param string|null $email_address Email address of user
- *
- * @return $this
- */
- public function setEmailAddress($email_address)
- {
- $this->container['email_address'] = $email_address;
- return $this;
- }
- /**
- * Gets first_name
- *
- * @return string|null
- */
- public function getFirstName()
- {
- return $this->container['first_name'];
- }
- /**
- * Sets first_name
- *
- * @param string|null $first_name First name of user
- *
- * @return $this
- */
- public function setFirstName($first_name)
- {
- $this->container['first_name'] = $first_name;
- return $this;
- }
- /**
- * Gets last_name
- *
- * @return string|null
- */
- public function getLastName()
- {
- return $this->container['last_name'];
- }
- /**
- * Sets last_name
- *
- * @param string|null $last_name Last name of user
- *
- * @return $this
- */
- public function setLastName($last_name)
- {
- $this->container['last_name'] = $last_name;
- return $this;
- }
- /**
- * Gets updated_date_utc
- *
- * @return string|null
- */
- public function getUpdatedDateUtc()
- {
- return $this->container['updated_date_utc'];
- }
- public function getUpdatedDateUtcAsDate()
- {
- if ($this->getUpdatedDateUtc() != null) {
- return StringUtil::convertStringToDateTime($this->getUpdatedDateUtc());
- } else {
- throw new \Exception('can not convert null string to date');
- }
- }
- /**
- * Sets updated_date_utc
- *
- * @param string|null $updated_date_utc Timestamp of last change to user
- *
- * @return $this
- */
- public function setUpdatedDateUtc($updated_date_utc)
- {
- $this->container['updated_date_utc'] = $updated_date_utc;
- return $this;
- }
- /**
- * Gets is_subscriber
- *
- * @return bool|null
- */
- public function getIsSubscriber()
- {
- return $this->container['is_subscriber'];
- }
- /**
- * Sets is_subscriber
- *
- * @param bool|null $is_subscriber Boolean to indicate if user is the subscriber
- *
- * @return $this
- */
- public function setIsSubscriber($is_subscriber)
- {
- $this->container['is_subscriber'] = $is_subscriber;
- return $this;
- }
- /**
- * Gets organisation_role
- *
- * @return string|null
- */
- public function getOrganisationRole()
- {
- return $this->container['organisation_role'];
- }
- /**
- * Sets organisation_role
- *
- * @param string|null $organisation_role User role that defines permissions in Xero and via API (READONLY, INVOICEONLY, STANDARD, FINANCIALADVISER, etc)
- *
- * @return $this
- */
- public function setOrganisationRole($organisation_role)
- {
- $allowedValues = $this->getOrganisationRoleAllowableValues();
- if (!is_null($organisation_role) && !in_array($organisation_role, $allowedValues, true)) {
- throw new \InvalidArgumentException(
- sprintf(
- "Invalid value for 'organisation_role', must be one of '%s'",
- implode("', '", $allowedValues)
- )
- );
- }
- $this->container['organisation_role'] = $organisation_role;
- return $this;
- }
- /**
- * Returns true if offset exists. False otherwise.
- *
- * @param integer $offset Offset
- *
- * @return boolean
- */
- #[\ReturnTypeWillChange]
- public function offsetExists($offset)
- {
- return isset($this->container[$offset]);
- }
- /**
- * Gets offset.
- *
- * @param integer $offset Offset
- *
- * @return mixed
- */
- #[\ReturnTypeWillChange]
- public function offsetGet($offset)
- {
- return isset($this->container[$offset]) ? $this->container[$offset] : null;
- }
- /**
- * Sets value based on offset.
- *
- * @param integer $offset Offset
- * @param mixed $value Value to be set
- *
- * @return void
- */
- #[\ReturnTypeWillChange]
- public function offsetSet($offset, $value)
- {
- if (is_null($offset)) {
- $this->container[] = $value;
- } else {
- $this->container[$offset] = $value;
- }
- }
- /**
- * Unsets offset.
- *
- * @param integer $offset Offset
- *
- * @return void
- */
- #[\ReturnTypeWillChange]
- public function offsetUnset($offset)
- {
- unset($this->container[$offset]);
- }
- /**
- * Gets the string presentation of the object
- *
- * @return string
- */
- public function __toString()
- {
- return json_encode(
- AccountingObjectSerializer::sanitizeForSerialization($this),
- JSON_PRETTY_PRINT
- );
- }
- }
|