Skip to content

Commit 73adbe6

Browse files
committed
add examples
1 parent b8ddd58 commit 73adbe6

3 files changed

Lines changed: 78 additions & 0 deletions

File tree

examples/collections.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
$username = 'discogsUsername';
12+
13+
try {
14+
$results = $discogs->get_collection_folders($username);
15+
16+
print_r($results);
17+
$folder_id = (int)$results['folders'][0]['id'];
18+
19+
$results = $discogs->get_collection_folder($username, $folder_id);
20+
21+
print_r($results);
22+
23+
$results = $discogs->get_collection_items_by_folder($username, $folder_id);
24+
25+
print_r($results);
26+
} catch (Exception $exception) {
27+
print_r($exception->getMessage());
28+
}

examples/labels.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
$label_id = null;
9+
$password = null;
10+
$discogs = new Discogs($label_id, $password);
11+
$label_id = '1212668';
12+
13+
try {
14+
$results = $discogs->get_label($label_id);
15+
16+
print_r($results);
17+
18+
$results = $discogs->get_label_releases($label_id);
19+
20+
print_r($results);
21+
} catch (Exception $exception) {
22+
print_r($exception->getMessage());
23+
}

examples/users.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
$username = 'discogsUsername';
12+
13+
try {
14+
$results = $discogs->get_profile($username);
15+
16+
print_r($results);
17+
18+
$results = $discogs->get_user_lists($username);
19+
20+
print_r($results);
21+
22+
$results = $discogs->get_wantlist($username);
23+
24+
print_r($results);
25+
} catch (Exception $exception) {
26+
print_r($exception->getMessage());
27+
}

0 commit comments

Comments
 (0)