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

Commit d9fdb2f

Browse files
committed
Merge pull request #13 from esion/labels_releases
add labels' releases API in sdk (Service)
2 parents 43329a0 + bf7acc9 commit d9fdb2f

4 files changed

Lines changed: 17 additions & 2 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea
2-
vendor
2+
vendor
3+
composer.lock

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"kriswallsmith/buzz": ">=0.5",
99
"php": ">=5.3.0"
1010
},
11+
"require-dev": {
12+
"phpunit/phpunit": "~4"
13+
},
1114
"authors": [
1215
{
1316
"name": "Richard van den Brand",

lib/Discogs/ResponseTransformer/Model.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected function getClass($path)
136136
return $className;
137137
}
138138

139-
if (preg_match('#^/(database/search|artists/\d+/releases)#i', $path)) {
139+
if (preg_match('#^/(database/search|(artists|labels)/\d+/releases)#i', $path)) {
140140
$key = 'resultset';
141141
} else if (preg_match('#^/(artists|releases|masters|labels)/#i', $path, $matches)) {
142142
$key = $this->getSingular($matches[1]);

lib/Discogs/Service.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,17 @@ public function getReleases($artistId)
146146
return $this->call(sprintf('/artists/%d/releases', $artistId));
147147
}
148148

149+
/**
150+
* Returns releases of the particular label
151+
*
152+
* @param int $labelId
153+
* @return Model\Resultset
154+
*/
155+
public function getReleasesByLabelId($labelId)
156+
{
157+
return $this->call(sprintf('/labels/%d/releases', $labelId));
158+
}
159+
149160
/**
150161
* Implements API masters method
151162
*

0 commit comments

Comments
 (0)