Example #1
0
function processAddEmail($accessResponse)
{
    $api = new \AABTest\GithubAPI\GithubAPI(GITHUB_USER_AGENT);
    $newEmail = getVariable('email');
    $emailCommand = $api->addUserEmails('token ' . $accessResponse->accessToken, [$newEmail]);
    $allowedScopes = getAuthorisations();
    $emailCommand->checkScopeRequirement($allowedScopes);
    $emailCommand->execute();
    $request = $emailCommand->createRequest();
    $request->setBody(json_encode(["*****@*****.**"]));
    $response = $emailCommand->dispatch($request);
}