Skip to content

Commit 87b0d9b

Browse files
authored
Complete API coverage with PHPDoc annotations (v3.0.1) (#2)
Add missing @method annotations for 22 API endpoints providing complete IDE autocomplete support. Fix documentation inconsistencies and ensure PSR-12 compliance in code examples. Maintains backward compatibility and 100% test coverage while improving developer experience.
1 parent cf74e85 commit 87b0d9b

File tree

6 files changed

+163
-45
lines changed

6 files changed

+163
-45
lines changed

.php-cs-fixer.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

33
$finder = PhpCsFixer\Finder::create()
4-
->in(__DIR__.'/src')
5-
->in(__DIR__.'/tests')
4+
->in(__DIR__ . '/src')
5+
->in(__DIR__ . '/tests')
66
->exclude('vendor');
77

88
$config = new PhpCsFixer\Config();
@@ -11,7 +11,9 @@
1111
'@PSR12' => true,
1212
'@PSR12:risky' => true,
1313
])
14-
->setRiskyAllowed(true)
15-
->setUnsupportedPhpVersionAllowed(true);
14+
->setRiskyAllowed(true);
15+
16+
// @phpstan-ignore-next-line Method exists but not detected by static analysis
17+
$config->setUnsupportedPhpVersionAllowed(true);
1618

1719
return $config;

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
## [3.0.1](https://github.com/calliostro/php-discogs-api/releases/tag/v3.0.1) – 2025-09-09
11+
12+
### Added
13+
14+
- Complete PHPDoc coverage for all 62 Discogs API endpoints
15+
- Missing @method annotations for 22 additional API methods
16+
- Full IDE autocomplete support for inventory, collection, and marketplace operations
17+
18+
### Fixed
19+
20+
- Incorrect legacy method mappings in UPGRADE guide
21+
- Missing PHPDoc annotations causing incomplete IDE support
22+
- PSR-12 compliance issues in documentation examples
23+
- Broken `collectionFolder()` method annotation (replaced with working `collectionFolderGet()`)
24+
25+
### Documentation
26+
27+
- Updated README with accurate API coverage information
28+
- Enhanced code examples with proper formatting standards
29+
- Collection folder management methods are now properly documented
30+
831
## [3.0.0](https://github.com/calliostro/php-discogs-api/releases/tag/v3.0.0) – 2025-09-08
932

1033
### Added

