2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.spotify.internal;
15 import java.util.stream.Collectors;
16 import java.util.stream.Stream;
18 import org.openhab.core.thing.ThingTypeUID;
21 * The {@link SpotifyBindingConstants} class defines common constants, which are used across the whole binding.
23 * @author Andreas Stenlund - Initial contribution
24 * @author Hilbrand Bouwkamp - Added more constants
26 public class SpotifyBindingConstants {
28 // List of Spotify services related urls, information
29 public static final String SPOTIFY_ACCOUNT_URL = "https://accounts.spotify.com";
30 public static final String SPOTIFY_AUTHORIZE_URL = SPOTIFY_ACCOUNT_URL + "/authorize";
31 public static final String SPOTIFY_API_TOKEN_URL = SPOTIFY_ACCOUNT_URL + "/api/token";
33 * Spotify scopes needed by this binding to work.
35 public static final String SPOTIFY_SCOPES = Stream.of("user-read-playback-state", "user-modify-playback-state",
36 "playlist-read-private", "playlist-read-collaborative").collect(Collectors.joining(" "));
37 public static final String SPOTIFY_API_URL = "https://api.spotify.com/v1/me";
38 public static final String SPOTIFY_API_PLAYER_URL = SPOTIFY_API_URL + "/player";
40 // Authorization related Servlet and resources aliases.
41 public static final String SPOTIFY_ALIAS = "/connectspotify";
42 public static final String SPOTIFY_IMG_ALIAS = "/img";
44 // List of all Thing Type UIDs
45 private static final String BINDING_ID = "spotify";
46 public static final ThingTypeUID THING_TYPE_PLAYER = new ThingTypeUID(BINDING_ID, "player");
47 public static final ThingTypeUID THING_TYPE_DEVICE = new ThingTypeUID(BINDING_ID, "device");
49 // List of all Channel ids
50 public static final String CHANNEL_ACCESSTOKEN = "accessToken";
52 public static final String CHANNEL_TRACKPLAY = "trackPlay";
53 public static final String CHANNEL_TRACKPLAYER = "trackPlayer";
54 public static final String CHANNEL_TRACKREPEAT = "trackRepeat";
56 public static final String CHANNEL_PLAYLISTS = "playlists";
57 public static final String CHANNEL_PLAYLISTNAME = "playlistName";
58 public static final String CHANNEL_PLAYLISTS_LIMIT = "limit";
59 public static final String CHANNEL_PLAYLISTS_OFFSET = "offset";
61 public static final String CHANNEL_PLAYED_TRACKID = "trackId";
62 public static final String CHANNEL_PLAYED_TRACKURI = "trackUri";
63 public static final String CHANNEL_PLAYED_TRACKHREF = "trackHref";
64 public static final String CHANNEL_PLAYED_TRACKNAME = "trackName";
65 public static final String CHANNEL_PLAYED_TRACKTYPE = "trackType";
66 public static final String CHANNEL_PLAYED_TRACKNUMBER = "trackNumber";
67 public static final String CHANNEL_PLAYED_TRACKDISCNUMBER = "trackDiscNumber";
68 public static final String CHANNEL_PLAYED_TRACKPOPULARITY = "trackPopularity";
69 public static final String CHANNEL_PLAYED_TRACKEXPLICIT = "trackExplicit";
70 public static final String CHANNEL_PLAYED_TRACKDURATION_MS = "trackDurationMs";
71 public static final String CHANNEL_PLAYED_TRACKPROGRESS_MS = "trackProgressMs";
72 public static final String CHANNEL_PLAYED_TRACKDURATION_FMT = "trackDuration";
73 public static final String CHANNEL_PLAYED_TRACKPROGRESS_FMT = "trackProgress";
75 public static final String CHANNEL_PLAYED_ALBUMID = "albumId";
76 public static final String CHANNEL_PLAYED_ALBUMURI = "albumUri";
77 public static final String CHANNEL_PLAYED_ALBUMHREF = "albumHref";
78 public static final String CHANNEL_PLAYED_ALBUMNAME = "albumName";
79 public static final String CHANNEL_PLAYED_ALBUMTYPE = "albumType";
80 public static final String CHANNEL_PLAYED_ALBUMIMAGE = "albumImage";
81 public static final String CHANNEL_PLAYED_ALBUMIMAGEURL = "albumImageUrl";
82 public static final String CHANNEL_CONFIG_IMAGE_INDEX = "imageIndex";
84 public static final String CHANNEL_PLAYED_ARTISTID = "artistId";
85 public static final String CHANNEL_PLAYED_ARTISTURI = "artistUri";
86 public static final String CHANNEL_PLAYED_ARTISTHREF = "artistHref";
87 public static final String CHANNEL_PLAYED_ARTISTNAME = "artistName";
88 public static final String CHANNEL_PLAYED_ARTISTTYPE = "artistType";
90 public static final String CHANNEL_DEVICEID = "deviceId";
91 public static final String CHANNEL_DEVICES = "devices";
92 public static final String CHANNEL_DEVICENAME = "deviceName";
93 public static final String CHANNEL_DEVICETYPE = "deviceType";
94 public static final String CHANNEL_DEVICEACTIVE = "deviceActive";
95 public static final String CHANNEL_DEVICERESTRICTED = "deviceRestricted";
96 public static final String CHANNEL_DEVICEVOLUME = "deviceVolume";
97 public static final String CHANNEL_DEVICESHUFFLE = "deviceShuffle";
98 public static final String CHANNEL_DEVICEPLAYER = "devicePlayer";
100 // List of Bridge configuration params
101 public static final String CONFIGURATION_CLIENT_ID = "clientId";
103 // List of Bridge/Thing properties
104 public static final String PROPERTY_SPOTIFY_USER = "user";
105 public static final String PROPERTY_SPOTIFY_DEVICE_NAME = "deviceName";