Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gowon/discogsdotnet


https://github.com/gowon/discogsdotnet

Last synced: 6 days ago
JSON representation

Awesome Lists containing this project

README

        

# DiscogsDotNet

## Development

Discogs regretably does not provide an OpenAPI spec for their API, and lacks any real definition for response objects. An OAS spec would be ideal as tooling could generate clients in several languages, not just C#. A definitive community-driven OAS spec does not exist. Given the maturity of the API, once an OAS file has been created, it should be minimal to maintain.

### Sources

- contains Postman Collection v2.1/v2.0 Collections covering the Discogs API.
- contains [samples](https://github.com/buntine/discogs/tree/e2a600ee451eb00b4cef2b38adb7c645cda274d4/spec/samples) of the response objects for (all?) endpoints.

### OpenAPI Spec Methodology

1. Download and extract source assets to `WORKDIR`:

```powershell
curl -fsSLO https://github.com/leopuleo/Discogs-Postman/archive/refs/heads/master.zip
curl -fsSLO https://github.com/buntine/discogs/archive/refs/heads/master.zip
```

> [!NOTE]
> Make as many corrections to the source Postman script to clean up generated output

2. Generate OpenAPI 3.x YAML spec from Postman Collection using [postman-to-openapi CLI tool](https://github.com/joolfe/postman-to-openapi):

```powershell
npx p2o .\Discogs.postman_collection-v2.1.json -f openapi.yaml -o .\p2o.options.json
```

3. Generate OpenAPI Definitions from sample JSON responses using [mock-to-openapi CLI tool](https://github.com/OzzyCzech/mock-to-openapi)

```powershell
npx mock-to-openapi . .\yaml -v -w
```

4. Combine all YAML into single spec file.

5. Generate C# API Client code from OpenAPI 3.x YAML using NSwag:

```powershell
nswag run .\src\DiscogsDotNet\nswag.json
```

6. Add authorization and rate limiting support to generated client library

References:

-

### Collection Value Spreadsheet Methodology

1. Search User's custom fields for the ones that represent Media Condition and Sleeve Condition (id)
2. Get all (paged) releases in collection . (folder_id =1, per_page=100)
3. For each release (id, resource_url, artists:0:name, basic_information:title, year):
1. Get Price Suggestion
4. Export to Excel/CSV