123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php namespace Gogs\API;
- /**
- * Gogs API client. This class initially provide
- * the programmer with a starting point and a kind
- * of an interface to start from, to keep track of
- * the context.
- *
- * @author Joachim M. Giaever (joachim[]giaever.org)
- * @version 0.1
- */
- class Client {
- use \Gogs\Lib\Curl\Client;
- /**
- * Constructor of the class to store the api data.
- *
- * @deprecated "No longer user"
- * @param string $api_url
- * @param string $api_token
- * @return null
- */
- public function __construct(string $api_url, string $api_token) {
- $this->url = $api_url;
- $this->token = $api_token;
- }
- /**
- * Returns an object to fetch users from the
- * Gogs installation. See \Request\Users class
- * to understand usage (e.g ->load() to fetch all,
- * ->search(array params) to search for one or several
- * users etc).
- *
- * @return \Request\Users
- */
- public function users() {
- return new Request\Users($this->url, $this->token);
- }
- /**
- * Returns an object to fetch the repositories
- * on the Gogs installation. See \Request\Repos to
- * understand usage. Inherits the same class as \R\Users,
- * but the usage may differ!
- *
- * Note! To fetch a particular repo under a user, you
- * should go through the user (see method below).
- *
- * @return \Request\Repos
- */
- public function repos() {
- return new Request\Repos($this->url, $this->token);
- }
- /**
- * Returns either
- * * the authorized user ($name = "" or "me")
- * * the specified user ($name = anything else)
- *
- * @return \Request\User
- */
- public function user(string $name = "me") {
- return new Request\User($this->url, $this->token, $name);
- }
- /**
- * Nothing to "destruct" at this time.
- *
- * @return null
- */
- public function __destruct() {}
- }
- ?>
|