hnhdigital-os/php-linode-api

View on GitHub
src/endpoints/Account/OauthClients.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 OauthClients class.
 *
 * This file is automatically generated.
 *
 * @link https://developers.linode.com/api/v4#tag/Account-OauthClients
 *
 * @author Rocco Howard <rocco@hnh.digital>
 */
class OauthClients extends Base
{
    /**
     * Endpoint.
     *
     * @var string
     */
    protected $endpoint = 'account/oauth-clients';

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

    /**
     * Returns a paginated list of OAuth Clients registered to your Account.  OAuth Clients allow users to log into
     * applications you write or host using their Linode Account, and may allow them to grant some level of access to their
     * Linodes or other entities to your application.
     *
     * @link https://developers.linode.com/api/v4#operation/getClients
     *
     * @return array
     */
    public function get()
    {
        return $this->apiSearch($this->endpoint, ['class' => 'Account\OauthClient', 'parameters' => ['id']]);
    }

    /**
     * Creates an OAuth Client, which can be used to allow users (using their Linode account) to log in to your own
     * application, and optionally grant your application some amount of access to their Linodes or other entities.
     *
     * @param array $optional
     *                        - [id=null] (string) The OAuth Client ID. This is used to identify the
     *                        client, and is a publicly-known value (it is not a
     *                        secret).
     *                        - [redirect_uri=null] (string) The location a successful log in from
     *                        https://login.linode.com should be redirected to for
     *                        this client. The receiver of this redirect should be
     *                        ready to accept an OAuth exchange code and finish the
     *                        OAuth exchange.
     *                        - [label=null] (string) The name of this application. This will be presented to
     *                        users when they are asked to grant it access to their
     *                        Account.
     *                        - [status=null] (string) The status of this application. `active` by default.
     *                        - [secret=null] (string) The OAuth Client secret, used in the OAuth exchange.
     *                        This is returned as `<REDACTED>` except when an OAuth
     *                        Client is created or its secret is reset. This is a
     *                        secret, and should not be shared or disclosed publicly.
     *                        - [thumbnail_url=null] (string) The URL where this client's thumbnail may be viewed, or
     *                        `null` if this client does not have a thumbnail set.
     *                        - [public=null] (boolean) If this is a public or private OAuth Client. Public
     *                        clients have a slightly different authentication
     *                        workflow than private clients. See the [OAuth
     *                        spec](https://oauth.net/2/) for more details.
     *
     * @link https://developers.linode.com/api/v4#operation/createClient
     *
     * @return mixed
     */
    public function createClient($optional = [])
    {
        return $this->apiCall('post', '', ['json' => array_merge([
        ], $optional)]);
    }
}