{/* Start Go Server Options */}

### Select Server by Index

You can override the default server globally using the `WithServerIndex` option 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:



#### Example

```go
package main

import (
	"context"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/components"
	"log"
)

func main() {
	s := plexgo.New(
		plexgo.WithServerIndex(0),
		plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
		plexgo.WithXPlexClientIdentifier("<value>"),
	)

	ctx := context.Background()
	res, err := s.Server.GetServerCapabilities(ctx)
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

```

#### Variables

Some of the server options above contain variables. If you want to set the values of those variables, the following options are provided for doing so:
 * `WithProtocol plexgo.ServerProtocol`
 * `WithIP string`
 * `WithPort string`

### Override Server URL Per-Client

The default server can also be overridden globally using the `WithServerURL` option when initializing the SDK client instance. For example:
```go
package main

import (
	"context"
	"github.com/LukeHagar/plexgo"
	"github.com/LukeHagar/plexgo/models/components"
	"log"
)

func main() {
	s := plexgo.New(
		plexgo.WithServerURL("{protocol}://{ip}:{port}"),
		plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
		plexgo.WithXPlexClientIdentifier("<value>"),
	)

	ctx := context.Background()
	res, err := s.Server.GetServerCapabilities(ctx)
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

```

### 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:
```go
package main

import (
	"context"
	"github.com/LukeHagar/plexgo"
	"log"
)

func main() {
	s := plexgo.New(
		plexgo.WithXPlexClientIdentifier("<value>"),
	)

	var strong *bool = plexgo.Bool(false)

	var xPlexClientIdentifier *string = plexgo.String("<value>")

	ctx := context.Background()
	res, err := s.Plex.GetPin(ctx, operations.WithServerURL("https://plex.tv/api/v2"), strong, xPlexClientIdentifier)
	if err != nil {
		log.Fatal(err)
	}
	if res.Object != nil {
		// handle response
	}
}

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