<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}
{zone-data:component-name}
Zend\Service\GitHub
{zone-data}
{zone-data:proposer-list}
[Dennis Winter|mailto:dennis <dot> winter <dot> 83 <at> gmail <dot> com]
{zone-data}
{zone-data:liaison}
TBD
{zone-data}
{zone-data:revision}
1.0 - 17 November 2010: Initial Draft.
{zone-data}
{zone-data:overview}
Zend\Service\GitHub allows to easily use GitHub's REST API.
"GitHub is the best way to collaborate with others. Fork, send pull requests and manage all your public and private git repositories."
{zone-data}
{zone-data:references}
[GitHub's API Overview|http://develop.github.com/]
{zone-data}
{zone-data:requirements}
* This component *will* partly require a valid GitHub-Account.
* This component *will* implement full GitHub REST API.
* This component *will* throw an Exception in case of a response error.
* This component *will not* provide a way to commit any data to the Git repository.
{zone-data}
{zone-data:dependencies}
* Zend\Http\Client
* Zend\Rest\RestClient
* Zend\Json
{zone-data}
{zone-data:operation}
{zone-data}
{zone-data:milestones}
* Milestone 1: Complete class overview and method signatures
* Milestone 2: Use cases
* Milestone 3: Prototype
* Milestone 4: User API
* Milestone 5: Network API
* Milestone 6: Issues API
* Milestone 7: Blob API
* Milestone 8: Tree API
* Milestone 9: Commit API
* Milestome 10: Repository API
* Milestone 11: Teams API
* Milestone 12: Organizations API
* Milestone 13: Gist API
* Milestone 14: Acceptance
* Milestone 15: Unit tests exist, work and are checked into Git
* Milestone 16: Initial documentation exists
{zone-data}
{zone-data:class-list}
* Zend\Service\GitHub
* Zend\Service\GitHub\Blob
* Zend\Service\GitHub\Commits
* Zend\Service\GitHub\Exception
* Zend\Service\GitHub\Exception\InvalidArgumentException
* Zend\Service\GitHub\Exception\OutOfRangeException
* Zend\Service\GitHub\Exception\RuntimeException
* Zend\Service\GitHub\Exception\UnexpectedValueException
* Zend\Service\GitHub\Exception\ResponseErrorException
* Zend\Service\GitHub\Exception\NonAuthorizationException
* Zend\Service\GitHub\Gist
* Zend\Service\GitHub\Issues
* Zend\Service\GitHub\Network
* Zend\Service\GitHub\Repository
* Zend\Service\GitHub\Tree
* Zend\Service\GitHub\User
* Zend\Service\GitHub\Teams
* Zend\Service\GitHub\Organziations
* Zend\Service\GitHub\Pull
{zone-data}
{zone-data:use-cases}
{composition-setup}
{deck:id=use_cases}
{card:label=UC 1: Retrieve and change user information}
{code:type=php}
<?php
$githubClient = new Zend\Service\GitHub('login-name', 'api-token');
// Search for a specific user
$githubClient->user->search($username);
// Gets information of authenticated user
$githubClient->user->show();
// Gets information of foreign user
$githubClient->user->show($user);
// Change information of authenticated user
$data = array(
'name' => 'Name',
'email' => 'email@example.com',
'blog' => 'http://example.com',
'company' => 'ZF Corp.',
'location' => 'Germany'
);
$githubClient->user->update($data);
// List email addresses of authenticated user
$githubClient->user->getEmails();
// Add Email address to authenticated user
$githubClient->user->addEmail($email);
// Remove Email address from authenticated user
$githubClient->user->removeEmail($email);
// Retrieve a list of users following $username
$githubClient->user->getFollowers($username);
// Retrieve a list of users who $username follows
$githubClient->user->getFollowing($username);
// List keys of authenticated user
$githubClient->user->getKeys();
// Add Key to authenticated user
$githubClient->user->addKey($title, $key);
// Remove Key from authenticated user
$githubClient->user->removeKey($id);
// Follow another user (as authenticated user)
$githubClient->user->follow($anotherUser);
$githubClient->user->unfollow($anotherUser);
{code}
{card}
{card:label=UC 2: Working with Repositories}
{code:type=php}
{code}
{card}
{deck}
{zone-data}
{zone-data:skeletons}
{composition-setup}
{deck:id=class_skeletons}
{card:label=Class Zend\Service\Github}
{code:type=php}
<?php
namespace Zend\Service;
use Zend\Rest;
use Zend\Json;
class Github extends Rest\RestClient
{
const MAX_LOGIN_LENGTH = 40;
const SERVICE_GIST_URI = 'http://gist.github.com';
const SERVICE_GIST_PATH = '/api/v1/';
const SERVICE_BASE_UR = 'http://github.com';
const SERVICE_BASE_PATH = '/api/v2/';
protected $_login;
protected $_token;
protected $_currentApiComponent;
protected $_currentApiPath;
protected $_supportedApiPaths = array(
'blob',
'tree',
'user',
'gist',
'network',
'repositories',
'user',
'issues',
'commits',
'email',
'keys',
'collaborators',
'set',
'labels',
'comments'
);
protected $_localHttpClient;
protected $_cookieJar;
protected $_authenticationInitialized;
protected $_authenticationCredentials;
public function __construct ($options = array(), $setBaseUri = true){}
public function __get($part){}
public function __call($method, $args){}
public function getToken(){}
public function setToken($value){}
public function getLogin(){}
public function setLogin($value){}
public function setLocalHttpClient(Zend\Http\Client $client){}
public function getLocalHttpClient(){}
protected function _isAuthorizationInitialized(){}
protected function _init(){}
protected function _prepare($path, $addApiEntryPath){}
protected function _get($path, array $query = null, $addApiEntryPath = true){}
protected function _post($path, $data = null){}
protected function _performPost($method, $data){}
protected function _returnResponse($response){}
protected function _transformOutput($output, $format = JSON::TYPE_OBJECT){}
protected function _validateLogin($login){}
protected function _validateInteger($int){}
protected function _validateEmail($email){}
protected function _validateName($name){}
protected function _validateUri($uri){}
protected function _throwResponseErrorException(Zend\Http\Response $response){}
protected function _throwNonAuthenticationInitializationException(){}
}
{code}
{card}
{card:label=User}
{code:type=php}
<?php
namespace Zend\Service\GitHub;
use Zend\Json\JSON;
class User extends \Zend\Service\GitHub
{
public function __construct($options = array()){}
public function show($user = null, $outputFormat = JSON::TYPE_OBJECT){}
public function updatePublicProfile(array $params, $outputFormat = JSON::TYPE_OBJECT){}
public function search($searchValue, $outputFormat = JSON::TYPE_OBJECT){}
public function listEmails($outputFormat = JSON::TYPE_OBJECT){}
public function addEmailAddress($email, $outputFormat = JSON::TYPE_OBJECT){}
public function removeEmailAddress($email, $outputFormat = JSON::TYPE_OBJECT){}
public function listKeys($outputFormat = JSON::TYPE_OBJECT){}
public function addKey(array $key = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function removeKey($id, $outputFormat = JSON::TYPE_OBJECT){}
public function following($user = null, $outputFormat = JSON::TYPE_OBJECT){}
public function followers($user = null, $outputFormat = JSON::TYPE_OBJECT){}
public function follow($user, $outputFormat = JSON::TYPE_OBJECT){}
public function unfollow($user, $outputFormat = JSON::TYPE_OBJECT){}
protected function _searchByEmail($email){}
protected function _searchByUsername($name){}
}
{code}
{card}
{card:label=Network}
{code:type=php}
<?php
namespace Zend\Service\GitHub;
use Zend\Json\JSON;
class Network extends \Zend\Service\GitHub
{
public function __construct($options = array()){}
public function getMeta($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function getData($options = array(), $outputFormat = JSON::TYPE_OBJECT)
}
{code}
{card}
{card:label=Issues}
{code:type=php}
<?php
namespace Zend\Service\GitHub;
use Zend\Json\JSON;
class Issues extends \Zend\Service\GitHub
{
public function __construct($options = array()){}
public function search($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function list($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function show($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function open($options = array(), $data = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function close($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function reopen($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function edit($options = array(), $data = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function listLabels($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function addLabel($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function removeLabel($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function listComments($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function comment($options = array(), $data = array(), $outputFormat = JSON::TYPE_OBJECT){}
}
{code}
{card}
{card:label=Exceptions}
{code:type=php}
<?php
namespace Zend\Service\GitHub;
interface Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class InvalidArgumentException
extends \InvalidArgumentException
implements Zend\Service\GitHub\Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class OutOfRangeException
extends \LengthException
implements Zend\Service\GitHub\Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class RuntimeException
extends \RuntimeException
implements Zend\Service\GitHub\Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class UnexpectedValueException
extends \UnexpectedValueException
implements Zend\Service\GitHub\Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class ResponseErrorException
extends \LogicException
implements Zend\Service\GitHub\Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class NonAuthorizationException
extends \LogicException
implements Zend\Service\GitHub\Exception
{}
{code}
{card}
{deck}
{zone-data}
{zone-template-instance}]]></ac:plain-text-body></ac:macro>
{zone-data:component-name}
Zend\Service\GitHub
{zone-data}
{zone-data:proposer-list}
[Dennis Winter|mailto:dennis <dot> winter <dot> 83 <at> gmail <dot> com]
{zone-data}
{zone-data:liaison}
TBD
{zone-data}
{zone-data:revision}
1.0 - 17 November 2010: Initial Draft.
{zone-data}
{zone-data:overview}
Zend\Service\GitHub allows to easily use GitHub's REST API.
"GitHub is the best way to collaborate with others. Fork, send pull requests and manage all your public and private git repositories."
{zone-data}
{zone-data:references}
[GitHub's API Overview|http://develop.github.com/]
{zone-data}
{zone-data:requirements}
* This component *will* partly require a valid GitHub-Account.
* This component *will* implement full GitHub REST API.
* This component *will* throw an Exception in case of a response error.
* This component *will not* provide a way to commit any data to the Git repository.
{zone-data}
{zone-data:dependencies}
* Zend\Http\Client
* Zend\Rest\RestClient
* Zend\Json
{zone-data}
{zone-data:operation}
{zone-data}
{zone-data:milestones}
* Milestone 1: Complete class overview and method signatures
* Milestone 2: Use cases
* Milestone 3: Prototype
* Milestone 4: User API
* Milestone 5: Network API
* Milestone 6: Issues API
* Milestone 7: Blob API
* Milestone 8: Tree API
* Milestone 9: Commit API
* Milestome 10: Repository API
* Milestone 11: Teams API
* Milestone 12: Organizations API
* Milestone 13: Gist API
* Milestone 14: Acceptance
* Milestone 15: Unit tests exist, work and are checked into Git
* Milestone 16: Initial documentation exists
{zone-data}
{zone-data:class-list}
* Zend\Service\GitHub
* Zend\Service\GitHub\Blob
* Zend\Service\GitHub\Commits
* Zend\Service\GitHub\Exception
* Zend\Service\GitHub\Exception\InvalidArgumentException
* Zend\Service\GitHub\Exception\OutOfRangeException
* Zend\Service\GitHub\Exception\RuntimeException
* Zend\Service\GitHub\Exception\UnexpectedValueException
* Zend\Service\GitHub\Exception\ResponseErrorException
* Zend\Service\GitHub\Exception\NonAuthorizationException
* Zend\Service\GitHub\Gist
* Zend\Service\GitHub\Issues
* Zend\Service\GitHub\Network
* Zend\Service\GitHub\Repository
* Zend\Service\GitHub\Tree
* Zend\Service\GitHub\User
* Zend\Service\GitHub\Teams
* Zend\Service\GitHub\Organziations
* Zend\Service\GitHub\Pull
{zone-data}
{zone-data:use-cases}
{composition-setup}
{deck:id=use_cases}
{card:label=UC 1: Retrieve and change user information}
{code:type=php}
<?php
$githubClient = new Zend\Service\GitHub('login-name', 'api-token');
// Search for a specific user
$githubClient->user->search($username);
// Gets information of authenticated user
$githubClient->user->show();
// Gets information of foreign user
$githubClient->user->show($user);
// Change information of authenticated user
$data = array(
'name' => 'Name',
'email' => 'email@example.com',
'blog' => 'http://example.com',
'company' => 'ZF Corp.',
'location' => 'Germany'
);
$githubClient->user->update($data);
// List email addresses of authenticated user
$githubClient->user->getEmails();
// Add Email address to authenticated user
$githubClient->user->addEmail($email);
// Remove Email address from authenticated user
$githubClient->user->removeEmail($email);
// Retrieve a list of users following $username
$githubClient->user->getFollowers($username);
// Retrieve a list of users who $username follows
$githubClient->user->getFollowing($username);
// List keys of authenticated user
$githubClient->user->getKeys();
// Add Key to authenticated user
$githubClient->user->addKey($title, $key);
// Remove Key from authenticated user
$githubClient->user->removeKey($id);
// Follow another user (as authenticated user)
$githubClient->user->follow($anotherUser);
$githubClient->user->unfollow($anotherUser);
{code}
{card}
{card:label=UC 2: Working with Repositories}
{code:type=php}
{code}
{card}
{deck}
{zone-data}
{zone-data:skeletons}
{composition-setup}
{deck:id=class_skeletons}
{card:label=Class Zend\Service\Github}
{code:type=php}
<?php
namespace Zend\Service;
use Zend\Rest;
use Zend\Json;
class Github extends Rest\RestClient
{
const MAX_LOGIN_LENGTH = 40;
const SERVICE_GIST_URI = 'http://gist.github.com';
const SERVICE_GIST_PATH = '/api/v1/';
const SERVICE_BASE_UR = 'http://github.com';
const SERVICE_BASE_PATH = '/api/v2/';
protected $_login;
protected $_token;
protected $_currentApiComponent;
protected $_currentApiPath;
protected $_supportedApiPaths = array(
'blob',
'tree',
'user',
'gist',
'network',
'repositories',
'user',
'issues',
'commits',
'email',
'keys',
'collaborators',
'set',
'labels',
'comments'
);
protected $_localHttpClient;
protected $_cookieJar;
protected $_authenticationInitialized;
protected $_authenticationCredentials;
public function __construct ($options = array(), $setBaseUri = true){}
public function __get($part){}
public function __call($method, $args){}
public function getToken(){}
public function setToken($value){}
public function getLogin(){}
public function setLogin($value){}
public function setLocalHttpClient(Zend\Http\Client $client){}
public function getLocalHttpClient(){}
protected function _isAuthorizationInitialized(){}
protected function _init(){}
protected function _prepare($path, $addApiEntryPath){}
protected function _get($path, array $query = null, $addApiEntryPath = true){}
protected function _post($path, $data = null){}
protected function _performPost($method, $data){}
protected function _returnResponse($response){}
protected function _transformOutput($output, $format = JSON::TYPE_OBJECT){}
protected function _validateLogin($login){}
protected function _validateInteger($int){}
protected function _validateEmail($email){}
protected function _validateName($name){}
protected function _validateUri($uri){}
protected function _throwResponseErrorException(Zend\Http\Response $response){}
protected function _throwNonAuthenticationInitializationException(){}
}
{code}
{card}
{card:label=User}
{code:type=php}
<?php
namespace Zend\Service\GitHub;
use Zend\Json\JSON;
class User extends \Zend\Service\GitHub
{
public function __construct($options = array()){}
public function show($user = null, $outputFormat = JSON::TYPE_OBJECT){}
public function updatePublicProfile(array $params, $outputFormat = JSON::TYPE_OBJECT){}
public function search($searchValue, $outputFormat = JSON::TYPE_OBJECT){}
public function listEmails($outputFormat = JSON::TYPE_OBJECT){}
public function addEmailAddress($email, $outputFormat = JSON::TYPE_OBJECT){}
public function removeEmailAddress($email, $outputFormat = JSON::TYPE_OBJECT){}
public function listKeys($outputFormat = JSON::TYPE_OBJECT){}
public function addKey(array $key = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function removeKey($id, $outputFormat = JSON::TYPE_OBJECT){}
public function following($user = null, $outputFormat = JSON::TYPE_OBJECT){}
public function followers($user = null, $outputFormat = JSON::TYPE_OBJECT){}
public function follow($user, $outputFormat = JSON::TYPE_OBJECT){}
public function unfollow($user, $outputFormat = JSON::TYPE_OBJECT){}
protected function _searchByEmail($email){}
protected function _searchByUsername($name){}
}
{code}
{card}
{card:label=Network}
{code:type=php}
<?php
namespace Zend\Service\GitHub;
use Zend\Json\JSON;
class Network extends \Zend\Service\GitHub
{
public function __construct($options = array()){}
public function getMeta($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function getData($options = array(), $outputFormat = JSON::TYPE_OBJECT)
}
{code}
{card}
{card:label=Issues}
{code:type=php}
<?php
namespace Zend\Service\GitHub;
use Zend\Json\JSON;
class Issues extends \Zend\Service\GitHub
{
public function __construct($options = array()){}
public function search($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function list($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function show($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function open($options = array(), $data = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function close($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function reopen($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function edit($options = array(), $data = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function listLabels($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function addLabel($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function removeLabel($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function listComments($options = array(), $outputFormat = JSON::TYPE_OBJECT){}
public function comment($options = array(), $data = array(), $outputFormat = JSON::TYPE_OBJECT){}
}
{code}
{card}
{card:label=Exceptions}
{code:type=php}
<?php
namespace Zend\Service\GitHub;
interface Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class InvalidArgumentException
extends \InvalidArgumentException
implements Zend\Service\GitHub\Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class OutOfRangeException
extends \LengthException
implements Zend\Service\GitHub\Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class RuntimeException
extends \RuntimeException
implements Zend\Service\GitHub\Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class UnexpectedValueException
extends \UnexpectedValueException
implements Zend\Service\GitHub\Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class ResponseErrorException
extends \LogicException
implements Zend\Service\GitHub\Exception
{}
{code}
{code:type=php}
<?php
namespace Zend\Service\GitHub\Exception;
class NonAuthorizationException
extends \LogicException
implements Zend\Service\GitHub\Exception
{}
{code}
{card}
{deck}
{zone-data}
{zone-template-instance}]]></ac:plain-text-body></ac:macro>