{/* Start Typescript Server Options */}


### Select Server by Index

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>",
        xPlexClientIdentifier: "<value>",
    });

    const result = await sdk.server.getServerCapabilities();

    // Handle the result
    console.log(result);
}

run();

```

#### Variables

Some of the server options above contain variables. If you want to set the values of those variables, the following optional parameters are available when initializing the SDK client instance:
 * `protocol: models.ServerProtocol`
 * `ip: string`
 * `port: string`

### Override Server URL Per-Client

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>",
        xPlexClientIdentifier: "<value>",
    });

    const result = await sdk.server.getServerCapabilities();

    // Handle the result
    console.log(result);
}

run();

```
### Override Server URL Per-Operation

The server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:

```typescript
import { PlexAPI } from "@lukehagar/plexjs";

async function run() {
    const sdk = new PlexAPI({
        xPlexClientIdentifier: "<value>",
    });

    const strong = false;
    const xPlexClientIdentifier = "<value>";

    const result = await sdk.plex.getPin(strong, xPlexClientIdentifier, {
        serverURL: "https://plex.tv/api/v2",
    });

    // Handle the result
    console.log(result);
}

run();

```
{/* End Typescript Server Options */}
