Skip to content

Commit 6eb2c16

Browse files
committed
examples for all functions
1 parent 73adbe6 commit 6eb2c16

3 files changed

Lines changed: 52 additions & 3 deletions

File tree

examples/labels.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
require dirname(__DIR__) . '/vendor/autoload.php';
66

77
// your own username and password are required to use the Discogs API
8-
$label_id = null;
8+
$username = null;
99
$password = null;
10-
$discogs = new Discogs($label_id, $password);
11-
$label_id = '1212668';
10+
$discogs = new Discogs($username, $password);
11+
$label_id = 1212668;
1212

1313
try {
1414
$results = $discogs->get_label($label_id);

examples/releases.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
use AmpacheDiscogs\Discogs;
4+
5+
require dirname(__DIR__) . '/vendor/autoload.php';
6+
7+
// your own username and password are required to use the Discogs API
8+
$username = null;
9+
$password = null;
10+
$discogs = new Discogs($username, $password);
11+
12+
$artist = 'Code 64';
13+
$album = 'The Shape';
14+
$artistId = 129150;
15+
$masterId = 2871442;
16+
$releaseId = 25201483;
17+
18+
try {
19+
$results = $discogs->search_release($artist, $album);
20+
21+
print_r($results);
22+
23+
$results = $discogs->search_master($artist, $album);
24+
25+
print_r($results);
26+
27+
$results = $discogs->get_artist_releases($artistId);
28+
29+
print_r($results);
30+
31+
$results = $discogs->get_release($releaseId);
32+
33+
print_r($results);
34+
35+
$results = $discogs->get_master($masterId);
36+
37+
print_r($results);
38+
39+
$results = $discogs->get_master_versions($masterId);
40+
41+
print_r($results);
42+
} catch (Exception $exception) {
43+
print_r($exception->getMessage());
44+
}

examples/users.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
$password = null;
1010
$discogs = new Discogs($username, $password);
1111
$username = 'discogsUsername';
12+
$list_id = 1596537;
1213

1314
try {
1415
$results = $discogs->get_profile($username);
@@ -22,6 +23,10 @@
2223
$results = $discogs->get_wantlist($username);
2324

2425
print_r($results);
26+
27+
$results = $discogs->get_list($list_id);
28+
29+
print_r($results);
2530
} catch (Exception $exception) {
2631
print_r($exception->getMessage());
2732
}

0 commit comments

Comments
 (0)