File tree Expand file tree Collapse file tree 4 files changed +52
-1
lines changed Expand file tree Collapse file tree 4 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,9 @@ Full documentation can be found in the [Private Packagist documentation](https:/
3838
3939##### Trigger a full synchronization
4040``` php
41- $client->organization()->sync();
41+ $jobs = $ client->organization()->sync();
4242```
43+ Returns an array of created jobs. One for every synchronization.
4344
4445#### Customer
4546
@@ -116,6 +117,14 @@ $packages = $client->packages()->all($filters);
116117```
117118Returns an array of packages.
118119
120+ #### Job
121+
122+ ##### Show a job
123+ ``` php
124+ $job = $client->jobs()->show($jobId);
125+ ```
126+ Returns the job.
127+
119128## License
120129
121130` private-packagist/api-client ` is licensed under the MIT License
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace PrivatePackagist \ApiClient \Api ;
4+
5+ class Jobs extends AbstractApi
6+ {
7+ public function show ($ jobId )
8+ {
9+ return $ this ->get (sprintf ('/jobs/%s ' , $ jobId ));
10+ }
11+ }
Original file line number Diff line number Diff line change @@ -58,6 +58,11 @@ public function packages()
5858 return new Api \Packages ($ this , $ this ->responseMediator );
5959 }
6060
61+ public function jobs ()
62+ {
63+ return new Api \Jobs ($ this , $ this ->responseMediator );
64+ }
65+
6166 public function getHttpClient ()
6267 {
6368 return $ this ->getHttpClientBuilder ()->getHttpClient ();
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace PrivatePackagist \ApiClient \Api ;
4+
5+ class JobsTest extends ApiTestCase
6+ {
7+ public function testShow ()
8+ {
9+ $ expected = [];
10+ $ jobId = '46bf13150a86fece079ca979cb8ef57c78773faa ' ;
11+
12+ /** @var Jobs&\PHPUnit_Framework_MockObject_MockObject $api */
13+ $ api = $ this ->getApiMock ();
14+ $ api ->expects ($ this ->once ())
15+ ->method ('get ' )
16+ ->with ($ this ->equalTo ('/jobs/ ' . $ jobId ))
17+ ->will ($ this ->returnValue ($ expected ));
18+
19+ $ this ->assertSame ($ expected , $ api ->show ($ jobId ));
20+ }
21+
22+ protected function getApiClass ()
23+ {
24+ return Jobs::class;
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments