ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.141.1

This commit is contained in:
speakeasybot
2024-01-16 00:31:58 +00:00
parent a7571169c9
commit 15dc26380f
127 changed files with 474 additions and 742 deletions

View File

@@ -14,20 +14,23 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.server.getServerCapabilities().catch((err) => {
if (err instanceof errors.GetServerCapabilitiesResponseBody) {
console.error(err); // handle exception
return null;
} else {
throw err;
let result;
try {
result = await sdk.server.getServerCapabilities();
} catch (err) {
switch (true) {
case err instanceof errors.GetServerCapabilitiesResponseBody: {
console.error(err); // handle exception
return;
}
default: {
throw err;
}
}
});
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result);
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const activityUUID = "string";
const res = await sdk.activities.cancelServerActivities(activityUUID);
const result = await sdk.activities.cancelServerActivities(activityUUID);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.activities.getServerActivities();
const result = await sdk.activities.getServerActivities();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.butler.getButlerTasks();
const result = await sdk.butler.getButlerTasks();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.butler.startAllTasks();
const result = await sdk.butler.startAllTasks();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -11,13 +11,10 @@ async function run() {
const taskName = TaskName.RefreshPeriodicMetadata;
const res = await sdk.butler.startTask(taskName);
const result = await sdk.butler.startTask(taskName);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.butler.stopAllTasks();
const result = await sdk.butler.stopAllTasks();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -11,13 +11,10 @@ async function run() {
const taskName = PathParamTaskName.GenerateChapterThumbs;
const res = await sdk.butler.stopTask(taskName);
const result = await sdk.butler.stopTask(taskName);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const count = 8472.52;
const onlyTransient = OnlyTransient.Zero;
const res = await sdk.hubs.getGlobalHubs(count, onlyTransient);
const result = await sdk.hubs.getGlobalHubs(count, onlyTransient);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -13,13 +13,10 @@ async function run() {
const count = 6458.94;
const onlyTransient = QueryParamOnlyTransient.Zero;
const res = await sdk.hubs.getLibraryHubs(sectionId, count, onlyTransient);
const result = await sdk.hubs.getLibraryHubs(sectionId, count, onlyTransient);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const sectionId = 1000;
const res = await sdk.library.deleteLibrary(sectionId);
const result = await sdk.library.deleteLibrary(sectionId);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const type = 4799.77;
const filter = "string";
const res = await sdk.library.getCommonLibraryItems(sectionId, type, filter);
const result = await sdk.library.getCommonLibraryItems(sectionId, type, filter);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -11,13 +11,10 @@ async function run() {
const url = "file://C:\Image.png&type=13";
const type = 567.13;
const res = await sdk.library.getFileHash(url, type);
const result = await sdk.library.getFileHash(url, type);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const type = 8121.69;
const filter = "string";
const res = await sdk.library.getLatestLibraryItems(sectionId, type, filter);
const result = await sdk.library.getLatestLibraryItems(sectionId, type, filter);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.library.getLibraries();
const result = await sdk.library.getLibraries();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const sectionId = 1000;
const includeDetails = IncludeDetails.One;
const res = await sdk.library.getLibrary(sectionId, includeDetails);
const result = await sdk.library.getLibrary(sectionId, includeDetails);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const type = 3834.41;
const filter = "string";
const res = await sdk.library.getLibraryItems(sectionId, type, filter);
const result = await sdk.library.getLibraryItems(sectionId, type, filter);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const ratingKey = 5680.45;
const res = await sdk.library.getMetadata(ratingKey);
const result = await sdk.library.getMetadata(ratingKey);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const ratingKey = 3927.85;
const res = await sdk.library.getMetadataChildren(ratingKey);
const result = await sdk.library.getMetadataChildren(ratingKey);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.library.getOnDeck();
const result = await sdk.library.getOnDeck();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.library.getRecentlyAdded();
const result = await sdk.library.getRecentlyAdded();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const sectionId = 4776.65;
const res = await sdk.library.refreshLibrary(sectionId);
const result = await sdk.library.refreshLibrary(sectionId);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.log.enablePaperTrail();
const result = await sdk.log.enablePaperTrail();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -13,13 +13,10 @@ async function run() {
const message = "string";
const source = "string";
const res = await sdk.log.logLine(level, message, source);
const result = await sdk.log.logLine(level, message, source);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.log.logMultiLine();
const result = await sdk.log.logMultiLine();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const key = 59398;
const res = await sdk.media.markPlayed(key);
const result = await sdk.media.markPlayed(key);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const key = 59398;
const res = await sdk.media.markUnplayed(key);
const result = await sdk.media.markUnplayed(key);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const time = 6027.63;
const state = "string";
const res = await sdk.media.updatePlayProgress(key, time, state);
const result = await sdk.media.updatePlayProgress(key, time, state);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const uri = "library://..";
const playQueueID = 123;
const res = await sdk.playlists.addPlaylistContents(playlistID, uri, playQueueID);
const result = await sdk.playlists.addPlaylistContents(playlistID, uri, playQueueID);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const playlistID = 7781.57;
const res = await sdk.playlists.clearPlaylistContents(playlistID);
const result = await sdk.playlists.clearPlaylistContents(playlistID);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -9,17 +9,14 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.playlists.createPlaylist({
const result = await sdk.playlists.createPlaylist({
title: "string",
type: TypeT.Photo,
smart: Smart.Zero,
});
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const playlistID = 202.18;
const res = await sdk.playlists.deletePlaylist(playlistID);
const result = await sdk.playlists.deletePlaylist(playlistID);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const playlistID = 6481.72;
const res = await sdk.playlists.getPlaylist(playlistID);
const result = await sdk.playlists.getPlaylist(playlistID);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -11,13 +11,10 @@ async function run() {
const playlistID = 8326.2;
const type = 9571.56;
const res = await sdk.playlists.getPlaylistContents(playlistID, type);
const result = await sdk.playlists.getPlaylistContents(playlistID, type);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const playlistType = PlaylistType.Video;
const smart = QueryParamSmart.Zero;
const res = await sdk.playlists.getPlaylists(playlistType, smart);
const result = await sdk.playlists.getPlaylists(playlistType, smart);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const playlistID = 3682.41;
const res = await sdk.playlists.updatePlaylist(playlistID);
const result = await sdk.playlists.updatePlaylist(playlistID);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const path = "/home/barkley/playlist.m3u";
const force = Force.One;
const res = await sdk.playlists.uploadPlaylist(path, force);
const result = await sdk.playlists.uploadPlaylist(path, force);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const query = "110";
const res = await sdk.search.getSearchResults(query);
const result = await sdk.search.getSearchResults(query);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const sectionId = 2975.34;
const limit = 5;
const res = await sdk.search.performSearch(query, sectionId, limit);
const result = await sdk.search.performSearch(query, sectionId, limit);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const sectionId = 8917.73;
const limit = 5;
const res = await sdk.search.performVoiceSearch(query, sectionId, limit);
const result = await sdk.search.performVoiceSearch(query, sectionId, limit);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const source = "provider://provider-identifier";
const res = await sdk.security.getSourceConnectionInformation(source);
const result = await sdk.security.getSourceConnectionInformation(source);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const type = QueryParamType.Delegation;
const scope = Scope.All;
const res = await sdk.security.getTransientToken(type, scope);
const result = await sdk.security.getTransientToken(type, scope);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.server.getAvailableClients();
const result = await sdk.server.getAvailableClients();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.server.getDevices();
const result = await sdk.server.getDevices();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.server.getMyPlexAccount();
const result = await sdk.server.getMyPlexAccount();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -9,7 +9,7 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.server.getResizedPhoto({
const result = await sdk.server.getResizedPhoto({
width: 110,
height: 165,
opacity: 548814,
@@ -19,11 +19,8 @@ async function run() {
url: "/library/metadata/49564/thumb/1654258204",
});
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.server.getServerCapabilities();
const result = await sdk.server.getServerCapabilities();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.server.getServerIdentity();
const result = await sdk.server.getServerIdentity();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.server.getServerList();
const result = await sdk.server.getServerList();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.server.getServerPreferences();
const result = await sdk.server.getServerPreferences();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.sessions.getSessionHistory();
const result = await sdk.sessions.getSessionHistory();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.sessions.getSessions();
const result = await sdk.sessions.getSessions();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.sessions.getTranscodeSessions();
const result = await sdk.sessions.getTranscodeSessions();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -10,13 +10,10 @@ async function run() {
const sessionKey = "zz7llzqlx8w9vnrsbnwhbmep";
const res = await sdk.sessions.stopTranscodeSession(sessionKey);
const result = await sdk.sessions.stopTranscodeSession(sessionKey);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -12,13 +12,10 @@ async function run() {
const tonight = Tonight.Zero;
const skip = Skip.One;
const res = await sdk.updater.applyUpdates(tonight, skip);
const result = await sdk.updater.applyUpdates(tonight, skip);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -11,13 +11,10 @@ async function run() {
const download = Download.One;
const res = await sdk.updater.checkForUpdates(download);
const result = await sdk.updater.checkForUpdates(download);
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,13 +8,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.updater.getUpdateStatus();
const result = await sdk.updater.getUpdateStatus();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -9,7 +9,7 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.video.getTimeline({
const result = await sdk.video.getTimeline({
ratingKey: 6788.8,
key: "<key>",
state: State.Playing,
@@ -22,11 +22,8 @@ async function run() {
row: 9446.69,
});
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -8,7 +8,7 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.video.startUniversalTranscode({
const result = await sdk.video.startUniversalTranscode({
hasMDE: 8009.11,
path: "/private",
mediaIndex: 5204.78,
@@ -16,11 +16,8 @@ async function run() {
protocol: "string",
});
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result)
}
run();

View File

@@ -14,13 +14,10 @@ async function run() {
accessToken: "<YOUR_API_KEY_HERE>",
});
const res = await sdk.server.getServerCapabilities();
const result = await sdk.server.getServerCapabilities();
if (res?.statusCode !== 200) {
throw new Error("Unexpected status code: " + res?.statusCode || "-");
}
// handle response
// Handle the result
console.log(result);
}
run();

View File

@@ -3,11 +3,28 @@
### Select Server by Index
You can override the default server globally by passing a server index to the `serverIdx: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
You can override the default server globally by passing a server index to the `serverIdx` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
```typescript
import { PlexAPI } from "@lukehagar/plexjs";
async function run() {
const sdk = new PlexAPI({
serverIdx: 0,
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getServerCapabilities();
// Handle the result
console.log(result);
}
run();
```
#### Variables
@@ -18,6 +35,24 @@ Some of the server options above contain variables. If you want to set the value
### Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the `serverURL: str` optional parameter when initializing the SDK client instance. For example:
The default server can also be overridden globally by passing a URL to the `serverURL` optional parameter when initializing the SDK client instance. For example:
```typescript
import { PlexAPI } from "@lukehagar/plexjs";
async function run() {
const sdk = new PlexAPI({
serverURL: "{protocol}://{ip}:{port}",
accessToken: "<YOUR_API_KEY_HERE>",
});
const result = await sdk.server.getServerCapabilities();
// Handle the result
console.log(result);
}
run();
```
{/* End Typescript Server Options */}