Skip to content
This repository was archived by the owner on Oct 25, 2023. It is now read-only.

Added getWantlist #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions resources/service.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,28 @@
'required' => false
]
]
],
'getWantlist' => [
'httpMethod' => 'GET',
'uri' => 'users/{username}/wants',
'responseModel' => 'GetResponse',
'parameters' => [
'username' => [
'type' => 'string',
'location' => 'uri',
'required' => true
],
'per_page' => [
'type' => 'integer',
'location' => 'query',
'required' => false
],
'page' => [
'type' => 'integer',
'location' => 'query',
'required' => false
]
]
]
],
'models' => [
Expand Down
17 changes: 17 additions & 0 deletions tests/Discogs/Test/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,23 @@ public function testGetCollectionItemsByFolder()
$this->assertSame('GET', $history->getLastRequest()->getMethod());
}

public function testGetWantlist()
{
$history = new History();
$client = $this->createClient('get_wantlist', $history);
$response = $client->getWantlist([
'username' => 'Rock_it_science',
'per_page' => 25,
'page' => 1
]);

$this->assertArrayHasKey('pagination', $response);
$this->assertArrayHasKey('releases', $response);
$this->assertCount(25, $response['releases']);
$this->assertSame('https://www.discogs.com/mywantlist?page=1&limit=25', $history->getLastRequest()->getUrl());
$this->assertSame('GET', $history->getLastRequest()->getMethod());
}

protected function createClient($mock, History $history)
{
$path = sprintf('%s/../../fixtures/%s', __DIR__, $mock);
Expand Down