Skip to content

Commit 478b3e7

Browse files
Add references to Sonos docs for all endpoints, and start adding Javadoc throughout
1 parent 3fb5f9e commit 478b3e7

58 files changed

Lines changed: 2510 additions & 68 deletions

Some content is hidden

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

src/main/java/engineer/nightowl/sonos/api/SonosApiClient.java

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class SonosApiClient
3434
/**
3535
* Main client for Sonos API.
3636
*
37-
* @param configuration - a {@link SonosApiConfiguration} containing integration
37+
* @param configuration - a {@link engineer.nightowl.sonos.api.SonosApiConfiguration} containing integration
3838
* information such as API keys
3939
*/
4040
public SonosApiClient(final SonosApiConfiguration configuration)
@@ -97,6 +97,8 @@ public CloseableHttpClient getHttpClient()
9797

9898
/**
9999
* Set a custom HTTP client.
100+
*
101+
* @param httpClient custom client to set
100102
*/
101103
public void setHttpClient(final CloseableHttpClient httpClient)
102104
{
@@ -125,9 +127,9 @@ public SonosApiConfiguration getConfiguration()
125127
}
126128

127129
/**
128-
* Set a new {@link SonosApiConfiguration}.
130+
* Set a new {@link engineer.nightowl.sonos.api.SonosApiConfiguration}.
129131
*
130-
* @param configuration - the new {@link SonosApiConfiguration}
132+
* @param configuration - the new {@link engineer.nightowl.sonos.api.SonosApiConfiguration}
131133
*/
132134
public void setConfiguration(final SonosApiConfiguration configuration)
133135
{
@@ -147,6 +149,8 @@ public AuthorizeResource authorize()
147149

148150
/**
149151
* Manage a household's favorites.
152+
*
153+
* @return the FavoriteResource
150154
*/
151155
public FavoriteResource favorite()
152156
{
@@ -155,6 +159,8 @@ public FavoriteResource favorite()
155159

156160
/**
157161
* Manage a household's groups.
162+
*
163+
* @return the GroupResource
158164
*/
159165
public GroupResource group()
160166
{
@@ -163,6 +169,8 @@ public GroupResource group()
163169

164170
/**
165171
* Manage the volume of a group
172+
*
173+
* @return the GroupVolumeResource
166174
*/
167175
public GroupVolumeResource groupVolumeResource()
168176
{
@@ -171,6 +179,8 @@ public GroupVolumeResource groupVolumeResource()
171179

172180
/**
173181
* Manage home theater features
182+
*
183+
* @return the HomeTheaterResource
174184
*/
175185
public HomeTheaterResource homeTheater()
176186
{
@@ -179,6 +189,8 @@ public HomeTheaterResource homeTheater()
179189

180190
/**
181191
* Manage a user's household(s)
192+
*
193+
* @return the HouseholdResource
182194
*/
183195
public HouseholdResource household()
184196
{
@@ -187,6 +199,8 @@ public HouseholdResource household()
187199

188200
/**
189201
* Match music service accounts
202+
*
203+
* @return the MusicServiceAccountsResource
190204
*/
191205
public MusicServiceAccountsResource musicServiceAccounts()
192206
{
@@ -195,6 +209,8 @@ public MusicServiceAccountsResource musicServiceAccounts()
195209

196210
/**
197211
* Subscribe/unsubscribe to playback events
212+
*
213+
* @return the PlaybackMetadataResource
198214
*/
199215
public PlaybackMetadataResource playbackMetadata()
200216
{
@@ -203,6 +219,8 @@ public PlaybackMetadataResource playbackMetadata()
203219

204220
/**
205221
* Manage the playback of the system.
222+
*
223+
* @return the PlaybackResource
206224
*/
207225
public PlaybackResource playback()
208226
{
@@ -211,6 +229,8 @@ public PlaybackResource playback()
211229

212230
/**
213231
* Manage playback sessions.
232+
*
233+
* @return the PlaybackSessionResource
214234
*/
215235
public PlaybackSessionResource playbackSession()
216236
{
@@ -219,6 +239,8 @@ public PlaybackSessionResource playbackSession()
219239

220240
/**
221241
* Manage player volume.
242+
*
243+
* @return the PlayerVolumeResource
222244
*/
223245
public PlayerVolumeResource playerVolume()
224246
{

src/main/java/engineer/nightowl/sonos/api/SonosApiConfiguration.java

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import org.apache.http.message.BasicHeader;
66

77
/**
8-
* Configuration class to be built up and passed into a {@link SonosApiClient}
8+
* Configuration class to be built up and passed into a {@link engineer.nightowl.sonos.api.SonosApiClient}
99
* <p>
1010
* Loads defaults on construction.
1111
*/
@@ -18,26 +18,49 @@ public class SonosApiConfiguration
1818
private String authBaseUrl;
1919
private String controlBaseUrl;
2020

21+
/**
22+
* <p>Constructor for SonosApiConfiguration.</p>
23+
*/
2124
public SonosApiConfiguration()
2225
{
2326
loadDefaults();
2427
}
2528

29+
/**
30+
* <p>Getter for the field <code>applicationId</code>.</p>
31+
*
32+
* @return a {@link java.lang.String} object.
33+
*/
2634
public String getApplicationId()
2735
{
2836
return applicationId;
2937
}
3038

39+
/**
40+
* <p>Setter for the field <code>applicationId</code>.</p>
41+
*
42+
* @param applicationId a {@link java.lang.String} object.
43+
*/
3144
public void setApplicationId(final String applicationId)
3245
{
3346
this.applicationId = applicationId;
3447
}
3548

49+
/**
50+
* <p>Getter for the field <code>apiKey</code>.</p>
51+
*
52+
* @return a {@link java.lang.String} object.
53+
*/
3654
public String getApiKey()
3755
{
3856
return apiKey;
3957
}
4058

59+
/**
60+
* <p>Setter for the field <code>apiKey</code>.</p>
61+
*
62+
* @param apiKey a {@link java.lang.String} object.
63+
*/
4164
public void setApiKey(final String apiKey)
4265
{
4366
this.apiKey = apiKey;
@@ -48,11 +71,21 @@ private String getApiSecret()
4871
return apiSecret;
4972
}
5073

74+
/**
75+
* <p>Setter for the field <code>apiSecret</code>.</p>
76+
*
77+
* @param apiSecret a {@link java.lang.String} object.
78+
*/
5179
public void setApiSecret(final String apiSecret)
5280
{
5381
this.apiSecret = apiSecret;
5482
}
5583

84+
/**
85+
* <p>Getter for the field <code>authBaseUrl</code>.</p>
86+
*
87+
* @return a {@link java.lang.String} object.
88+
*/
5689
public String getAuthBaseUrl()
5790
{
5891
return authBaseUrl;
@@ -63,6 +96,11 @@ private void setAuthBaseUrl(final String authBaseUrl)
6396
this.authBaseUrl = authBaseUrl;
6497
}
6598

99+
/**
100+
* <p>Getter for the field <code>controlBaseUrl</code>.</p>
101+
*
102+
* @return a {@link java.lang.String} object.
103+
*/
66104
public String getControlBaseUrl()
67105
{
68106
return controlBaseUrl;
@@ -79,6 +117,11 @@ private void loadDefaults()
79117
setControlBaseUrl("api.ws.sonos.com/control/api");
80118
}
81119

120+
/**
121+
* <p>getAuthorizationHeader.</p>
122+
*
123+
* @return a {@link org.apache.http.Header} object.
124+
*/
82125
public Header getAuthorizationHeader()
83126
{
84127
final byte[] authBytes = String.join(":", getApiKey(), getApiSecret()).getBytes();

src/main/java/engineer/nightowl/sonos/api/domain/SonosAlbum.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,21 @@ class SonosAlbum
99
private URI imageUrl;
1010
private SonosMusicObjectId id;
1111

12+
/**
13+
* <p>Constructor for SonosAlbum.</p>
14+
*/
1215
public SonosAlbum()
1316
{
1417
}
1518

19+
/**
20+
* <p>Constructor for SonosAlbum.</p>
21+
*
22+
* @param name a {@link java.lang.String} object.
23+
* @param artist a {@link engineer.nightowl.sonos.api.domain.SonosArtist} object.
24+
* @param imageUrl a {@link java.net.URI} object.
25+
* @param id a {@link engineer.nightowl.sonos.api.domain.SonosMusicObjectId} object.
26+
*/
1627
public SonosAlbum(final String name, final SonosArtist artist, final URI imageUrl, final SonosMusicObjectId id)
1728
{
1829
this.name = name;
@@ -21,46 +32,87 @@ public SonosAlbum(final String name, final SonosArtist artist, final URI imageUr
2132
this.id = id;
2233
}
2334

35+
/**
36+
* <p>Getter for the field <code>name</code>.</p>
37+
*
38+
* @return a {@link java.lang.String} object.
39+
*/
2440
public String getName()
2541
{
2642
return name;
2743
}
2844

45+
/**
46+
* <p>Setter for the field <code>name</code>.</p>
47+
*
48+
* @param name a {@link java.lang.String} object.
49+
*/
2950
public void setName(final String name)
3051
{
3152
this.name = name;
3253
}
3354

55+
/**
56+
* <p>Getter for the field <code>artist</code>.</p>
57+
*
58+
* @return a {@link engineer.nightowl.sonos.api.domain.SonosArtist} object.
59+
*/
3460
public SonosArtist getArtist()
3561
{
3662
return artist;
3763
}
3864

65+
/**
66+
* <p>Setter for the field <code>artist</code>.</p>
67+
*
68+
* @param artist a {@link engineer.nightowl.sonos.api.domain.SonosArtist} object.
69+
*/
3970
public void setArtist(final SonosArtist artist)
4071
{
4172
this.artist = artist;
4273
}
4374

75+
/**
76+
* <p>Getter for the field <code>imageUrl</code>.</p>
77+
*
78+
* @return a {@link java.net.URI} object.
79+
*/
4480
public URI getImageUrl()
4581
{
4682
return imageUrl;
4783
}
4884

85+
/**
86+
* <p>Setter for the field <code>imageUrl</code>.</p>
87+
*
88+
* @param imageUrl a {@link java.net.URI} object.
89+
*/
4990
public void setImageUrl(final URI imageUrl)
5091
{
5192
this.imageUrl = imageUrl;
5293
}
5394

95+
/**
96+
* <p>Getter for the field <code>id</code>.</p>
97+
*
98+
* @return a {@link engineer.nightowl.sonos.api.domain.SonosMusicObjectId} object.
99+
*/
54100
public SonosMusicObjectId getId()
55101
{
56102
return id;
57103
}
58104

105+
/**
106+
* <p>Setter for the field <code>id</code>.</p>
107+
*
108+
* @param id a {@link engineer.nightowl.sonos.api.domain.SonosMusicObjectId} object.
109+
*/
59110
public void setId(final SonosMusicObjectId id)
60111
{
61112
this.id = id;
62113
}
63114

115+
/** {@inheritDoc} */
64116
@Override
65117
public String toString()
66118
{

0 commit comments

Comments
 (0)