Skip to content

Commit 91d47a4

Browse files
authored
its bun-time
:D (publish & merge initial version)
2 parents 9ff258d + 98bb587 commit 91d47a4

227 files changed

Lines changed: 13540 additions & 40894 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: deploy-docs
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build-and-deploy:
20+
runs-on: ubuntu-latest
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs.page_url }}
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Bun
30+
uses: oven-sh/setup-bun@v2
31+
with:
32+
bun-version: latest
33+
34+
- name: Install root dependencies
35+
run: bun install --frozen-lockfile
36+
37+
- name: Run root tests
38+
run: bun run test
39+
40+
- name: Install docs dependencies
41+
working-directory: docs
42+
run: bun install --frozen-lockfile
43+
44+
- name: Build docs
45+
working-directory: docs
46+
run: bun run build
47+
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: docs/build
52+
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,10 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
3232

3333
# Finder (MacOS) folder config
3434
.DS_Store
35+
36+
# Documentation build artifacts
37+
docs/.docusaurus
38+
docs/.vitepress
39+
docs/build
40+
docs_dist
41+
research/

README.md

Lines changed: 104 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,108 @@
11
# @syncfm/applemusic-api
2-
> A lot of work here is based off the work of https://github.com/oxmc
32

3+
Typed helpers around Apple Music catalog endpoints with shared configuration, logging, and token management. The client is still in active development, so expect method signatures to move as we close gaps.
44

5+
## Features
56

6-
More coming soon :D
7+
- Zero configuration authentication with automatic scraping and validation of session tokens
8+
- Strong typing across endpoints for albums, artists, songs, music videos, search, hints, suggestions, and relationships
9+
- Consistent logging hooks so you can forward diagnostics to your own observability stack
10+
- Built with Bun and Vitest for fast builds and test feedback
11+
12+
## Requirements
13+
14+
- Node.js 18 or newer, or Bun 1.1 or newer
15+
- Optional developer or user tokens if you want to override the default scraped authentication flow
16+
17+
18+
Guides, endpoint details, and configuration notes live at https://docs.syncfm.dev/applemusic-api .
19+
20+
## Installation
21+
22+
```bash
23+
npm install @syncfm/applemusic-api
24+
# or
25+
pnpm add @syncfm/applemusic-api
26+
# or
27+
yarn add @syncfm/applemusic-api
28+
# or
29+
bun add @syncfm/applemusic-api
30+
```
31+
32+
## Quick start
33+
34+
```ts
35+
import { AppleMusic, AuthType, Region } from "@syncfm/applemusic-api";
36+
37+
const music = new AppleMusic({
38+
region: Region.US,
39+
authType: AuthType.Scraped,
40+
});
41+
42+
await music.init();
43+
44+
const results = await music.Search.search({
45+
term: "bad omens",
46+
types: ["songs", "albums"],
47+
limit: 5,
48+
});
49+
50+
console.log(results.songs?.data?.map((song) => song.attributes?.name));
51+
```
52+
53+
### Endpoint usage examples
54+
55+
Every top level namespace mirrors an Apple Music resource. Each method enforces the correct parameter and response types.
56+
57+
```ts
58+
await music.Albums.get({
59+
ids: ["1644355784"],
60+
});
61+
62+
await music.Albums.getRelationship({
63+
id: "1644355784",
64+
relationship: "tracks",
65+
});
66+
67+
await music.Suggestions.suggestions({
68+
term: "blind cha",
69+
limit: 10,
70+
});
71+
```
72+
73+
## Configuration
74+
75+
`AppleMusic` accepts either an `AppleMusicConfig` instance or plain `AppleMusicConfigParams`.
76+
77+
- `region`: defaults to `Region.US` but can be set to any supported storefront
78+
- `authType`: choose between `Scraped`, `DeveloperToken`, `UserTokenViaDevToken`, or `UserTokenUnofficial`
79+
- `logger`: pass a custom logger implementing the client logger interface, or configure the built in logger through `loggerOptions`
80+
81+
82+
## Tooling
83+
84+
- Build: `bun run build`
85+
- Type check: `bun run type-check`
86+
- Tests with coverage: `bun run test`
87+
- Lint and format: `bun run check`
88+
- Generate reference docs: `bun run docs:build`
89+
90+
## Documentation
91+
92+
Guides, endpoint details, and configuration notes live at https://docs.syncfm.dev/applemusic-api .
93+
94+
## Contributing
95+
96+
1. Fork the repository and create a feature branch
97+
2. Install dependencies and run the test suite
98+
3. Open a pull request with a clear description and examples
99+
100+
Please include tests or docs when you add new features.
101+
102+
## Legal
103+
104+
Apple Music and the Apple logo are trademarks of Apple Inc., registered in the U.S. and other countries. This project is an independent community effort and is not affiliated with, endorsed by, or sponsored by Apple Inc. Any interaction with Apple services remains subject to Apple policies, terms, and applicable laws. Ensure you have the necessary authorization before using this client in your applications.
105+
106+
## License
107+
108+
MIT License. See `LICENSE.md` for details.

biome.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
3+
"vcs": {
4+
"enabled": false,
5+
"clientKind": "git",
6+
"useIgnoreFile": false
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"includes": [
11+
"**/*.ts",
12+
"!dist/*",
13+
"!coverage/*",
14+
"scripts/*",
15+
"!docs/*",
16+
"!docs-src/.vitepress/cache/*"
17+
]
18+
},
19+
"formatter": {
20+
"enabled": true,
21+
"indentStyle": "tab"
22+
},
23+
"linter": {
24+
"enabled": true,
25+
"rules": {
26+
"recommended": true,
27+
"style": { "useTemplate": "error", "useShorthandFunctionType": "off" },
28+
"suspicious": { "noArrayIndexKey": "off", "noExplicitAny": "off" }
29+
}
30+
},
31+
"javascript": {
32+
"formatter": {
33+
"quoteStyle": "double"
34+
}
35+
},
36+
"assist": {
37+
"enabled": true,
38+
"actions": {
39+
"source": {
40+
"organizeImports": "on"
41+
}
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)