@atmospheremusic/atmosphere-api-library
v2.1.43
Published
Shared API client library for the Atmosphere ecosystem
Readme
@atmospheremusic/atmosphere-api-library
Shared API client library for the Atmosphere ecosystem.
Installation
npm install @atmospheremusic/atmosphere-api-libraryUsage
import { apiClient, setApiClientBaseURL } from '@atmospheremusic/atmosphere-api-library';
// Set the base URL for API requests
setApiClientBaseURL('https://api.example.com');
// Use the apiClient for making requests
// Or import specific API functions
import { callUserProfilesShow, callArtistProfilesShow } from '@atmospheremusic/atmosphere-api-library';Current-user helpers
Use callMy* helpers for authenticated users acting on their own resources.
They call additive /api/v1/me/* routes and do not accept a user id:
import {
callMyCardsIndex,
callMyNotificationsIndex,
callMyUserPreferencesUpdate,
} from '@atmospheremusic/atmosphere-api-library';
const cards = await callMyCardsIndex();
const notifications = await callMyNotificationsIndex({ page: 1 });
await callMyUserPreferencesUpdate({ dark_mode: true });Each callMy* helper is colocated with its user-id counterpart in the
corresponding resource module (for example, both card variants are in
src/cards.js).
The existing user-id helpers remain supported for public profile reads and
explicit staff/admin workflows. Do not use a user-id helper for an ordinary
self-service call when a callMy* helper exists.
For publishing information, see PUBLISHING.md.
