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

Commit 081820c

Browse files
authored
Merge pull request #62 from patrickbussmann/feature/change-listing
Added change listing endpoint
2 parents 846f341 + bc40d2b commit 081820c

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed

resources/service.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,74 @@
411411
]
412412
]
413413
],
414+
'changeListing' => [
415+
'httpMethod' => 'POST',
416+
'uri' => 'marketplace/listings/{listing_id}',
417+
'summary' => 'Edit the data associated with a listing.',
418+
'responseModel' => 'GetResponse',
419+
'parameters' => [
420+
'listing_id' => [
421+
'type' => 'string',
422+
'location' => 'uri',
423+
'required' => true,
424+
],
425+
'release_id' => [
426+
'type' => 'string',
427+
'location' => 'json',
428+
'required' => false,
429+
],
430+
'condition' => [
431+
'type' => 'string',
432+
'location' => 'json',
433+
'required' => false,
434+
],
435+
'sleeve_condition' => [
436+
'type' => 'string',
437+
'location' => 'json',
438+
'required' => false,
439+
],
440+
'price' => [
441+
'type' => 'number',
442+
'location' => 'json',
443+
'required' => false,
444+
],
445+
'comments' => [
446+
'type' => 'string',
447+
'location' => 'json',
448+
'required' => false,
449+
],
450+
'allow_offers' => [
451+
'type' => 'boolean',
452+
'location' => 'json',
453+
'required' => false,
454+
],
455+
'status' => [
456+
'type' => 'string',
457+
'location' => 'json',
458+
'required' => false,
459+
],
460+
'external_id' => [
461+
'type' => 'string',
462+
'location' => 'json',
463+
'required' => false,
464+
],
465+
'location' => [
466+
'type' => 'string',
467+
'location' => 'json',
468+
'required' => false,
469+
],
470+
'weight' => [
471+
'type' => 'number',
472+
'location' => 'json',
473+
'required' => false,
474+
],
475+
'format_quantity' => [
476+
'type' => 'number',
477+
'location' => 'json',
478+
'required' => false,
479+
]
480+
]
481+
],
414482
'deleteListing' => [
415483
'httpMethod' => 'DELETE',
416484
'uri' => 'marketplace/listings/{listing_id}',

tests/Discogs/Test/ClientTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,21 @@ public function testCreateListing()
277277
$this->assertSame('https://api.discogs.com/marketplace/listings', $history->getLastRequest()->getUrl());
278278
}
279279

280+
public function testChangeListing()
281+
{
282+
$client = $this->createClient('change_listing', $history = new History());
283+
$response = $client->changeListing([
284+
'listing_id' => '1',
285+
'release_id' => '1',
286+
'condition' => 'Mint (M)',
287+
'status' => 'For Sale',
288+
'price' => 5.90
289+
]);
290+
291+
$this->assertSame('POST', $history->getLastRequest()->getMethod());
292+
$this->assertSame('https://api.discogs.com/marketplace/listings/1', $history->getLastRequest()->getUrl());
293+
}
294+
280295
public function testDeleteListing()
281296
{
282297
$client = $this->createClient('delete_listing', $history = new History());

tests/fixtures/change_listing

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
HTTP/1.1 204 OK
2+
Reproxy-Status: yes
3+
Access-Control-Allow-Origin: *
4+
Cache-Control: public, must-revalidate
5+
Content-Type: application/json
6+
Server: lighttpd
7+
Content-Length: 780
8+
Date: Tue, 15 Jul 2014 19:59:59 GMT
9+
X-Varnish: 1702965334
10+
Age: 0
11+
Via: 1.1 varnish
12+
Connection: keep-alive
13+
14+
{}

0 commit comments

Comments
 (0)