Browse Source

Updated read me

Joachim M. Giæver 6 years ago
parent
commit
3fb23d2dcc
1 changed files with 432 additions and 23 deletions
  1. 432 23
      README.md

+ 432 - 23
README.md

@@ -68,6 +68,7 @@ organization etc.
 |[users](#users-gogsapiclient)|[Users](#users-gogsapirequest)|public| Returns a Request\Users to fetch users from theGogs installation.|
 |[user](#user-gogsapiclient)|[User](#user-gogsapirequest)|public| Get a single user from Gogs.|
 |[repos](#repos-gogsapiclient)|[Repos](#repos-gogsapirequest)|public| Returns an \Request\Repos to fetch repositorieson the Gogs installation.|
+|[get_log](#get_log-gogsapiclient)||public| |
 
 #### Method details
 
@@ -132,6 +133,13 @@ Returns: [Repos](#repos-gogsapirequest)
 
 ---
 
+
+##### get_log `Gogs\API\Client`
+```php
+public function get_log();
+```
+---
+
 # Gogs\API\Request
 
 ## Classes
@@ -205,6 +213,10 @@ Parameters
 
 Returns: object
 
+Throws: 
+
+* [NotImplementedException](#notimplementedexception-gogsapirequestexception "Exception: Gogs\API\Request\Exception\NotImplementedException")
+
 ---
 
 
@@ -571,8 +583,10 @@ Collection is a collection of data of one type.
 
 |Name|Return|Access|Description|
 |:---|:---|:---|:---|
+|[__construct](#__construct-gogsapirequestcollection)||public| |
+|[copy](#copy-gogsapirequestcollection)|[Colletion](#colletion-gogslib)|public| Copy collection|
 |[add](#add-gogsapirequestcollection)|mixed ***v*** int|public| Add an object to the collection.|
-|[remove](#remove-gogsapirequestcollection)|bool|public| Remove an element in collection.|
+|[remove](#remove-gogsapirequestcollection)|bool|protected| Remove an element in collection.|
 |[all](#all-gogsapirequestcollection)|array|public| |
 |[len](#len-gogsapirequestcollection)|int|public| |
 |[by_key](#by_key-gogsapirequestcollection)|mixed|public| |
@@ -580,10 +594,42 @@ Collection is a collection of data of one type.
 |[prev](#prev-gogsapirequestcollection)|mixed|public| |
 |[current](#current-gogsapirequestcollection)||public| |
 |[reset](#reset-gogsapirequestcollection)|mixed|public| |
+|[sort](#sort-gogsapirequestcollection)|[Collection](#collection-gogslib)|public| |
+|[limit](#limit-gogsapirequestcollection)|[Collection](#collection-gogslib)|public| |
+|[offset](#offset-gogsapirequestcollection)|[Collection](#collection-gogslib)|public| |
+|[reverse](#reverse-gogsapirequestcollection)|[Collection](#collection-gogslib)|public| |
 |[search](#search-gogsapirequestcollection)|[Collection](#collection-gogslib)|abstract public| Search for an object.|
+|[sort_by](#sort_by-gogsapirequestcollection)|[Collection](#collection-gogslib)|abstract public| Sort the object|
 
 #### Method details
 
+##### __construct `Gogs\API\Request\Collection`
+```php
+public function __construct(string $api_url, string $api_token, Collection $other = null);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|string|$api_url|The URL to the API.|
+|string|$api_token|A token for an authorized user|
+|[Collection](#request-gogsapi)|$other|*None*|
+---
+
+
+##### copy `Gogs\API\Request\Collection`
+```php
+public function copy();
+```
+ Copy collection
+
+
+Returns: [Colletion](#colletion-gogslib)
+
+---
+
+
 ##### add `Gogs\API\Request\Collection`
 ```php
 public function add(mixed $obj, mixed $key = null);
@@ -608,7 +654,7 @@ Returns: mixed ***v*** int
 
 ##### remove `Gogs\API\Request\Collection`
 ```php
-public function remove(mixed $any, bool $deep = true);
+protected function remove(mixed $any, bool $deep = true);
 ```
  Remove an element in collection.
 
@@ -704,6 +750,64 @@ Returns: mixed
 ---
 
 
+##### sort `Gogs\API\Request\Collection`
+```php
+public function sort(callable $f);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|callable|$f|*None*|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
+##### limit `Gogs\API\Request\Collection`
+```php
+public function limit(int $lim);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|int|$lim|Maximum entries returned|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
+##### offset `Gogs\API\Request\Collection`
+```php
+public function offset(int $off);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|int|$off|*None*|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
+##### reverse `Gogs\API\Request\Collection`
+```php
+public function reverse();
+```
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
 ##### search `Gogs\API\Request\Collection`
 ```php
 abstract public function search(array $params = array());
@@ -722,6 +826,27 @@ Returns: [Collection](#collection-gogslib)
 ---
 
 
+##### sort_by `Gogs\API\Request\Collection`
+```php
+abstract public function sort_by(int $flag = \Gogs\Lib\ArrayIterator::SORT_INDEX);
+```
+ Sort the object
+
+Should call sort on parent with the specified sort method,
+given by $flag
+
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|int|$flag|Sorting flag|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
 ### Org `Gogs\API\Request`
 
 
@@ -842,11 +967,12 @@ Orgs is a collection of organizations.
 |Name|Return|Access|Description|
 |:---|:---|:---|:---|
 |[__construct](#__construct-gogsapirequestorgs)||public| |
-|[set_scope](#set_scope-gogsapirequestorgs)|bool|protected| Set the scope for the request methods accepted by the child.|
-|[create](#create-gogsapirequestorgs)|bool|public| Create object inherited by class.|
+|[set_scope](#set_scope-gogsapirequestorgs)|bool|protected| |
+|[create](#create-gogsapirequestorgs)|bool|public| Create a new organization|
 |[get](#get-gogsapirequestorgs)|object|public| Get an organization by indentifier.|
 |[search](#search-gogsapirequestorgs)|[Collection](#collection-gogslib)|public| Search for an organization.|
 |[json_set_property](#json_set_property-gogsapirequestorgs)|[true](#true-gogsapirequest) ***v*** array|protected| |
+|[sort_by](#sort_by-gogsapirequestorgs)|[Collection](#collection-gogslib)|public| |
 
 #### Method details
 
@@ -869,16 +995,6 @@ Parameters
 ```php
 protected function set_scope(string $method);
 ```
- Set the scope for the request methods accepted by the child.
-
-This can be
- * `get`,
- * `search`,
- * `delete` etc.
-
- Must return true if scope exists of false otherwise. Methods
- the calls this will throw an exception if not true is returned.
-
 
 Parameters
 
@@ -895,10 +1011,11 @@ Returns: bool
 ```php
 public function create(... $args);
 ```
- Create object inherited by class.
+ Create a new organization
 
-Child class must add a scope for 'create' and ensure child is not *loaded*,
-otherwise will `create` throw an exception.
+If arguments are given, the User will be created,
+otherise it will return an initialized object,
+leaving the programmer to create the user.
 
 
 Parameters
@@ -909,11 +1026,6 @@ Parameters
 
 Returns: bool
 
-Throws: 
-
-* [InvalidMethodRequestException](#invalidmethodrequestexception-gogsapirequestexception "Exception: Gogs\API\Request\Exception\InvalidMethodRequestException")
-* [NotImplementedException](#notimplementedexception-gogsapirequestexception "Exception: Gogs\API\Request\Exception\NotImplementedException")
-
 ---
 
 
@@ -991,6 +1103,22 @@ Returns: [true](#true-gogsapirequest) ***v*** array
 ---
 
 
+##### sort_by `Gogs\API\Request\Orgs`
+```php
+public function sort_by(int $flag = Collection::SORT_INDEX);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|int|$flag|Sorting flag|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
 ### Repo `Gogs\API\Request`
 
 
@@ -1138,6 +1266,7 @@ Repos is a collection of repos.
 |[set_scope](#set_scope-gogsapirequestrepos)|bool|protected| |
 |[create](#create-gogsapirequestrepos)|bool|public| |
 |[search](#search-gogsapirequestrepos)|[Collection](#collection-gogslib)|public| Searches for a repo.|
+|[sort_by](#sort_by-gogsapirequestrepos)|[Collection](#collection-gogslib)|public| Sort repos by `method`.|
 |[json_set_property](#json_set_property-gogsapirequestrepos)|[true](#true-gogsapirequest) ***v*** array|protected| |
 
 #### Method details
@@ -1215,6 +1344,31 @@ Returns: [Collection](#collection-gogslib)
 ---
 
 
+##### sort_by `Gogs\API\Request\Repos`
+```php
+public function sort_by(int $flag = Collection::SORT_INDEX, bool $asc = false);
+```
+ Sort repos by `method`.
+
+Valid methods:
+
+ * SORT_UPDATED: Sort on `updated_at` value
+ * SORT_CREATED: Sort on `created_at` value
+ * SORT_OWNER: Sort on `owner` (organization repos etc may appear)
+
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|int|$flag|Sorting flag|
+|bool|$asc|Ascending order|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
 ##### json_set_property `Gogs\API\Request\Repos`
 ```php
 protected function json_set_property(mixed $obj);
@@ -1259,7 +1413,9 @@ A user can also list it's repos and organizations.
 |[repos](#repos-gogsapirequestuser)|[Repos](#repos-gogsapirequest)|public| Returns every repo under user.|
 |[repo](#repo-gogsapirequestuser)|[Repo](#repo-gogsapirequest)|public| Return a single repo.|
 |[organizations](#organizations-gogsapirequestuser)|[Orgs](#orgs-gogsapirequest)|public| Return every organization under user.|
+|[orgs](#orgs-gogsapirequestuser)||public| |
 |[organization](#organization-gogsapirequestuser)|[Org](#org-gogsapirequest)|public| Return a single organization.|
+|[org](#org-gogsapirequestuser)||public| |
 |[create](#create-gogsapirequestuser)|bool|public| Create a new user.|
 |[json_set_property](#json_set_property-gogsapirequestuser)|[true](#true-gogsapirequest) ***v*** array|protected| |
 
@@ -1372,6 +1528,13 @@ Returns: [Orgs](#orgs-gogsapirequest)
 ---
 
 
+##### orgs `Gogs\API\Request\User`
+```php
+public function orgs();
+```
+---
+
+
 ##### organization `Gogs\API\Request\User`
 ```php
 public function organization(string $name);
@@ -1392,6 +1555,19 @@ Returns: [Org](#org-gogsapirequest)
 ---
 
 
+##### org `Gogs\API\Request\User`
+```php
+public function org(string $name);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|string|$name|*None*|
+---
+
+
 ##### create `Gogs\API\Request\User`
 ```php
 public function create(... $args);
@@ -1457,6 +1633,7 @@ depending on the called method.
 |[create](#create-gogsapirequestusers)|bool|public| Returns a new user object. If argumentsis specified the user will be "created".|
 |[get](#get-gogsapirequestusers)|object|public| Get object references by identifier.|
 |[search](#search-gogsapirequestusers)|[Collection](#collection-gogslib)|public| Search for an object.|
+|[sort_by](#sort_by-gogsapirequestusers)|[Collection](#collection-gogslib)|public| Sort the object|
 |[json_set_property](#json_set_property-gogsapirequestusers)|[true](#true-gogsapirequest) ***v*** array|protected| Set properties for the current object.|
 
 #### Method details
@@ -1545,6 +1722,27 @@ Returns: [Collection](#collection-gogslib)
 ---
 
 
+##### sort_by `Gogs\API\Request\Users`
+```php
+public function sort_by(int $flag = Collection::SORT_INDEX);
+```
+ Sort the object
+
+Should call sort on parent with the specified sort method,
+given by $flag
+
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|int|$flag|Sorting flag|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
 ##### json_set_property `Gogs\API\Request\Users`
 ```php
 protected function json_set_property(mixed $obj);
@@ -1723,17 +1921,37 @@ which wont be a part of the "request package"
 
 |Name|Return|Access|Description|
 |:---|:---|:---|:---|
+|[__construct](#__construct-gogslibcollection)||public| |
 |[set](#set-gogslibcollection)||public| Set value(e) to the collection.|
 |[by_key](#by_key-gogslibcollection)|mixed|public| |
+|[copy](#copy-gogslibcollection)|[Colletion](#colletion-gogslib)|public| Copy collection|
 |[all](#all-gogslibcollection)|array|public| |
 |[len](#len-gogslibcollection)|int|public| |
 |[next](#next-gogslibcollection)|mixed|public| |
 |[prev](#prev-gogslibcollection)|mixed|public| |
 |[current](#current-gogslibcollection)||public| |
 |[reset](#reset-gogslibcollection)|mixed|public| |
+|[sort](#sort-gogslibcollection)|[Collection](#collection-gogslib)|public| |
+|[limit](#limit-gogslibcollection)|[Collection](#collection-gogslib)|public| |
+|[offset](#offset-gogslibcollection)|[Collection](#collection-gogslib)|public| |
+|[reverse](#reverse-gogslibcollection)|[Collection](#collection-gogslib)|public| |
+|[remove](#remove-gogslibcollection)|bool|public| Remove an element in collection.|
 
 #### Method details
 
+##### __construct `Gogs\Lib\Collection`
+```php
+public function __construct(array $arr = array());
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|array|$arr|*None*|
+---
+
+
 ##### set `Gogs\Lib\Collection`
 ```php
 public function set(mixed $val, mixed $key = null);
@@ -1769,6 +1987,18 @@ Returns: mixed
 ---
 
 
+##### copy `Gogs\Lib\Collection`
+```php
+public function copy();
+```
+ Copy collection
+
+
+Returns: [Colletion](#colletion-gogslib)
+
+---
+
+
 ##### all `Gogs\Lib\Collection`
 ```php
 public function all();
@@ -1825,6 +2055,89 @@ Returns: mixed
 
 ---
 
+
+##### sort `Gogs\Lib\Collection`
+```php
+public function sort(callable $f);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|callable|$f|*None*|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
+##### limit `Gogs\Lib\Collection`
+```php
+public function limit(int $lim);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|int|$lim|Maximum entries returned|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
+##### offset `Gogs\Lib\Collection`
+```php
+public function offset(int $off);
+```
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|int|$off|*None*|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
+##### reverse `Gogs\Lib\Collection`
+```php
+public function reverse();
+```
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
+##### remove `Gogs\Lib\Collection`
+```php
+public function remove(mixed $any, bool $deep = true);
+```
+ Remove an element in collection.
+
+The function will first look for the element as a
+index key, but if its not found it will look for the
+element as a value.
+
+Deep functions only when the value is given and not the key.
+
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|mixed|$any|Index key or element value|
+|bool|$deep|Delete every item and not just the first|
+
+Returns: bool
+
+---
+
 ## Interfaces
 
 ### ArrayIterator `Gogs\Lib`
@@ -1843,6 +2156,11 @@ providing an iterator interface.
 |[len](#len-gogslibarrayiterator)|int|public| Return collection size.|
 |[all](#all-gogslibarrayiterator)|array|public| Return the whole colection.|
 |[by_key](#by_key-gogslibarrayiterator)|mixed|public| Get element by index key.|
+|[copy](#copy-gogslibarrayiterator)|[Colletion](#colletion-gogslib)|public| Copy collection|
+|[limit](#limit-gogslibarrayiterator)|[Collection](#collection-gogslib)|public| Limit until in collection|
+|[offset](#offset-gogslibarrayiterator)|[Collection](#collection-gogslib)|public| Get from offset collection|
+|[reverse](#reverse-gogslibarrayiterator)|[Collection](#collection-gogslib)|public| Reverse the collection|
+|[sort](#sort-gogslibarrayiterator)|[Collection](#collection-gogslib)|public| Sort collection|
 
 #### Method details
 
@@ -1932,6 +2250,84 @@ Returns: mixed
 
 ---
 
+
+##### copy `Gogs\Lib\ArrayIterator`
+```php
+public function copy();
+```
+ Copy collection
+
+
+Returns: [Colletion](#colletion-gogslib)
+
+---
+
+
+##### limit `Gogs\Lib\ArrayIterator`
+```php
+public function limit(int $lim);
+```
+ Limit until in collection
+
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|int|$lim|Maximum entries returned|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
+##### offset `Gogs\Lib\ArrayIterator`
+```php
+public function offset(int $off);
+```
+ Get from offset collection
+
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|int|$off|*None*|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
+##### reverse `Gogs\Lib\ArrayIterator`
+```php
+public function reverse();
+```
+ Reverse the collection
+
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
+
+##### sort `Gogs\Lib\ArrayIterator`
+```php
+public function sort(callable $f);
+```
+ Sort collection
+
+
+Parameters
+
+| Type | Variable | Description |
+|---|---|---|
+|callable|$f|*None*|
+
+Returns: [Collection](#collection-gogslib)
+
+---
+
 # Gogs\Lib\Curl
 
 ## Traits
@@ -1946,6 +2342,7 @@ A trait used for every class referencing the api-url and token.
 |:---|:---|:---|:---|
 |[method](#method-gogslibcurlclient)|int|protected| Initializes a curl request of different kinds, dependingon the specified method. This can be|
 |[authorized](#authorized-gogslibcurlclient)|bool|protected| Checks if the user is authorized for the scope. Shouldn'tbe used frequently. One test for one scope should be enough,but if you know for sure thats you're programming with theuse of an authorized user you should leave this and justhandle the NotAuthorizedExeption whenever thrown.|
+|[get_log](#get_log-gogslibcurlclient)|array|public static| Returns log entries for the client.|
 
 #### Method details
 
@@ -2000,6 +2397,18 @@ Throws:
 
 ---
 
+
+##### get_log `Gogs\Lib\Curl\Client`
+```php
+public static function get_log();
+```
+ Returns log entries for the client.
+
+
+Returns: array
+
+---
+
 # Gogs\Lib\Curl\Exception
 
 ## Exceptions
@@ -2023,7 +2432,7 @@ Defines an unexpected response.
 
 ##### __construct `Gogs\Lib\Curl\Exception\HTTPUnexpectedResponse`
 ```php
-public function __construct(string $message, int $code = -1, Exception $previous = null);
+public function __construct(string $message, int $code, Exception $previous = null);
 ```
  Sets the exceptions.