mirror of
https://github.com/LukeHagar/plex-sdk-docs.git
synced 2025-12-06 12:37:46 +00:00
37 lines
1.2 KiB
Plaintext
37 lines
1.2 KiB
Plaintext
{/* Start Go Global Parameters */}
|
|
A parameter is configured globally. This parameter must be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed.
|
|
|
|
For example, you can set `X-Plex-Client-Identifier` to `"Postman"` at SDK initialization and then you do not have to pass the same value on calls to operations like `GetPin`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.
|
|
|
|
|
|
|
|
|
|
```go
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"github.com/LukeHagar/plexgo"
|
|
"log"
|
|
)
|
|
|
|
func main() {
|
|
s := plexgo.New(
|
|
plexgo.WithXPlexClientIdentifier("Postman"),
|
|
)
|
|
var strong *bool = plexgo.Bool(false)
|
|
|
|
var xPlexClientIdentifier *string = plexgo.String("Postman")
|
|
ctx := context.Background()
|
|
res, err := s.Plex.GetPin(ctx, strong, xPlexClientIdentifier)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
if res.Object != nil {
|
|
// handle response
|
|
}
|
|
}
|
|
|
|
```
|
|
{/* End Go Global Parameters */}
|