hnhdigital-os/php-linode-api

View on GitHub
src/endpoints/Account/Users.php

Summary

Maintainability
A
1 hr
Test Coverage
<?php

namespace HnhDigital\LinodeApi\Account;

/*
 * This file is part of the PHP Linode API.
 *
 * (c) H&H|Digital <hello@hnh.digital>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

use HnhDigital\LinodeApi\Foundation\Base;

/**
 * This is the Users class.
 *
 * This file is automatically generated.
 *
 * @link https://developers.linode.com/api/v4#tag/Account-Users
 *
 * @author Rocco Howard <rocco@hnh.digital>
 */
class Users extends Base
{
    /**
     * Endpoint.
     *
     * @var string
     */
    protected $endpoint = 'account/users';

    /**
     * Constructor.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Returns a paginated list of Users on your Account. Users may access all or part of your Account based on their
     * restricted status and grants.  An unrestricted User may access everything on the account, whereas restricted User may
     * only access entities or perform actions they've been given specific grants to.
     *
     * @link https://developers.linode.com/api/v4#operation/getUsers
     *
     * @return array
     */
    public function get()
    {
        return $this->apiSearch($this->endpoint, ['class' => 'Account\User', 'parameters' => ['id']]);
    }

    /**
     * Creates a User on your Account. Once created, the User will be able to log in and access portions of your Account.
     * Access is determined by whether or not they are restricted, and what grants they have been given.
     *
     * @param array $optional
     *                        - [username=null] (string) This User's username. This is used for logging in, and
     *                        may also be displayed alongside actions the User
     *                        performs (for example, in Events or public
     *                        StackScripts).
     *                        - [email=null] (string) The email address for this User, for account management
     *                        communications, and may be used for other communications
     *                        as configured.
     *                        - [restricted=null] (boolean) If true, this User must be granted access to perform
     *                        actions or access entities on this Account. See
     *                        [/account/users/{username}/grants](/#operation/getUserGrants)
     *                        for details on how to configure grants for a restricted
     *                        User.
     *
     * @link https://developers.linode.com/api/v4#operation/createUser
     *
     * @return mixed
     */
    public function createUser($optional = [])
    {
        return $this->apiCall('post', '', ['json' => array_merge([
        ], $optional)]);
    }
}