README.md

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
[![Total Downloads](https://img.shields.io/packagist/dt/calliostro/php-discogs-api.svg)](https://packagist.org/packages/calliostro/php-discogs-api)
55
[![License](https://poser.pugx.org/calliostro/php-discogs-api/license)](https://packagist.org/packages/calliostro/php-discogs-api)
66
[![PHP Version](https://img.shields.io/badge/php-%5E8.1-blue.svg)](https://php.net)
7+
[![Guzzle](https://img.shields.io/badge/guzzle-%5E6.5%7C%5E7.0-orange.svg)](https://docs.guzzlephp.org/)
78
[![CI](https://github.com/calliostro/php-discogs-api/actions/workflows/ci.yml/badge.svg)](https://github.com/calliostro/php-discogs-api/actions/workflows/ci.yml)
89
[![Code Coverage](https://codecov.io/gh/calliostro/php-discogs-api/graph/badge.svg?token=0SV4IXE9V1)](https://codecov.io/gh/calliostro/php-discogs-api)
910
[![PHPStan Level](https://img.shields.io/badge/PHPStan-level%208-brightgreen.svg)](https://phpstan.org/)
1011
[![Code Style](https://img.shields.io/badge/code%20style-PSR12-brightgreen.svg)](https://github.com/FriendsOfPHP/PHP-CS-Fixer)
1112

12-
> **🚀 ONLY 2 CLASSES!** The most lightweight Discogs API client for PHP. Zero bloats, maximum performance.
13+
> **🚀 ONLY 2 CLASSES!** The most lightweight Discogs API client for PHP. Zero bloat, maximum performance.
1314
1415
An **ultra-minimalist** Discogs API client that proves you don't need 20+ classes to build a great API client. Built with modern PHP 8.1+ features, service descriptions, and powered by Guzzle.
1516

@@ -53,13 +54,31 @@ echo "Release: " . $release['title'] . "\n";
5354
### Collection and Marketplace
5455

5556
```php
57+
<?php
58+
5659
// Authenticated client for protected operations
57-
$discogs = ClientFactory::createWithToken('your-personal-access-token');
60+
$discogs = ClientFactory::createWithToken('your-personal-access-token', 'MyApp/1.0');
5861

59-
// Access your collection
62+
// Collection management
6063
$folders = $discogs->collectionFolders(['username' => 'your-username']);
64+
$folder = $discogs->collectionFolderGet(['username' => 'your-username', 'folder_id' => '1']);
6165
$items = $discogs->collectionItems(['username' => 'your-username', 'folder_id' => '0']);
6266

67+
// Add release to a collection
68+
$addResult = $discogs->collectionAddRelease([
69+
'username' => 'your-username',
70+
'folder_id' => '1',
71+
'release_id' => '249504'
72+
]);
73+
74+
// Wantlist management
75+
$wantlist = $discogs->wantlistGet(['username' => 'your-username']);
76+
$addToWantlist = $discogs->wantlistAdd([
77+
'username' => 'your-username',
78+
'release_id' => '249504',
79+
'notes' => 'Looking for mint condition'
80+
]);
81+
6382
// Marketplace operations
6483
$inventory = $discogs->inventoryGet(['username' => 'your-username']);
6584
$orders = $discogs->ordersGet(['status' => 'Shipped']);
@@ -68,13 +87,17 @@ $orders = $discogs->ordersGet(['status' => 'Shipped']);
6887
$listing = $discogs->listingCreate([
6988
'release_id' => '249504',
7089
'condition' => 'Near Mint (NM or M-)',
71-
'price' => '25.00'
90+
'sleeve_condition' => 'Very Good Plus (VG+)',
91+
'price' => '25.00',
92+
'status' => 'For Sale'
7293
]);
7394
```
7495

7596
### Database Search and Discovery
7697

7798
```php
99+
<?php
100+
78101
// Search the Discogs database
79102
$results = $discogs->search(['q' => 'Pink Floyd', 'type' => 'artist']);
80103
$releases = $discogs->artistReleases(['id' => '45031', 'sort' => 'year']);
@@ -91,7 +114,7 @@ $labelReleases = $discogs->labelReleases(['id' => '1']);
91114
## ✨ Key Features
92115

93116
- **Ultra-Lightweight** – Only 2 classes, ~234 lines of logic + service descriptions
94-
- **Complete API Coverage** – All 65+ Discogs API endpoints supported
117+
- **Complete API Coverage** – All 60+ Discogs API endpoints supported
95118
- **Direct API Calls**`$client->artistGet()` maps to `/artists/{id}`, no abstractions
96119
- **Type Safe + IDE Support** – Full PHP 8.1+ types, PHPStan Level 8, method autocomplete
97120
- **Future-Ready** – PHP 8.5 compatible (beta/dev testing)
@@ -101,16 +124,17 @@ $labelReleases = $discogs->labelReleases(['id' => '1']);
101124

102125
## 🎵 All Discogs API Methods as Direct Calls
103126

104-
- **Database Methods** – search(), artistGet(), releaseGet(), masterGet(), labelGet()
105-
- **Collection Methods** – collectionFolders(), collectionItems(), collectionFolder()
106-
- **Wantlist Methods** – wantlistGet()
107-
- **Marketplace Methods** – inventoryGet(), listingCreate(), listingUpdate(), listingDelete()
108-
- **Order Methods** – ordersGet(), orderGet(), orderUpdate(), orderMessages()
109-
- **User Methods** – identityGet(), userGet()
110-
- **Master Methods** – masterVersions()
111-
- **Label Methods** – labelReleases()
127+
- **Database Methods** – search(), artistGet(), artistReleases(), releaseGet(), releaseRatingGet(), releaseRatingPut(), releaseRatingDelete(), releaseRatingCommunity(), releaseStats(), masterGet(), masterVersions(), labelGet(), labelReleases()
128+
- **User Identity Methods** – identityGet(), userGet(), userEdit(), userSubmissions(), userContributions(), userLists()
129+
- **Collection Methods** – collectionFolders(), collectionFolderGet(), collectionFolderCreate(), collectionFolderEdit(), collectionFolderDelete(), collectionItems(), collectionItemsByRelease(), collectionAddRelease(), collectionEditRelease(), collectionRemoveRelease(), collectionCustomFields(), collectionEditField(), collectionValue()
130+
- **Wantlist Methods** – wantlistGet(), wantlistAdd(), wantlistEdit(), wantlistRemove()
131+
- **Marketplace Methods** – inventoryGet(), listingGet(), listingCreate(), listingUpdate(), listingDelete(), marketplaceFee(), marketplaceFeeCurrency(), marketplacePriceSuggestions(), marketplaceStats()
132+
- **Order Methods** – orderGet(), ordersGet(), orderUpdate(), orderMessages(), orderMessageAdd()
133+
- **Inventory Export Methods** – inventoryExportCreate(), inventoryExportList(), inventoryExportGet(), inventoryExportDownload()
134+
- **Inventory Upload Methods** – inventoryUploadAdd(), inventoryUploadChange(), inventoryUploadDelete(), inventoryUploadList(), inventoryUploadGet()
135+
- **List Methods** – listGet()
112136

113-
*All 65+ Discogs API endpoints are supported with clean documentation — see [Discogs API Documentation](https://www.discogs.com/developers/) for complete method reference*
137+
*All 60+ Discogs API endpoints are supported with clean documentation — see [Discogs API Documentation](https://www.discogs.com/developers/) for complete method reference*
114138

115139
## 📋 Requirements
116140

@@ -124,6 +148,8 @@ $labelReleases = $discogs->labelReleases(['id' => '1']);
124148
For basic customizations like timeout or User-Agent, use the ClientFactory:
125149

126150
```php
151+
<?php
152+
127153
use Calliostro\Discogs\ClientFactory;
128154

129155
$discogs = ClientFactory::create('MyApp/1.0 (+https://myapp.com)', [
@@ -139,6 +165,8 @@ $discogs = ClientFactory::create('MyApp/1.0 (+https://myapp.com)', [
139165
For advanced HTTP client features (middleware, interceptors, etc.), create your own Guzzle client:
140166

141167
```php
168+
<?php
169+
142170
use GuzzleHttp\Client;
143171
use Calliostro\Discogs\DiscogsApiClient;
144172

@@ -236,7 +264,7 @@ For complete API documentation including all available parameters, visit the [Di
236264

237265
- `collectionFolders($params)` – Get user's collection folders
238266
- `collectionItems($params)` – Get collection items by folder
239-
- `collectionFolder($params)` – Get specific collection folder
267+
- `collectionFolderGet($params)` – Get specific collection folder
240268

241269
#### User Methods
242270

UPGRADE.md

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@ v3.0 is a **complete rewrite** with an ultra-lightweight architecture. Every asp
99
## Requirements Changes
1010

1111
### PHP Version
12-
- **Before (v2.x)**: PHP 7.3+
12+
13+
- **Before (v2.x)**: PHP 7.3+
1314
- **After (v3.0)**: PHP 8.1+ (strict requirement)
1415

1516
### Dependencies
17+
1618
- **Before**: Guzzle Services, Command, OAuth Subscriber
1719
- **After**: Pure Guzzle HTTP client only
1820

1921
## Namespace Changes
2022

2123
```php
24+
<?php
25+
2226
// OLD (v2.x)
2327
use Discogs\ClientFactory;
2428
use Discogs\DiscogsClient;
@@ -31,7 +35,10 @@ use Calliostro\Discogs\DiscogsApiClient;
3135
## Client Creation
3236

3337
### Before (v2.x)
38+
3439
```php
40+
<?php
41+
3542
use Discogs\ClientFactory;
3643

3744
// Basic client
@@ -49,7 +56,10 @@ $client = ClientFactory::factory([
4956
```
5057

5158
### After (v3.0)
59+
5260
```php
61+
<?php
62+
5363
use Calliostro\Discogs\ClientFactory;
5464

5565
// Anonymous client
@@ -65,7 +75,10 @@ $client = ClientFactory::createWithOAuth('token', 'secret', 'MyApp/1.0');
6575
## API Method Calls
6676

6777
### Before (v2.x): Guzzle Services Commands
78+
6879
```php
80+
<?php
81+
6982
// Search
7083
$results = $client->search(['q' => 'Nirvana', 'type' => 'artist']);
7184

@@ -80,7 +93,10 @@ $inventory = $client->getInventory(['username' => 'user']);
8093
```
8194

8295
### After (v3.0): Magic Method Calls
96+
8397
```php
98+
<?php
99+
84100
// Search (same parameters, different method name)
85101
$results = $client->search(['q' => 'Nirvana', 'type' => 'artist']);
86102

@@ -96,45 +112,57 @@ $inventory = $client->inventoryGet(['username' => 'user']);
96112

97113
## Method Name Mapping
98114

99-
| v2.x Command | v3.0 Magic Method | Parameters |
100-
|------------------------------|---------------------|-----------------------------|
101-
| `getArtist` | `artistGet` | `['id' => 'string']` |
102-
| `getArtistReleases` | `artistReleases` | `['id' => 'string']` |
103-
| `getRelease` | `releaseGet` | `['id' => 'string']` |
104-
| `getMaster` | `masterGet` | `['id' => 'string']` |
105-
| `getMasterVersions` | `masterVersions` | `['id' => 'string']` |
106-
| `getLabel` | `labelGet` | `['id' => 'string']` |
107-
| `getLabelReleases` | `labelReleases` | `['id' => 'string']` |
108-
| `search` | `search` | `['q' => 'string']` |
109-
| `getOAuthIdentity` | `identityGet` | `[]` |
110-
| `getProfile` | `userGet` | `['username' => 'string']` |
111-
| `getCollectionFolders` | `collectionFolders` | `['username' => 'string']` |
112-
| `getCollectionFolder` | `collectionFolder` | `['username', 'folder_id']` |
113-
| `getCollectionItemsByFolder` | `collectionItems` | `['username', 'folder_id']` |
114-
| `getInventory` | `inventoryGet` | `['username' => 'string']` |
115-
| `getOrders` | `ordersGet` | `[]` |
116-
| `getOrder` | `orderGet` | `['order_id' => 'string']` |
117-
| `createListing` | `listingCreate` | `[...]` |
118-
| `changeListing` | `listingUpdate` | `[...]` |
119-
| `deleteListing` | `listingDelete` | `[...]` |
115+
| v2.x Command | v3.0 Magic Method | Parameters |
116+
|------------------------------|-------------------------|-----------------------------|
117+
| `getArtist` | `artistGet` | `['id' => 'string']` |
118+
| `getArtistReleases` | `artistReleases` | `['id' => 'string']` |
119+
| `getRelease` | `releaseGet` | `['id' => 'string']` |
120+
| `getMaster` | `masterGet` | `['id' => 'string']` |
121+
| `getMasterVersions` | `masterVersions` | `['id' => 'string']` |
122+
| `getLabel` | `labelGet` | `['id' => 'string']` |
123+
| `getLabelReleases` | `labelReleases` | `['id' => 'string']` |
124+
| `search` | `search` | `['q' => 'string']` |
125+
| `getOAuthIdentity` | `identityGet` | `[]` |
126+
| `getProfile` | `userGet` | `['username' => 'string']` |
127+
| `getCollectionFolders` | `collectionFolders` | `['username' => 'string']` |
128+
| `getCollectionFolder` | `collectionFolderGet` | `['username', 'folder_id']` |
129+
| `getCollectionItemsByFolder` | `collectionItems` | `['username', 'folder_id']` |
130+
| `getInventory` | `inventoryGet` | `['username' => 'string']` |
131+
| `addInventory` | `inventoryUploadAdd` | `[...]` |
132+
| `deleteInventory` | `inventoryUploadDelete` | `[...]` |
133+
| `getOrder` | `orderGet` | `['order_id' => 'string']` |
134+
| `getOrders` | `ordersGet` | `[]` |
135+
| `changeOrder` | `orderUpdate` | `[...]` |
136+
| `getOrderMessages` | `orderMessages` | `['order_id' => 'string']` |
137+
| `addOrderMessage` | `orderMessageAdd` | `[...]` |
138+
| `createListing` | `listingCreate` | `[...]` |
139+
| `changeListing` | `listingUpdate` | `[...]` |
140+
| `deleteListing` | `listingDelete` | `[...]` |
141+
| `getUserLists` | `userLists` | `['username' => 'string']` |
142+
| `getLists` | `listGet` | `['list_id' => 'string']` |
143+
| `getWantlist` | `wantlistGet` | `['username' => 'string']` |
120144

121145
## Configuration Changes
122146

123147
### Service Configuration
148+
124149
- **Before**: Complex Guzzle Services YAML/JSON definitions
125150
- **After**: Simple PHP array in `resources/service.php`
126151

127-
### Throttling
152+
### Throttling
153+
128154
- **Before**: `ThrottleSubscriber` with Guzzle middlewares
129155
- **After**: Handle rate limiting in your application layer
130156

131157
### Error Handling
158+
132159
- **Before**: Guzzle Services exceptions
133160
- **After**: Standard `RuntimeException` with clear messages
134161

135162
## Testing Your Migration
136163

137164
1. **Update composer.json**:
165+
138166
```json
139167
{
140168
"require": {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "calliostro/php-discogs-api",
3-
"description": "Ultra-lightweight Discogs API client for PHP 8.1+ — Complete API coverage, minimal dependencies",
3+
"description": "Ultra-lightweight Discogs API client for PHP 8.1+ with modern Guzzle-based implementation — Only two classes, service descriptions, zero bloat",
44
"type": "library",
55
"keywords": [
66
"php",

0 commit comments

Comments
 (0)