steelseries-sonar-sdk 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +40 -40
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4915,6 +4915,46 @@ function convertVolumeToUser(value) {
|
|
|
4915
4915
|
return result;
|
|
4916
4916
|
}
|
|
4917
4917
|
|
|
4918
|
+
// src/sonar/requests/volume-settings/request-volume-settings-classic.ts
|
|
4919
|
+
async function requestVolumeSettingsClassic(sonarEndpoint) {
|
|
4920
|
+
let response;
|
|
4921
|
+
try {
|
|
4922
|
+
const url = new URL(`${sonarEndpoint}/volumeSettings/classic`);
|
|
4923
|
+
response = await fetch(url);
|
|
4924
|
+
} catch (error) {
|
|
4925
|
+
throw new SonarRequestException({ innerException: error });
|
|
4926
|
+
}
|
|
4927
|
+
if (response.ok) {
|
|
4928
|
+
const data = await response.json();
|
|
4929
|
+
if (data?.masters?.classic == null) {
|
|
4930
|
+
throw new SonarRequestException({ innerException: new Error("Missing required data in response.") });
|
|
4931
|
+
}
|
|
4932
|
+
return data;
|
|
4933
|
+
} else {
|
|
4934
|
+
const data = await response.json();
|
|
4935
|
+
throw new SonarRequestException({ innerException: new Error(data?.error ?? data) });
|
|
4936
|
+
}
|
|
4937
|
+
}
|
|
4938
|
+
|
|
4939
|
+
// src/functions/audio/get-audio-data-classic.ts
|
|
4940
|
+
async function getAudioDataClassic(sonarEndpoint) {
|
|
4941
|
+
const data = await requestVolumeSettingsClassic(sonarEndpoint);
|
|
4942
|
+
const volumeData = {
|
|
4943
|
+
["master" /* Master */]: createResponseVolumeData(data.masters.classic),
|
|
4944
|
+
["game" /* Game */]: data.devices.game && createResponseVolumeData(data.devices.game.classic),
|
|
4945
|
+
["chat" /* Chat */]: data.devices.chatRender && createResponseVolumeData(data.devices.chatRender.classic),
|
|
4946
|
+
["media" /* Media */]: data.devices.media && createResponseVolumeData(data.devices.media.classic),
|
|
4947
|
+
["aux" /* Aux */]: data.devices.aux && createResponseVolumeData(data.devices.aux.classic),
|
|
4948
|
+
["mic" /* Mic */]: data.devices.chatCapture && createResponseVolumeData(data.devices.chatCapture.classic)
|
|
4949
|
+
};
|
|
4950
|
+
return volumeData;
|
|
4951
|
+
}
|
|
4952
|
+
function createResponseVolumeData(volumeData) {
|
|
4953
|
+
return {
|
|
4954
|
+
volume: convertVolumeToUser(volumeData.volume),
|
|
4955
|
+
isMuted: volumeData.muted
|
|
4956
|
+
};
|
|
4957
|
+
}
|
|
4918
4958
|
// src/functions/custom-fetch.ts
|
|
4919
4959
|
import https2 from "node:https";
|
|
4920
4960
|
|
|
@@ -6118,46 +6158,6 @@ async function customFetch(url, init) {
|
|
|
6118
6158
|
return await fetch2(url, { ...init, agent: httpsAgent });
|
|
6119
6159
|
}
|
|
6120
6160
|
|
|
6121
|
-
// src/sonar/requests/volume-settings/request-volume-settings-classic.ts
|
|
6122
|
-
async function requestVolumeSettingsClassic(sonarEndpoint) {
|
|
6123
|
-
let response;
|
|
6124
|
-
try {
|
|
6125
|
-
const url = new URL(`${sonarEndpoint}/volumeSettings/classic`);
|
|
6126
|
-
response = await customFetch(url);
|
|
6127
|
-
} catch (error) {
|
|
6128
|
-
throw new SonarRequestException({ innerException: error });
|
|
6129
|
-
}
|
|
6130
|
-
if (response.ok) {
|
|
6131
|
-
const data = await response.json();
|
|
6132
|
-
if (data?.masters?.classic == null) {
|
|
6133
|
-
throw new SonarRequestException({ innerException: new Error("Missing required data in response.") });
|
|
6134
|
-
}
|
|
6135
|
-
return data;
|
|
6136
|
-
} else {
|
|
6137
|
-
const data = await response.json();
|
|
6138
|
-
throw new SonarRequestException({ innerException: new Error(data?.error ?? data) });
|
|
6139
|
-
}
|
|
6140
|
-
}
|
|
6141
|
-
|
|
6142
|
-
// src/functions/audio/get-audio-data-classic.ts
|
|
6143
|
-
async function getAudioDataClassic(sonarEndpoint) {
|
|
6144
|
-
const data = await requestVolumeSettingsClassic(sonarEndpoint);
|
|
6145
|
-
const volumeData = {
|
|
6146
|
-
["master" /* Master */]: createResponseVolumeData(data.masters.classic),
|
|
6147
|
-
["game" /* Game */]: data.devices.game && createResponseVolumeData(data.devices.game.classic),
|
|
6148
|
-
["chat" /* Chat */]: data.devices.chatRender && createResponseVolumeData(data.devices.chatRender.classic),
|
|
6149
|
-
["media" /* Media */]: data.devices.media && createResponseVolumeData(data.devices.media.classic),
|
|
6150
|
-
["aux" /* Aux */]: data.devices.aux && createResponseVolumeData(data.devices.aux.classic),
|
|
6151
|
-
["mic" /* Mic */]: data.devices.chatCapture && createResponseVolumeData(data.devices.chatCapture.classic)
|
|
6152
|
-
};
|
|
6153
|
-
return volumeData;
|
|
6154
|
-
}
|
|
6155
|
-
function createResponseVolumeData(volumeData) {
|
|
6156
|
-
return {
|
|
6157
|
-
volume: convertVolumeToUser(volumeData.volume),
|
|
6158
|
-
isMuted: volumeData.muted
|
|
6159
|
-
};
|
|
6160
|
-
}
|
|
6161
6161
|
// src/sonar/requests/volume-settings/request-volume-settings-streamer.ts
|
|
6162
6162
|
async function requestVolumeSettingsStreamer(sonarEndpoint) {
|
|
6163
6163
|
let response;
|