{"size": 1263, "ext": "js", "max_stars_repo_path": "src/api.js", "max_stars_repo_name": "lItc0de/better-spotify", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/api.js", "max_issues_repo_name": "lItc0de/better-spotify", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/api.js", "max_forks_repo_name": "lItc0de/better-spotify", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 34.1351351351, "max_line_length": 99, "alphanum_fraction": 0.6080760095}
import axios from '@/client';

export default {
  getPlaylists: offset => axios.get(`v1/me/playlists${offset ? `?offset=${offset}` : ''}`),

  getPlaylist: playlistId => axios.get(`v1/playlists/${playlistId}`),

  getPlaylistsTracks: (playlistId, offset) => axios
    .get(`v1/playlists/${playlistId}/tracks${offset ? `?offset=${offset}` : ''}`),

  getPlayback: () => axios.get('v1/me/player'),

  pause: () => axios.put('v1/me/player/pause'),

  play: ({
    contextUri, uris, offset, positionMs,
  } = {}, deviceId) => axios
    .put(`v1/me/player/play${deviceId ? `?device_id=${deviceId}` : ''}`, {
      ...(contextUri ? { context_uri: contextUri } : null),
      ...(uris ? { uris } : null),
      ...(offset ? { offset: { position: offset } } : null),
      ...(positionMs ? { postition_ms: positionMs } : null),
    }),

  next: () => axios.post('v1/me/player/next'),

  previous: () => axios.post('v1/me/player/previous'),

  transfer: (deviceId, play = true) => axios.put('v1/me/player', { device_ids: [deviceId], play }),

  shuffle: shuffle => axios.put(`v1/me/player/shuffle?state=${shuffle}`),

  repeat: repeat => axios.put(`v1/me/player/repeat?state=${repeat}`),

  seek: positionMs => axios.put(`v1/me/player/seek?position_ms=${positionMs}`),
};
