mirror of
https://github.com/LukeHagar/plex-sdk-docs.git
synced 2025-12-07 20:47:48 +00:00
ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.303.0
This commit is contained in:
@@ -12,7 +12,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/LukeHagar/plexgo"
|
||||
"github.com/LukeHagar/plexgo/models/components"
|
||||
"github.com/LukeHagar/plexgo/models/sdkerrors"
|
||||
"log"
|
||||
)
|
||||
@@ -20,6 +19,7 @@ import (
|
||||
func main() {
|
||||
s := plexgo.New(
|
||||
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
||||
plexgo.WithXPlexClientIdentifier("Postman"),
|
||||
)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
36
content/pages/01-reference/go/global_parameters/_snippet.mdx
Normal file
36
content/pages/01-reference/go/global_parameters/_snippet.mdx
Normal file
@@ -0,0 +1,36 @@
|
||||
{/* 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 */}
|
||||
@@ -0,0 +1,6 @@
|
||||
import LanguageSelector from 'src/components/LanguageSelector';
|
||||
import { H2 } from "src/components/TextHeaderWrapper";
|
||||
|
||||
<H2>Global Parameters <LanguageSelector/></H2>
|
||||
|
||||
{/* render global_parameters */}
|
||||
@@ -6,6 +6,7 @@ import ClientSDKs from "./client_sdks/client_sdks.mdx";
|
||||
import Installation from "./installation/installation.mdx";
|
||||
import CustomClient from "./custom_http_client/custom_http_client.mdx";
|
||||
import SecurityOptions from "./security_options/security_options.mdx";
|
||||
import Globals from "./global_parameters/global_parameters.mdx";
|
||||
import Errors from "./errors/errors.mdx";
|
||||
import ServerOptions from "./server_options/server_options.mdx";
|
||||
import Resources from "./resources/resources.mdx";
|
||||
@@ -29,6 +30,10 @@ import Resources from "./resources/resources.mdx";
|
||||
|
||||
---
|
||||
|
||||
<Globals/>
|
||||
|
||||
---
|
||||
|
||||
<Errors/>
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import GetTransientToken from "./get_transient_token/get_transient_token.mdx";
|
||||
import GetSourceConnectionInformation from "./get_source_connection_information/get_source_connection_information.mdx";
|
||||
|
||||
## Authentication
|
||||
API Calls regarding authentication for Plex Media Server
|
||||
|
||||
|
||||
### Available Operations
|
||||
|
||||
* [Get Transient Token](/go/authentication/get_transient_token) - Get a Transient Token.
|
||||
* [Get Source Connection Information](/go/authentication/get_source_connection_information) - Get Source Connection Information
|
||||
|
||||
---
|
||||
<GetTransientToken />
|
||||
|
||||
---
|
||||
<GetSourceConnectionInformation />
|
||||
@@ -0,0 +1,4 @@
|
||||
## Get Source Connection Information
|
||||
|
||||
If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token.
|
||||
Note: requires Plex Media Server >= 1.15.4.
|
||||
@@ -3,8 +3,8 @@
|
||||
The context to use for the request.
|
||||
|
||||
---
|
||||
##### `timespan` *{`*int64`}*
|
||||
The timespan to retrieve statistics for
|
||||
the exact meaning of this parameter is not known
|
||||
|
||||
##### `source` *{`string`}*
|
||||
The source identifier with an included prefix.
|
||||
<br/>
|
||||
**Example:** `server://client-identifier`
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
import GetStatisticsResponse from "/content/types/models/operations/get_statistics_response/go.mdx"
|
||||
import GetSourceConnectionInformationResponse from "/content/types/models/operations/get_source_connection_information_response/go.mdx"
|
||||
import Collapsible from "/src/components/Collapsible";
|
||||
import Labels from "/src/lib/labels";
|
||||
|
||||
##### *{`*operations.GetStatisticsResponse`}*
|
||||
##### *{`*operations.GetSourceConnectionInformationResponse`}*
|
||||
|
||||
<Collapsible defaultOpen openLabel={Labels.showProperties} closeLabel={Labels.hideProperties}>
|
||||
<GetStatisticsResponse />
|
||||
<GetSourceConnectionInformationResponse />
|
||||
</Collapsible>
|
||||
|
||||
|
||||
@@ -1,33 +1,26 @@
|
||||
|
||||
<CH.Code>
|
||||
```go GetToken.go
|
||||
```go GetSourceConnectionInformation.go
|
||||
package main
|
||||
|
||||
import(
|
||||
"github.com/LukeHagar/plexgo/models/components"
|
||||
"github.com/LukeHagar/plexgo"
|
||||
"context"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := plexgo.New(
|
||||
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
||||
plexgo.WithXPlexClientIdentifier("Postman"),
|
||||
)
|
||||
|
||||
|
||||
var pinID string = "<value>"
|
||||
|
||||
var xPlexClientIdentifier string = "<value>"
|
||||
|
||||
var source string = "provider://provider-identifier"
|
||||
ctx := context.Background()
|
||||
res, err := s.Plex.GetToken(ctx, pinID, xPlexClientIdentifier)
|
||||
res, err := s.Authentication.GetSourceConnectionInformation(ctx, source)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if res.StatusCode == http.StatusOK {
|
||||
if res != nil {
|
||||
// handle response
|
||||
}
|
||||
}
|
||||
@@ -38,11 +31,12 @@ func main() {
|
||||
{
|
||||
"errors": [
|
||||
{
|
||||
"code": 1000,
|
||||
"message": "X-Plex-Client-Identifier is missing",
|
||||
"status": 400
|
||||
"code": 1001,
|
||||
"message": "User could not be authenticated",
|
||||
"status": 401
|
||||
}
|
||||
]
|
||||
],
|
||||
"HttpMeta": {}
|
||||
}
|
||||
```
|
||||
</CH.Code>
|
||||
@@ -2,7 +2,7 @@ import CurlHeader from './_header.mdx';
|
||||
import SDKHeader from './_header.mdx';
|
||||
import OperationHeader from '/src/components/OperationHeader';
|
||||
|
||||
###### *Plex*
|
||||
###### *Authentication*
|
||||
|
||||
<OperationHeader
|
||||
sdkHeader={<SDKHeader />}
|
||||
@@ -0,0 +1,3 @@
|
||||
## Get Transient Token
|
||||
|
||||
This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted.
|
||||
@@ -0,0 +1,25 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
import GetTransientTokenQueryParamType from "/content/types/models/operations/get_transient_token_query_param_type/go.mdx"
|
||||
import Scope from "/content/types/models/operations/scope/go.mdx"
|
||||
import Collapsible from "/src/components/Collapsible";
|
||||
import Labels from "/src/lib/labels";
|
||||
|
||||
##### `ctx` [*{ `context.Context` }*](https://pkg.go.dev/context#Context)
|
||||
The context to use for the request.
|
||||
|
||||
---
|
||||
##### `type_` *{`operations.GetTransientTokenQueryParamType`}*
|
||||
`delegation` \- This is the only supported `type` parameter.
|
||||
|
||||
<Collapsible openLabel={Labels.showProperties} closeLabel={Labels.hideProperties}>
|
||||
<GetTransientTokenQueryParamType />
|
||||
</Collapsible>
|
||||
|
||||
---
|
||||
##### `scope` *{`operations.Scope`}*
|
||||
`all` \- This is the only supported `scope` parameter.
|
||||
|
||||
<Collapsible openLabel={Labels.showProperties} closeLabel={Labels.hideProperties}>
|
||||
<Scope />
|
||||
</Collapsible>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
import GetTokenResponse from "/content/types/models/operations/get_token_response/go.mdx"
|
||||
import GetTransientTokenResponse from "/content/types/models/operations/get_transient_token_response/go.mdx"
|
||||
import Collapsible from "/src/components/Collapsible";
|
||||
import Labels from "/src/lib/labels";
|
||||
|
||||
##### *{`*operations.GetTokenResponse`}*
|
||||
##### *{`*operations.GetTransientTokenResponse`}*
|
||||
|
||||
<Collapsible defaultOpen openLabel={Labels.showProperties} closeLabel={Labels.hideProperties}>
|
||||
<GetTokenResponse />
|
||||
<GetTransientTokenResponse />
|
||||
</Collapsible>
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
<CH.Code>
|
||||
```go GetTransientToken.go
|
||||
package main
|
||||
|
||||
import(
|
||||
"github.com/LukeHagar/plexgo"
|
||||
"github.com/LukeHagar/plexgo/models/operations"
|
||||
"context"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := plexgo.New(
|
||||
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
||||
plexgo.WithXPlexClientIdentifier("Postman"),
|
||||
)
|
||||
var type_ operations.GetTransientTokenQueryParamType = operations.GetTransientTokenQueryParamTypeDelegation
|
||||
|
||||
var scope operations.Scope = operations.ScopeAll
|
||||
ctx := context.Background()
|
||||
res, err := s.Authentication.GetTransientToken(ctx, type_, scope)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if res != nil {
|
||||
// handle response
|
||||
}
|
||||
}
|
||||
```
|
||||
---
|
||||
|
||||
```json Example Response
|
||||
{
|
||||
"errors": [
|
||||
{
|
||||
"code": 1001,
|
||||
"message": "User could not be authenticated",
|
||||
"status": 401
|
||||
}
|
||||
],
|
||||
"HttpMeta": {}
|
||||
}
|
||||
```
|
||||
</CH.Code>
|
||||
@@ -2,7 +2,7 @@ import CurlHeader from './_header.mdx';
|
||||
import SDKHeader from './_header.mdx';
|
||||
import OperationHeader from '/src/components/OperationHeader';
|
||||
|
||||
###### *Plex*
|
||||
###### *Authentication*
|
||||
|
||||
<OperationHeader
|
||||
sdkHeader={<SDKHeader />}
|
||||
@@ -1,3 +0,0 @@
|
||||
## Get Pin
|
||||
|
||||
Retrieve a Pin from Plex.tv for authentication flows
|
||||
@@ -1,22 +0,0 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
##### `ctx` [*{ `context.Context` }*](https://pkg.go.dev/context#Context)
|
||||
The context to use for the request.
|
||||
|
||||
---
|
||||
##### `xPlexClientIdentifier` *{`string`}*
|
||||
The unique identifier for the client application
|
||||
This is used to track the client application and its usage
|
||||
(UUID, serial number, or other number unique per device)
|
||||
|
||||
|
||||
---
|
||||
##### `strong` *{`*bool`}*
|
||||
Determines the kind of code returned by the API call
|
||||
Strong codes are used for Pin authentication flows
|
||||
Non\-Strong codes are used for `Plex.tv/link`
|
||||
|
||||
|
||||
---
|
||||
##### `opts` *{`[]operations.Option`}*
|
||||
The options for this request.
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
import GetPinResponse from "/content/types/models/operations/get_pin_response/go.mdx"
|
||||
import Collapsible from "/src/components/Collapsible";
|
||||
import Labels from "/src/lib/labels";
|
||||
|
||||
##### *{`*operations.GetPinResponse`}*
|
||||
|
||||
<Collapsible defaultOpen openLabel={Labels.showProperties} closeLabel={Labels.hideProperties}>
|
||||
<GetPinResponse />
|
||||
</Collapsible>
|
||||
|
||||
|
||||
---
|
||||
##### *{`error`}*
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
|
||||
<CH.Code>
|
||||
```go GetPin.go
|
||||
package main
|
||||
|
||||
import(
|
||||
"github.com/LukeHagar/plexgo/models/components"
|
||||
"github.com/LukeHagar/plexgo"
|
||||
"context"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := plexgo.New(
|
||||
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
||||
)
|
||||
|
||||
|
||||
var xPlexClientIdentifier string = "<value>"
|
||||
|
||||
var strong *bool = plexgo.Bool(false)
|
||||
|
||||
ctx := context.Background()
|
||||
res, err := s.Plex.GetPin(ctx, xPlexClientIdentifier, strong)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if res.Object != nil {
|
||||
// handle response
|
||||
}
|
||||
}
|
||||
```
|
||||
---
|
||||
|
||||
```json Example Response
|
||||
{
|
||||
"id": 1272322473,
|
||||
"code": "3patfx1a78ukcbr7x0n9bl26t",
|
||||
"product": "Plex Web",
|
||||
"trusted": false,
|
||||
"qr": "https://plex.tv/api/v2/pins/qr/3patfx1a78ukcbr7x0n9bl26t",
|
||||
"clientIdentifier": "Postman",
|
||||
"location": {
|
||||
"code": "US",
|
||||
"european_union_member": false,
|
||||
"continent_code": "NA",
|
||||
"country": "United States",
|
||||
"city": "Austin",
|
||||
"time_zone": "America/Chicago",
|
||||
"postal_code": 78732,
|
||||
"in_privacy_restricted_country": false,
|
||||
"subdivisions": "Texas",
|
||||
"coordinates": "30.3768 -97.8935"
|
||||
},
|
||||
"expiresIn": 1800,
|
||||
"createdAt": "2023-04-12T17:00:03Z",
|
||||
"expiresAt": "2023-04-12T17:30:03Z",
|
||||
"authToken": "None",
|
||||
"newRegistration": "None"
|
||||
}
|
||||
```
|
||||
</CH.Code>
|
||||
@@ -1,3 +0,0 @@
|
||||
## Get Token
|
||||
|
||||
Retrieve an Access Token from Plex.tv after the Pin has already been authenticated
|
||||
@@ -1,19 +0,0 @@
|
||||
{/* Autogenerated DO NOT EDIT */}
|
||||
##### `ctx` [*{ `context.Context` }*](https://pkg.go.dev/context#Context)
|
||||
The context to use for the request.
|
||||
|
||||
---
|
||||
##### `pinID` *{`string`}*
|
||||
The PinID to retrieve an access token for
|
||||
|
||||
---
|
||||
##### `xPlexClientIdentifier` *{`string`}*
|
||||
The unique identifier for the client application
|
||||
This is used to track the client application and its usage
|
||||
(UUID, serial number, or other number unique per device)
|
||||
|
||||
|
||||
---
|
||||
##### `opts` *{`[]operations.Option`}*
|
||||
The options for this request.
|
||||
|
||||
@@ -13,7 +13,7 @@ import Library from "./library/library.mdx";
|
||||
import Log from "./log/log.mdx";
|
||||
import Plex from "./plex/plex.mdx";
|
||||
import Playlists from "./playlists/playlists.mdx";
|
||||
import Security from "./security/security.mdx";
|
||||
import Authentication from "./authentication/authentication.mdx";
|
||||
import Statistics from "./statistics/statistics.mdx";
|
||||
import Sessions from "./sessions/sessions.mdx";
|
||||
import Updater from "./updater/updater.mdx";
|
||||
@@ -51,7 +51,7 @@ import Updater from "./updater/updater.mdx";
|
||||
<Playlists/>
|
||||
|
||||
---
|
||||
<Security/>
|
||||
<Authentication/>
|
||||
|
||||
---
|
||||
<Statistics/>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
## Get Statistics
|
||||
|
||||
This will return the media statistics for the server
|
||||
@@ -1,44 +0,0 @@
|
||||
|
||||
<CH.Code>
|
||||
```go GetStatistics.go
|
||||
package main
|
||||
|
||||
import(
|
||||
"github.com/LukeHagar/plexgo/models/components"
|
||||
"github.com/LukeHagar/plexgo"
|
||||
"context"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := plexgo.New(
|
||||
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
||||
)
|
||||
|
||||
|
||||
var timespan *int64 = plexgo.Int64(944669)
|
||||
|
||||
ctx := context.Background()
|
||||
res, err := s.Statistics.GetStatistics(ctx, timespan)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if res.Object != nil {
|
||||
// handle response
|
||||
}
|
||||
}
|
||||
```
|
||||
---
|
||||
|
||||
```json Example Response
|
||||
{
|
||||
"MediaContainer": {
|
||||
"size": 5497,
|
||||
"Device": [],
|
||||
"Account": [],
|
||||
"StatisticsMedia": []
|
||||
}
|
||||
}
|
||||
```
|
||||
</CH.Code>
|
||||
@@ -1,12 +0,0 @@
|
||||
import CurlHeader from './_header.mdx';
|
||||
import SDKHeader from './_header.mdx';
|
||||
import OperationHeader from '/src/components/OperationHeader';
|
||||
|
||||
###### *Statistics*
|
||||
|
||||
<OperationHeader
|
||||
sdkHeader={<SDKHeader />}
|
||||
curlHeader={<CurlHeader />}
|
||||
/>
|
||||
|
||||
{/* render operation */}
|
||||
@@ -1,12 +0,0 @@
|
||||
import GetStatistics from "./get_statistics/get_statistics.mdx";
|
||||
|
||||
## Statistics
|
||||
API Calls that perform operations with Plex Media Server Statistics
|
||||
|
||||
|
||||
### Available Operations
|
||||
|
||||
* [Get Statistics](/go/statistics/get_statistics) - Get Media Statistics
|
||||
|
||||
---
|
||||
<GetStatistics />
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
func main() {
|
||||
s := plexgo.New(
|
||||
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
||||
plexgo.WithXPlexClientIdentifier("Postman"),
|
||||
)
|
||||
|
||||
ctx := context.Background()
|
||||
@@ -25,7 +26,6 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if res.Object != nil {
|
||||
// handle response
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"github.com/LukeHagar/plexgo"
|
||||
"github.com/LukeHagar/plexgo/models/components"
|
||||
"log"
|
||||
)
|
||||
|
||||
@@ -22,6 +21,7 @@ func main() {
|
||||
s := plexgo.New(
|
||||
plexgo.WithServerIndex(0),
|
||||
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
||||
plexgo.WithXPlexClientIdentifier("Postman"),
|
||||
)
|
||||
|
||||
ctx := context.Background()
|
||||
@@ -29,7 +29,6 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if res.Object != nil {
|
||||
// handle response
|
||||
}
|
||||
@@ -53,7 +52,6 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"github.com/LukeHagar/plexgo"
|
||||
"github.com/LukeHagar/plexgo/models/components"
|
||||
"log"
|
||||
)
|
||||
|
||||
@@ -61,6 +59,7 @@ func main() {
|
||||
s := plexgo.New(
|
||||
plexgo.WithServerURL("{protocol}://{ip}:{port}"),
|
||||
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
||||
plexgo.WithXPlexClientIdentifier("Postman"),
|
||||
)
|
||||
|
||||
ctx := context.Background()
|
||||
@@ -68,7 +67,6 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if res.Object != nil {
|
||||
// handle response
|
||||
}
|
||||
@@ -85,25 +83,22 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"github.com/LukeHagar/plexgo"
|
||||
"github.com/LukeHagar/plexgo/models/components"
|
||||
"github.com/LukeHagar/plexgo/models/operations"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := plexgo.New(
|
||||
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
||||
plexgo.WithXPlexClientIdentifier("Postman"),
|
||||
)
|
||||
|
||||
var xPlexClientIdentifier string = "<value>"
|
||||
|
||||
var strong *bool = plexgo.Bool(false)
|
||||
|
||||
var xPlexClientIdentifier *string = plexgo.String("Postman")
|
||||
ctx := context.Background()
|
||||
res, err := s.Plex.GetPin(ctx, operations.WithServerURL("https://plex.tv/api/v2"), xPlexClientIdentifier, strong)
|
||||
res, err := s.Plex.GetPin(ctx, strong, xPlexClientIdentifier, operations.WithServerURL("https://plex.tv/api/v2"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if res.Object != nil {
|
||||
// handle response
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user