- Notifications
You must be signed in to change notification settings - Fork4
👷 Async first TravisCI PHP API Client
License
php-api-clients/travis
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
To install viaComposer, use the command below, it will automatically detect the latest version and bind it with^.
composer require api-clients/travisThe client needs two things, the ReactPHP event loop, and optionally an authentication token. Once you created the client you can call theuser method to show the currently authenticated user.
useReact\EventLoop\Factory;useApiClients\Client\Travis\AsyncClient;useApiClients\Client\Travis\Resource\UserInterface;usefunctionApiClients\Foundation\resource_pretty_print;$loop = Factory::create();$client = AsyncClient::create($loop,'your travis key from https://blog.travis-ci.com/2013-01-28-token-token-token/');$client->user()->then(function (UserInterface$user) {resource_pretty_print($user);});$loop->run();
The above example used a promise, when there is more then one result an observabe is returned instead.RxPHP is used for the observables. This means you can apply a huge list of methods to the stream of results
useReact\EventLoop\Factory;useApiClients\Client\Travis\AsyncClient;useApiClients\Client\Travis\Resource\BroadcastInterface;usefunctionApiClients\Foundation\resource_pretty_print;$loop = Factory::create();$client = AsyncClient::create($loop,'your key');$client->broadcasts()->subscribe(function (BroadcastInterface$broadcast) {resource_pretty_print($broadcast);});$loop->run();
The synchronous client works nearly the same as the asynchronous, infact it wraps the asynchronous client to do all the work. This examples does the same as the asynchronous usage example.
useApiClients\Client\Travis\Client;usefunctionApiClients\Foundation\resource_pretty_print;$client = Client::create('your travis key');resource_pretty_print($client->user());
Synchronous results streams are returned as an array.
useApiClients\Client\Travis\Client;usefunctionApiClients\Foundation\resource_pretty_print;$client = Client::create('your travis key');foreach ($client->broadcasts()as$broadcast) {resource_pretty_print($broadcast);};
Theexamples directory is filled with all kinds of examples for this package.
The MIT License (MIT)
Copyright (c) 2017 Cees-Jan Kiewiet
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.
About
👷 Async first TravisCI PHP API Client
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors7
Uh oh!
There was an error while loading.Please reload this page.



