Skip to content

Commit

Permalink
Merge pull request #6 from vdhicts/feature/pagination-support
Browse files Browse the repository at this point in the history
Add pagination support
  • Loading branch information
dvdheiden authored Dec 2, 2021
2 parents 432dd2d + 4dc2cff commit 7a25a14
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Provide a summary of your changes.
# Checks

- [ ] The changelog is updated (when applicable)
- [ ] The version is updated in `Client.php` (when applicable)
- [ ] The version is updated in `HiHaHo.php` (when applicable)
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
[Semantic Versioning](https://semver.org/spec/v2.0.0.html). Please note this changelog affects this package and not the
HiHaHo API.

## [2.1.0]

### Added

- Add support for pagination to the `allVideos()` and `searchVideos()` endpoints.

## [2.0.0]

### Changed
Expand Down
8 changes: 4 additions & 4 deletions src/Endpoints/VideoEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@

trait VideoEndpoint
{
public function allVideos(): Response
public function allVideos(int $page = 1): Response
{
return $this
->withToken($this->getAccessToken())
->get('v2/video');
->get('v2/video?page=' . $page);
}

public function searchVideos(string $search): Response
public function searchVideos(string $search, int $page = 1): Response
{
return $this
->withToken($this->getAccessToken())
->get('v2/video', ['q' => $search]);
->get('v2/video', ['q' => $search, 'page' => $page]);
}

public function getVideo(int $videoId): Response
Expand Down
2 changes: 1 addition & 1 deletion src/HiHaHo.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class HiHaHo extends Factory
use VideoContainerEndpoint;

private const TIMEOUT = 180;
private const VERSION = '2.0.0';
private const VERSION = '2.1.0';
private const USER_AGENT = 'vdhicts-hihaho-api-client/' . self::VERSION;

protected Configuration $configuration;
Expand Down

0 comments on commit 7a25a14

Please sign in to comment.