mirror of
https://github.com/LukeHagar/plexgo.git
synced 2025-12-06 12:37:46 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1bc2419c8 | ||
|
|
471d850f17 |
@@ -1,12 +1,12 @@
|
||||
lockVersion: 2.0.0
|
||||
id: dfa99515-01c0-42eb-9be5-ee212fd03eb3
|
||||
management:
|
||||
docChecksum: 49e77b550f057eb568502dc74fee7cce
|
||||
docChecksum: 94439465ae5d544f0e52b00719af05ee
|
||||
docVersion: 0.0.3
|
||||
speakeasyVersion: internal
|
||||
generationVersion: 2.237.3
|
||||
releaseVersion: 0.1.2
|
||||
configChecksum: 6e7156b73170398db5f73b78a4f03b59
|
||||
generationVersion: 2.239.4
|
||||
releaseVersion: 0.2.0
|
||||
configChecksum: cab54fc8ee2784bf822df0198252c4f5
|
||||
repoURL: https://github.com/LukeHagar/plexgo.git
|
||||
repoSubDirectory: .
|
||||
installationURL: https://github.com/LukeHagar/plexgo
|
||||
@@ -18,6 +18,7 @@ features:
|
||||
flattening: 2.81.1
|
||||
globalSecurity: 2.82.4
|
||||
globalServerURLs: 2.82.1
|
||||
methodServerURLs: 2.82.1
|
||||
nameOverrides: 2.81.1
|
||||
unions: 2.85.2
|
||||
generatedFiles:
|
||||
@@ -29,6 +30,8 @@ generatedFiles:
|
||||
- search.go
|
||||
- library.go
|
||||
- log.go
|
||||
- tv.go
|
||||
- plex.go
|
||||
- playlists.go
|
||||
- security.go
|
||||
- sessions.go
|
||||
@@ -90,6 +93,8 @@ generatedFiles:
|
||||
- /models/operations/logline.go
|
||||
- /models/operations/logmultiline.go
|
||||
- /models/operations/enablepapertrail.go
|
||||
- /models/operations/getpin.go
|
||||
- /models/operations/gettoken.go
|
||||
- /models/operations/createplaylist.go
|
||||
- /models/operations/getplaylists.go
|
||||
- /models/operations/getplaylist.go
|
||||
@@ -145,6 +150,8 @@ generatedFiles:
|
||||
- /models/sdkerrors/logline.go
|
||||
- /models/sdkerrors/logmultiline.go
|
||||
- /models/sdkerrors/enablepapertrail.go
|
||||
- /models/sdkerrors/getpin.go
|
||||
- /models/sdkerrors/gettoken.go
|
||||
- /models/sdkerrors/createplaylist.go
|
||||
- /models/sdkerrors/getplaylists.go
|
||||
- /models/sdkerrors/getplaylist.go
|
||||
@@ -275,7 +282,7 @@ generatedFiles:
|
||||
- docs/models/operations/getrecentlyaddedmediacontainer.md
|
||||
- docs/models/operations/getrecentlyaddedresponsebody.md
|
||||
- docs/models/operations/getrecentlyaddedresponse.md
|
||||
- docs/models/operations/location.md
|
||||
- docs/models/operations/getlibrarieslocation.md
|
||||
- docs/models/operations/getlibrariesdirectory.md
|
||||
- docs/models/operations/getlibrariesmediacontainer.md
|
||||
- docs/models/operations/getlibrariesresponsebody.md
|
||||
@@ -350,6 +357,12 @@ generatedFiles:
|
||||
- docs/models/operations/loglineresponse.md
|
||||
- docs/models/operations/logmultilineresponse.md
|
||||
- docs/models/operations/enablepapertrailresponse.md
|
||||
- docs/models/operations/getpinrequest.md
|
||||
- docs/models/operations/location.md
|
||||
- docs/models/operations/getpinresponsebody.md
|
||||
- docs/models/operations/getpinresponse.md
|
||||
- docs/models/operations/gettokenrequest.md
|
||||
- docs/models/operations/gettokenresponse.md
|
||||
- docs/models/operations/queryparamtype.md
|
||||
- docs/models/operations/smart.md
|
||||
- docs/models/operations/createplaylistrequest.md
|
||||
@@ -507,6 +520,10 @@ generatedFiles:
|
||||
- docs/models/sdkerrors/logmultilineresponsebody.md
|
||||
- docs/models/sdkerrors/enablepapertrailerrors.md
|
||||
- docs/models/sdkerrors/enablepapertrailresponsebody.md
|
||||
- docs/models/sdkerrors/getpinerrors.md
|
||||
- docs/models/sdkerrors/getpinresponsebody.md
|
||||
- docs/models/sdkerrors/gettokenerrors.md
|
||||
- docs/models/sdkerrors/gettokenresponsebody.md
|
||||
- docs/models/sdkerrors/createplaylisterrors.md
|
||||
- docs/models/sdkerrors/createplaylistresponsebody.md
|
||||
- docs/models/sdkerrors/getplaylistserrors.md
|
||||
@@ -557,10 +574,14 @@ generatedFiles:
|
||||
- docs/sdks/search/README.md
|
||||
- docs/sdks/library/README.md
|
||||
- docs/sdks/log/README.md
|
||||
- docs/sdks/plex/README.md
|
||||
- docs/models/operations/option.md
|
||||
- docs/sdks/tv/README.md
|
||||
- docs/sdks/playlists/README.md
|
||||
- docs/sdks/security/README.md
|
||||
- docs/sdks/sessions/README.md
|
||||
- docs/sdks/updater/README.md
|
||||
- docs/sdks/video/README.md
|
||||
- USAGE.md
|
||||
- models/operations/options.go
|
||||
- .gitattributes
|
||||
|
||||
41
README.md
41
README.md
@@ -113,6 +113,12 @@ func main() {
|
||||
* [LogMultiLine](docs/sdks/log/README.md#logmultiline) - Logging a multi-line message
|
||||
* [EnablePaperTrail](docs/sdks/log/README.md#enablepapertrail) - Enabling Papertrail
|
||||
|
||||
|
||||
### [Plex.Tv](docs/sdks/tv/README.md)
|
||||
|
||||
* [GetPin](docs/sdks/tv/README.md#getpin) - Get a Pin
|
||||
* [GetToken](docs/sdks/tv/README.md#gettoken) - Get Access Token
|
||||
|
||||
### [Playlists](docs/sdks/playlists/README.md)
|
||||
|
||||
* [CreatePlaylist](docs/sdks/playlists/README.md#createplaylist) - Create a Playlist
|
||||
@@ -278,6 +284,41 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### 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"
|
||||
"github.com/LukeHagar/plexgo/models/components"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := plexgo.New(
|
||||
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
|
||||
)
|
||||
|
||||
var xPlexClientIdentifier string = "string"
|
||||
|
||||
var strong *bool = false
|
||||
|
||||
ctx := context.Background()
|
||||
res, err := s.Plex.Tv.GetPin(ctx, operations.WithServerURL("https://plex.tv/api/v2"), xPlexClientIdentifier, strong)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if res.Object != nil {
|
||||
// handle response
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
<!-- End Server Selection [server] -->
|
||||
|
||||
|
||||
20
RELEASES.md
20
RELEASES.md
@@ -79,3 +79,23 @@ Based on:
|
||||
- [go v0.1.2] .
|
||||
### Releases
|
||||
- [Go v0.1.2] https://github.com/LukeHagar/plexgo/releases/tag/v0.1.2 - .
|
||||
|
||||
## 2024-01-23 21:56:10
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc 0.0.3
|
||||
- Speakeasy CLI 1.150.0 (2.237.3) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [go v0.1.3] .
|
||||
### Releases
|
||||
- [Go v0.1.3] https://github.com/LukeHagar/plexgo/releases/tag/v0.1.3 - .
|
||||
|
||||
## 2024-01-31 15:05:54
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc 0.0.3
|
||||
- Speakeasy CLI 1.158.0 (2.239.4) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [go v0.2.0] .
|
||||
### Releases
|
||||
- [Go v0.2.0] https://github.com/LukeHagar/plexgo/releases/tag/v0.2.0 - .
|
||||
@@ -4,7 +4,7 @@
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
||||
| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | true |
|
||||
| `Art` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg |
|
||||
| `Composite` | **string* | :heavy_minus_sign: | N/A | /library/sections/1/composite/1705615584 |
|
||||
@@ -25,4 +25,4 @@
|
||||
| `Directory` | **bool* | :heavy_minus_sign: | N/A | true |
|
||||
| `ContentChangedAt` | **int* | :heavy_minus_sign: | N/A | 3192854 |
|
||||
| `Hidden` | **int* | :heavy_minus_sign: | N/A | 0 |
|
||||
| `Location` | [][operations.Location](../../models/operations/location.md) | :heavy_minus_sign: | N/A | [{"id":1,"path":"/movies"}] |
|
||||
| `Location` | [][operations.GetLibrariesLocation](../../models/operations/getlibrarieslocation.md) | :heavy_minus_sign: | N/A | [{"id":1,"path":"/movies"}] |
|
||||
9
docs/models/operations/getlibrarieslocation.md
Normal file
9
docs/models/operations/getlibrarieslocation.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# GetLibrariesLocation
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `ID` | **int* | :heavy_minus_sign: | N/A | 1 |
|
||||
| `Path` | **string* | :heavy_minus_sign: | N/A | /movies |
|
||||
File diff suppressed because one or more lines are too long
@@ -27,6 +27,13 @@
|
||||
| `ChapterSource` | **string* | :heavy_minus_sign: | N/A | media |
|
||||
| `PrimaryExtraKey` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58684 |
|
||||
| `RatingImage` | **string* | :heavy_minus_sign: | N/A | rottentomatoes://image.rating.ripe |
|
||||
| `GrandparentRatingKey` | **string* | :heavy_minus_sign: | N/A | 66 |
|
||||
| `GrandparentGUID` | **string* | :heavy_minus_sign: | N/A | plex://show/5d9c081b170e24001f2a7be4 |
|
||||
| `GrandparentKey` | **string* | :heavy_minus_sign: | N/A | /library/metadata/66 |
|
||||
| `GrandparentTitle` | **string* | :heavy_minus_sign: | N/A | Caprica |
|
||||
| `GrandparentThumb` | **string* | :heavy_minus_sign: | N/A | /library/metadata/66/thumb/1705716261 |
|
||||
| `GrandparentArt` | **string* | :heavy_minus_sign: | N/A | /library/metadata/66/art/1705716261 |
|
||||
| `GrandparentTheme` | **string* | :heavy_minus_sign: | N/A | /library/metadata/66/theme/1705716261 |
|
||||
| `Media` | [][operations.GetLibraryItemsMedia](../../models/operations/getlibraryitemsmedia.md) | :heavy_minus_sign: | N/A | [{"Part":[{"container":"mkv","duration":11558112,"file":"/movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv","id":119542,"key":"/library/parts/119542/1680457526/file.mkv","size":36158371307,"videoProfile":"main 10"}],"aspectRatio":1.85,"audioChannels":6,"audioCodec":"eac3","bitrate":25025,"container":"mkv","duration":11558112,"height":2072,"id":119534,"videoCodec":"hevc","videoFrameRate":"24p","videoProfile":"main 10","videoResolution":"4k","width":3840}] |
|
||||
| `Genre` | [][operations.GetLibraryItemsGenre](../../models/operations/getlibraryitemsgenre.md) | :heavy_minus_sign: | N/A | [{"tag":"Adventure"}] |
|
||||
| `Country` | [][operations.GetLibraryItemsCountry](../../models/operations/getlibraryitemscountry.md) | :heavy_minus_sign: | N/A | [{"tag":"United States of America"}] |
|
||||
@@ -39,3 +46,19 @@
|
||||
| `OriginalTitle` | **string* | :heavy_minus_sign: | N/A | 映画 ブラッククローバー 魔法帝の剣 |
|
||||
| `ViewOffset` | **int* | :heavy_minus_sign: | N/A | 5222500 |
|
||||
| `SkipCount` | **int* | :heavy_minus_sign: | N/A | 1 |
|
||||
| `Index` | **int* | :heavy_minus_sign: | N/A | 1 |
|
||||
| `Theme` | **string* | :heavy_minus_sign: | N/A | /library/metadata/1/theme/1705636920 |
|
||||
| `LeafCount` | **int* | :heavy_minus_sign: | N/A | 14 |
|
||||
| `ViewedLeafCount` | **int* | :heavy_minus_sign: | N/A | 0 |
|
||||
| `ChildCount` | **int* | :heavy_minus_sign: | N/A | 1 |
|
||||
| `HasPremiumExtras` | **string* | :heavy_minus_sign: | N/A | 1 |
|
||||
| `HasPremiumPrimaryExtra` | **string* | :heavy_minus_sign: | N/A | 1 |
|
||||
| `ParentRatingKey` | **string* | :heavy_minus_sign: | N/A | 66 |
|
||||
| `ParentGUID` | **string* | :heavy_minus_sign: | N/A | plex://show/5d9c081b170e24001f2a7be4 |
|
||||
| `ParentStudio` | **string* | :heavy_minus_sign: | N/A | UCP |
|
||||
| `ParentKey` | **string* | :heavy_minus_sign: | N/A | /library/metadata/66 |
|
||||
| `ParentTitle` | **string* | :heavy_minus_sign: | N/A | Caprica |
|
||||
| `ParentIndex` | **int* | :heavy_minus_sign: | N/A | 1 |
|
||||
| `ParentYear` | **int* | :heavy_minus_sign: | N/A | 2010 |
|
||||
| `ParentThumb` | **string* | :heavy_minus_sign: | N/A | /library/metadata/66/thumb/1705716261 |
|
||||
| `ParentTheme` | **string* | :heavy_minus_sign: | N/A | /library/metadata/66/theme/1705716261 |
|
||||
9
docs/models/operations/getpinrequest.md
Normal file
9
docs/models/operations/getpinrequest.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# GetPinRequest
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `XPlexClientIdentifier` | *string* | :heavy_check_mark: | Plex Authentication Token |
|
||||
| `Strong` | **bool* | :heavy_minus_sign: | Determines the kind of code returned by the API call<br/>Strong codes are used for Pin authentication flows<br/>Non-Strong codes are used for `Plex.tv/link`<br/> |
|
||||
11
docs/models/operations/getpinresponse.md
Normal file
11
docs/models/operations/getpinresponse.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# GetPinResponse
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
|
||||
| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation |
|
||||
| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation |
|
||||
| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing |
|
||||
| `Object` | [*operations.GetPinResponseBody](../../models/operations/getpinresponsebody.md) | :heavy_minus_sign: | The Pin |
|
||||
21
docs/models/operations/getpinresponsebody.md
Normal file
21
docs/models/operations/getpinresponsebody.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# GetPinResponseBody
|
||||
|
||||
The Pin
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `ID` | **float64* | :heavy_minus_sign: | PinID for use with authentication | 1272322473 |
|
||||
| `Code` | **string* | :heavy_minus_sign: | N/A | 3patfx1a78ukcbr7x0n9bl26t |
|
||||
| `Product` | **string* | :heavy_minus_sign: | N/A | Plex Web |
|
||||
| `Trusted` | **bool* | :heavy_minus_sign: | N/A | |
|
||||
| `Qr` | **string* | :heavy_minus_sign: | a link to a QR code hosted on plex.tv <br/>The QR code redirects to the relevant `plex.tv/link` authentication page<br/>Which then prompts the user for the 4 Digit Link Pin<br/> | https://plex.tv/api/v2/pins/qr/3patfx1a78ukcbr7x0n9bl26t |
|
||||
| `ClientIdentifier` | **string* | :heavy_minus_sign: | N/A | Postman |
|
||||
| `Location` | [*operations.Location](../../models/operations/location.md) | :heavy_minus_sign: | N/A | |
|
||||
| `ExpiresIn` | **float64* | :heavy_minus_sign: | N/A | 1800 |
|
||||
| `CreatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | N/A | 2023-04-12 17:00:03 +0000 UTC |
|
||||
| `ExpiresAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | N/A | 2023-04-12 17:30:03 +0000 UTC |
|
||||
| `AuthToken` | **string* | :heavy_minus_sign: | N/A | |
|
||||
| `NewRegistration` | **string* | :heavy_minus_sign: | N/A | |
|
||||
9
docs/models/operations/gettokenrequest.md
Normal file
9
docs/models/operations/gettokenrequest.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# GetTokenRequest
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
|
||||
| `PinID` | *string* | :heavy_check_mark: | The PinID to retrieve an access token for |
|
||||
| `XPlexClientIdentifier` | *string* | :heavy_check_mark: | Plex Authentication Token |
|
||||
10
docs/models/operations/gettokenresponse.md
Normal file
10
docs/models/operations/gettokenresponse.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# GetTokenResponse
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- |
|
||||
| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation |
|
||||
| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation |
|
||||
| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing |
|
||||
@@ -4,6 +4,14 @@
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `ID` | **int* | :heavy_minus_sign: | N/A | 1 |
|
||||
| `Path` | **string* | :heavy_minus_sign: | N/A | /movies |
|
||||
| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- |
|
||||
| `Code` | **string* | :heavy_minus_sign: | N/A | US |
|
||||
| `EuropeanUnionMember` | **bool* | :heavy_minus_sign: | N/A | |
|
||||
| `ContinentCode` | **string* | :heavy_minus_sign: | N/A | NA |
|
||||
| `Country` | **string* | :heavy_minus_sign: | N/A | United States |
|
||||
| `City` | **string* | :heavy_minus_sign: | N/A | Austin |
|
||||
| `TimeZone` | **string* | :heavy_minus_sign: | N/A | America/Chicago |
|
||||
| `PostalCode` | **float64* | :heavy_minus_sign: | N/A | 78732 |
|
||||
| `InPrivacyRestrictedCountry` | **bool* | :heavy_minus_sign: | N/A | |
|
||||
| `Subdivisions` | **string* | :heavy_minus_sign: | N/A | Texas |
|
||||
| `Coordinates` | **string* | :heavy_minus_sign: | N/A | 30.3768 -97.8935 |
|
||||
37
docs/models/operations/option.md
Normal file
37
docs/models/operations/option.md
Normal file
@@ -0,0 +1,37 @@
|
||||
## Options
|
||||
|
||||
### WithServerURL
|
||||
|
||||
WithServerURL allows providing an alternative server URL.
|
||||
|
||||
```go
|
||||
operations.WithServerURL("http://api.example.com")
|
||||
```
|
||||
|
||||
## WithTemplatedServerURL
|
||||
|
||||
WithTemplatedServerURL allows providing an alternative server URL with templated parameters.
|
||||
|
||||
```go
|
||||
operations.WithTemplatedServerURL("http://{host}:{port}", map[string]string{
|
||||
"host": "api.example.com",
|
||||
"port": "8080",
|
||||
})
|
||||
```
|
||||
|
||||
### WithRetries
|
||||
|
||||
WithRetries allows customizing the default retry configuration. Only usable with methods that mention they support retries.
|
||||
|
||||
```go
|
||||
operations.WithRetries(utils.RetryConfig{
|
||||
Strategy: "backoff",
|
||||
Backoff: utils.BackoffStrategy{
|
||||
InitialInterval: 500 * time.Millisecond,
|
||||
MaxInterval: 60 * time.Second,
|
||||
Exponent: 1.5,
|
||||
MaxElapsedTime: 5 * time.Minute,
|
||||
},
|
||||
RetryConnectionErrors: true,
|
||||
})
|
||||
```
|
||||
10
docs/models/sdkerrors/getpinerrors.md
Normal file
10
docs/models/sdkerrors/getpinerrors.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# GetPinErrors
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- |
|
||||
| `Code` | **float64* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing |
|
||||
| `Status` | **float64* | :heavy_minus_sign: | N/A | 400 |
|
||||
11
docs/models/sdkerrors/getpinresponsebody.md
Normal file
11
docs/models/sdkerrors/getpinresponsebody.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# GetPinResponseBody
|
||||
|
||||
X-Plex-Client-Identifier is missing
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
||||
| `Errors` | [][sdkerrors.GetPinErrors](../../models/sdkerrors/getpinerrors.md) | :heavy_minus_sign: | N/A |
|
||||
| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |
|
||||
10
docs/models/sdkerrors/gettokenerrors.md
Normal file
10
docs/models/sdkerrors/gettokenerrors.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# GetTokenErrors
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- |
|
||||
| `Code` | **float64* | :heavy_minus_sign: | N/A | 1000 |
|
||||
| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing |
|
||||
| `Status` | **float64* | :heavy_minus_sign: | N/A | 400 |
|
||||
11
docs/models/sdkerrors/gettokenresponsebody.md
Normal file
11
docs/models/sdkerrors/gettokenresponsebody.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# GetTokenResponseBody
|
||||
|
||||
X-Plex-Client-Identifier is missing
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
||||
| `Errors` | [][sdkerrors.GetTokenErrors](../../models/sdkerrors/gettokenerrors.md) | :heavy_minus_sign: | N/A |
|
||||
| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing |
|
||||
5
docs/sdks/plex/README.md
Normal file
5
docs/sdks/plex/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Plex
|
||||
(*Plex*)
|
||||
|
||||
### Available Operations
|
||||
|
||||
120
docs/sdks/tv/README.md
Normal file
120
docs/sdks/tv/README.md
Normal file
@@ -0,0 +1,120 @@
|
||||
# Tv
|
||||
(*Plex.Tv*)
|
||||
|
||||
### Available Operations
|
||||
|
||||
* [GetPin](#getpin) - Get a Pin
|
||||
* [GetToken](#gettoken) - Get Access Token
|
||||
|
||||
## GetPin
|
||||
|
||||
Retrieve a Pin from Plex.tv for authentication flows
|
||||
|
||||
### Example Usage
|
||||
|
||||
```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 = "string"
|
||||
|
||||
var strong *bool = false
|
||||
|
||||
ctx := context.Background()
|
||||
res, err := s.Plex.Tv.GetPin(ctx, xPlexClientIdentifier, strong)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if res.Object != nil {
|
||||
// handle response
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. |
|
||||
| `xPlexClientIdentifier` | *string* | :heavy_check_mark: | Plex Authentication Token |
|
||||
| `strong` | **bool* | :heavy_minus_sign: | Determines the kind of code returned by the API call<br/>Strong codes are used for Pin authentication flows<br/>Non-Strong codes are used for `Plex.tv/link`<br/> |
|
||||
| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. |
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
**[*operations.GetPinResponse](../../models/operations/getpinresponse.md), error**
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ---------------------------- | ---------------------------- | ---------------------------- |
|
||||
| sdkerrors.GetPinResponseBody | 400 | application/json |
|
||||
| sdkerrors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## GetToken
|
||||
|
||||
Retrieve an Access Token from Plex.tv after the Pin has already been authenticated
|
||||
|
||||
### Example Usage
|
||||
|
||||
```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>"),
|
||||
)
|
||||
|
||||
|
||||
var pinID string = "string"
|
||||
|
||||
var xPlexClientIdentifier string = "string"
|
||||
|
||||
ctx := context.Background()
|
||||
res, err := s.Plex.Tv.GetToken(ctx, pinID, xPlexClientIdentifier)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if res.StatusCode == http.StatusOK {
|
||||
// handle response
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- |
|
||||
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. |
|
||||
| `pinID` | *string* | :heavy_check_mark: | The PinID to retrieve an access token for |
|
||||
| `xPlexClientIdentifier` | *string* | :heavy_check_mark: | Plex Authentication Token |
|
||||
| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. |
|
||||
|
||||
|
||||
### Response
|
||||
|
||||
**[*operations.GetTokenResponse](../../models/operations/gettokenresponse.md), error**
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------ | ------------------------------ | ------------------------------ |
|
||||
| sdkerrors.GetTokenResponseBody | 400 | application/json |
|
||||
| sdkerrors.SDKError | 4xx-5xx | */* |
|
||||
2
gen.yaml
2
gen.yaml
@@ -8,7 +8,7 @@ generation:
|
||||
fixes:
|
||||
nameResolutionDec2023: false
|
||||
go:
|
||||
version: 0.1.2
|
||||
version: 0.2.0
|
||||
clientServerStatusCodesAsErrors: true
|
||||
flattenGlobalSecurity: true
|
||||
imports:
|
||||
|
||||
@@ -6,19 +6,19 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Location struct {
|
||||
type GetLibrariesLocation struct {
|
||||
ID *int `json:"id,omitempty"`
|
||||
Path *string `json:"path,omitempty"`
|
||||
}
|
||||
|
||||
func (o *Location) GetID() *int {
|
||||
func (o *GetLibrariesLocation) GetID() *int {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ID
|
||||
}
|
||||
|
||||
func (o *Location) GetPath() *string {
|
||||
func (o *GetLibrariesLocation) GetPath() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -46,7 +46,7 @@ type GetLibrariesDirectory struct {
|
||||
Directory *bool `json:"directory,omitempty"`
|
||||
ContentChangedAt *int `json:"contentChangedAt,omitempty"`
|
||||
Hidden *int `json:"hidden,omitempty"`
|
||||
Location []Location `json:"Location,omitempty"`
|
||||
Location []GetLibrariesLocation `json:"Location,omitempty"`
|
||||
}
|
||||
|
||||
func (o *GetLibrariesDirectory) GetAllowSync() *bool {
|
||||
@@ -189,7 +189,7 @@ func (o *GetLibrariesDirectory) GetHidden() *int {
|
||||
return o.Hidden
|
||||
}
|
||||
|
||||
func (o *GetLibrariesDirectory) GetLocation() []Location {
|
||||
func (o *GetLibrariesDirectory) GetLocation() []GetLibrariesLocation {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -362,6 +362,13 @@ type GetLibraryItemsMetadata struct {
|
||||
ChapterSource *string `json:"chapterSource,omitempty"`
|
||||
PrimaryExtraKey *string `json:"primaryExtraKey,omitempty"`
|
||||
RatingImage *string `json:"ratingImage,omitempty"`
|
||||
GrandparentRatingKey *string `json:"grandparentRatingKey,omitempty"`
|
||||
GrandparentGUID *string `json:"grandparentGuid,omitempty"`
|
||||
GrandparentKey *string `json:"grandparentKey,omitempty"`
|
||||
GrandparentTitle *string `json:"grandparentTitle,omitempty"`
|
||||
GrandparentThumb *string `json:"grandparentThumb,omitempty"`
|
||||
GrandparentArt *string `json:"grandparentArt,omitempty"`
|
||||
GrandparentTheme *string `json:"grandparentTheme,omitempty"`
|
||||
Media []GetLibraryItemsMedia `json:"Media,omitempty"`
|
||||
Genre []GetLibraryItemsGenre `json:"Genre,omitempty"`
|
||||
Country []GetLibraryItemsCountry `json:"Country,omitempty"`
|
||||
@@ -374,6 +381,22 @@ type GetLibraryItemsMetadata struct {
|
||||
OriginalTitle *string `json:"originalTitle,omitempty"`
|
||||
ViewOffset *int `json:"viewOffset,omitempty"`
|
||||
SkipCount *int `json:"skipCount,omitempty"`
|
||||
Index *int `json:"index,omitempty"`
|
||||
Theme *string `json:"theme,omitempty"`
|
||||
LeafCount *int `json:"leafCount,omitempty"`
|
||||
ViewedLeafCount *int `json:"viewedLeafCount,omitempty"`
|
||||
ChildCount *int `json:"childCount,omitempty"`
|
||||
HasPremiumExtras *string `json:"hasPremiumExtras,omitempty"`
|
||||
HasPremiumPrimaryExtra *string `json:"hasPremiumPrimaryExtra,omitempty"`
|
||||
ParentRatingKey *string `json:"parentRatingKey,omitempty"`
|
||||
ParentGUID *string `json:"parentGuid,omitempty"`
|
||||
ParentStudio *string `json:"parentStudio,omitempty"`
|
||||
ParentKey *string `json:"parentKey,omitempty"`
|
||||
ParentTitle *string `json:"parentTitle,omitempty"`
|
||||
ParentIndex *int `json:"parentIndex,omitempty"`
|
||||
ParentYear *int `json:"parentYear,omitempty"`
|
||||
ParentThumb *string `json:"parentThumb,omitempty"`
|
||||
ParentTheme *string `json:"parentTheme,omitempty"`
|
||||
}
|
||||
|
||||
func (g GetLibraryItemsMetadata) MarshalJSON() ([]byte, error) {
|
||||
@@ -541,6 +564,55 @@ func (o *GetLibraryItemsMetadata) GetRatingImage() *string {
|
||||
return o.RatingImage
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetGrandparentRatingKey() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.GrandparentRatingKey
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetGrandparentGUID() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.GrandparentGUID
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetGrandparentKey() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.GrandparentKey
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetGrandparentTitle() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.GrandparentTitle
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetGrandparentThumb() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.GrandparentThumb
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetGrandparentArt() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.GrandparentArt
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetGrandparentTheme() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.GrandparentTheme
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetMedia() []GetLibraryItemsMedia {
|
||||
if o == nil {
|
||||
return nil
|
||||
@@ -625,6 +697,118 @@ func (o *GetLibraryItemsMetadata) GetSkipCount() *int {
|
||||
return o.SkipCount
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetIndex() *int {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Index
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetTheme() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Theme
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetLeafCount() *int {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.LeafCount
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetViewedLeafCount() *int {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ViewedLeafCount
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetChildCount() *int {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ChildCount
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetHasPremiumExtras() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.HasPremiumExtras
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetHasPremiumPrimaryExtra() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.HasPremiumPrimaryExtra
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetParentRatingKey() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ParentRatingKey
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetParentGUID() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ParentGUID
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetParentStudio() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ParentStudio
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetParentKey() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ParentKey
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetParentTitle() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ParentTitle
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetParentIndex() *int {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ParentIndex
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetParentYear() *int {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ParentYear
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetParentThumb() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ParentThumb
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMetadata) GetParentTheme() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ParentTheme
|
||||
}
|
||||
|
||||
type GetLibraryItemsMediaContainer struct {
|
||||
Size *int `json:"size,omitempty"`
|
||||
AllowSync *bool `json:"allowSync,omitempty"`
|
||||
@@ -640,6 +824,7 @@ type GetLibraryItemsMediaContainer struct {
|
||||
Title2 *string `json:"title2,omitempty"`
|
||||
ViewGroup *string `json:"viewGroup,omitempty"`
|
||||
ViewMode *int `json:"viewMode,omitempty"`
|
||||
MixedParents *bool `json:"mixedParents,omitempty"`
|
||||
Metadata []GetLibraryItemsMetadata `json:"Metadata,omitempty"`
|
||||
}
|
||||
|
||||
@@ -741,6 +926,13 @@ func (o *GetLibraryItemsMediaContainer) GetViewMode() *int {
|
||||
return o.ViewMode
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMediaContainer) GetMixedParents() *bool {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.MixedParents
|
||||
}
|
||||
|
||||
func (o *GetLibraryItemsMediaContainer) GetMetadata() []GetLibraryItemsMetadata {
|
||||
if o == nil {
|
||||
return nil
|
||||
|
||||
286
models/operations/getpin.go
Normal file
286
models/operations/getpin.go
Normal file
@@ -0,0 +1,286 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
import (
|
||||
"github.com/LukeHagar/plexgo/internal/utils"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
var GetPinServerList = []string{
|
||||
"https://plex.tv/api/v2",
|
||||
}
|
||||
|
||||
type GetPinRequest struct {
|
||||
// Plex Authentication Token
|
||||
XPlexClientIdentifier string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"`
|
||||
// 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`
|
||||
//
|
||||
Strong *bool `default:"false" queryParam:"style=form,explode=true,name=strong"`
|
||||
}
|
||||
|
||||
func (g GetPinRequest) MarshalJSON() ([]byte, error) {
|
||||
return utils.MarshalJSON(g, "", false)
|
||||
}
|
||||
|
||||
func (g *GetPinRequest) UnmarshalJSON(data []byte) error {
|
||||
if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetPinRequest) GetXPlexClientIdentifier() string {
|
||||
if o == nil {
|
||||
return ""
|
||||
}
|
||||
return o.XPlexClientIdentifier
|
||||
}
|
||||
|
||||
func (o *GetPinRequest) GetStrong() *bool {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Strong
|
||||
}
|
||||
|
||||
type Location struct {
|
||||
Code *string `json:"code,omitempty"`
|
||||
EuropeanUnionMember *bool `json:"european_union_member,omitempty"`
|
||||
ContinentCode *string `json:"continent_code,omitempty"`
|
||||
Country *string `json:"country,omitempty"`
|
||||
City *string `json:"city,omitempty"`
|
||||
TimeZone *string `json:"time_zone,omitempty"`
|
||||
PostalCode *float64 `json:"postal_code,omitempty"`
|
||||
InPrivacyRestrictedCountry *bool `json:"in_privacy_restricted_country,omitempty"`
|
||||
Subdivisions *string `json:"subdivisions,omitempty"`
|
||||
Coordinates *string `json:"coordinates,omitempty"`
|
||||
}
|
||||
|
||||
func (o *Location) GetCode() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Code
|
||||
}
|
||||
|
||||
func (o *Location) GetEuropeanUnionMember() *bool {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.EuropeanUnionMember
|
||||
}
|
||||
|
||||
func (o *Location) GetContinentCode() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ContinentCode
|
||||
}
|
||||
|
||||
func (o *Location) GetCountry() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Country
|
||||
}
|
||||
|
||||
func (o *Location) GetCity() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.City
|
||||
}
|
||||
|
||||
func (o *Location) GetTimeZone() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.TimeZone
|
||||
}
|
||||
|
||||
func (o *Location) GetPostalCode() *float64 {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.PostalCode
|
||||
}
|
||||
|
||||
func (o *Location) GetInPrivacyRestrictedCountry() *bool {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.InPrivacyRestrictedCountry
|
||||
}
|
||||
|
||||
func (o *Location) GetSubdivisions() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Subdivisions
|
||||
}
|
||||
|
||||
func (o *Location) GetCoordinates() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Coordinates
|
||||
}
|
||||
|
||||
// GetPinResponseBody - The Pin
|
||||
type GetPinResponseBody struct {
|
||||
// PinID for use with authentication
|
||||
ID *float64 `json:"id,omitempty"`
|
||||
Code *string `json:"code,omitempty"`
|
||||
Product *string `json:"product,omitempty"`
|
||||
Trusted *bool `json:"trusted,omitempty"`
|
||||
// a link to a QR code hosted on plex.tv
|
||||
// The QR code redirects to the relevant `plex.tv/link` authentication page
|
||||
// Which then prompts the user for the 4 Digit Link Pin
|
||||
//
|
||||
Qr *string `json:"qr,omitempty"`
|
||||
ClientIdentifier *string `json:"clientIdentifier,omitempty"`
|
||||
Location *Location `json:"location,omitempty"`
|
||||
ExpiresIn *float64 `json:"expiresIn,omitempty"`
|
||||
CreatedAt *time.Time `json:"createdAt,omitempty"`
|
||||
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
|
||||
AuthToken *string `json:"authToken,omitempty"`
|
||||
NewRegistration *string `json:"newRegistration,omitempty"`
|
||||
}
|
||||
|
||||
func (g GetPinResponseBody) MarshalJSON() ([]byte, error) {
|
||||
return utils.MarshalJSON(g, "", false)
|
||||
}
|
||||
|
||||
func (g *GetPinResponseBody) UnmarshalJSON(data []byte) error {
|
||||
if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetID() *float64 {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ID
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetCode() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Code
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetProduct() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Product
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetTrusted() *bool {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Trusted
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetQr() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Qr
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetClientIdentifier() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ClientIdentifier
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetLocation() *Location {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Location
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetExpiresIn() *float64 {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ExpiresIn
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetCreatedAt() *time.Time {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.CreatedAt
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetExpiresAt() *time.Time {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.ExpiresAt
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetAuthToken() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.AuthToken
|
||||
}
|
||||
|
||||
func (o *GetPinResponseBody) GetNewRegistration() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.NewRegistration
|
||||
}
|
||||
|
||||
type GetPinResponse struct {
|
||||
// HTTP response content type for this operation
|
||||
ContentType string
|
||||
// HTTP response status code for this operation
|
||||
StatusCode int
|
||||
// Raw HTTP response; suitable for custom response parsing
|
||||
RawResponse *http.Response
|
||||
// The Pin
|
||||
Object *GetPinResponseBody
|
||||
}
|
||||
|
||||
func (o *GetPinResponse) GetContentType() string {
|
||||
if o == nil {
|
||||
return ""
|
||||
}
|
||||
return o.ContentType
|
||||
}
|
||||
|
||||
func (o *GetPinResponse) GetStatusCode() int {
|
||||
if o == nil {
|
||||
return 0
|
||||
}
|
||||
return o.StatusCode
|
||||
}
|
||||
|
||||
func (o *GetPinResponse) GetRawResponse() *http.Response {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.RawResponse
|
||||
}
|
||||
|
||||
func (o *GetPinResponse) GetObject() *GetPinResponseBody {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Object
|
||||
}
|
||||
62
models/operations/gettoken.go
Normal file
62
models/operations/gettoken.go
Normal file
@@ -0,0 +1,62 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
var GetTokenServerList = []string{
|
||||
"https://plex.tv/api/v2",
|
||||
}
|
||||
|
||||
type GetTokenRequest struct {
|
||||
// The PinID to retrieve an access token for
|
||||
PinID string `pathParam:"style=simple,explode=false,name=pinID"`
|
||||
// Plex Authentication Token
|
||||
XPlexClientIdentifier string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"`
|
||||
}
|
||||
|
||||
func (o *GetTokenRequest) GetPinID() string {
|
||||
if o == nil {
|
||||
return ""
|
||||
}
|
||||
return o.PinID
|
||||
}
|
||||
|
||||
func (o *GetTokenRequest) GetXPlexClientIdentifier() string {
|
||||
if o == nil {
|
||||
return ""
|
||||
}
|
||||
return o.XPlexClientIdentifier
|
||||
}
|
||||
|
||||
type GetTokenResponse struct {
|
||||
// HTTP response content type for this operation
|
||||
ContentType string
|
||||
// HTTP response status code for this operation
|
||||
StatusCode int
|
||||
// Raw HTTP response; suitable for custom response parsing
|
||||
RawResponse *http.Response
|
||||
}
|
||||
|
||||
func (o *GetTokenResponse) GetContentType() string {
|
||||
if o == nil {
|
||||
return ""
|
||||
}
|
||||
return o.ContentType
|
||||
}
|
||||
|
||||
func (o *GetTokenResponse) GetStatusCode() int {
|
||||
if o == nil {
|
||||
return 0
|
||||
}
|
||||
return o.StatusCode
|
||||
}
|
||||
|
||||
func (o *GetTokenResponse) GetRawResponse() *http.Response {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.RawResponse
|
||||
}
|
||||
63
models/operations/options.go
Normal file
63
models/operations/options.go
Normal file
@@ -0,0 +1,63 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
package operations
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/LukeHagar/plexgo/internal/utils"
|
||||
)
|
||||
|
||||
var ErrUnsupportedOption = errors.New("unsupported option")
|
||||
|
||||
const (
|
||||
SupportedOptionServerURL = "serverURL"
|
||||
SupportedOptionRetries = "retries"
|
||||
SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
ServerURL *string
|
||||
Retries *utils.RetryConfig
|
||||
}
|
||||
|
||||
type Option func(*Options, ...string) error
|
||||
|
||||
// WithServerURL allows providing an alternative server URL.
|
||||
func WithServerURL(serverURL string) Option {
|
||||
return func(opts *Options, supportedOptions ...string) error {
|
||||
if !utils.Contains(supportedOptions, SupportedOptionServerURL) {
|
||||
return ErrUnsupportedOption
|
||||
}
|
||||
|
||||
opts.ServerURL = &serverURL
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithTemplatedServerURL allows providing an alternative server URL with templated parameters.
|
||||
func WithTemplatedServerURL(serverURL string, params map[string]string) Option {
|
||||
return func(opts *Options, supportedOptions ...string) error {
|
||||
if !utils.Contains(supportedOptions, SupportedOptionServerURL) {
|
||||
return ErrUnsupportedOption
|
||||
}
|
||||
|
||||
if params != nil {
|
||||
serverURL = utils.ReplaceParameters(serverURL, params)
|
||||
}
|
||||
|
||||
opts.ServerURL = &serverURL
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithRetries allows customizing the default retry configuration.
|
||||
func WithRetries(config utils.RetryConfig) Option {
|
||||
return func(opts *Options, supportedOptions ...string) error {
|
||||
if !utils.Contains(supportedOptions, SupportedOptionRetries) {
|
||||
return ErrUnsupportedOption
|
||||
}
|
||||
|
||||
opts.Retries = &config
|
||||
return nil
|
||||
}
|
||||
}
|
||||
49
models/sdkerrors/getpin.go
Normal file
49
models/sdkerrors/getpin.go
Normal file
@@ -0,0 +1,49 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
package sdkerrors
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type GetPinErrors struct {
|
||||
Code *float64 `json:"code,omitempty"`
|
||||
Message *string `json:"message,omitempty"`
|
||||
Status *float64 `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (o *GetPinErrors) GetCode() *float64 {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Code
|
||||
}
|
||||
|
||||
func (o *GetPinErrors) GetMessage() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Message
|
||||
}
|
||||
|
||||
func (o *GetPinErrors) GetStatus() *float64 {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Status
|
||||
}
|
||||
|
||||
// GetPinResponseBody - X-Plex-Client-Identifier is missing
|
||||
type GetPinResponseBody struct {
|
||||
Errors []GetPinErrors `json:"errors,omitempty"`
|
||||
// Raw HTTP response; suitable for custom response parsing
|
||||
RawResponse *http.Response `json:"-"`
|
||||
}
|
||||
|
||||
var _ error = &GetPinResponseBody{}
|
||||
|
||||
func (e *GetPinResponseBody) Error() string {
|
||||
data, _ := json.Marshal(e)
|
||||
return string(data)
|
||||
}
|
||||
49
models/sdkerrors/gettoken.go
Normal file
49
models/sdkerrors/gettoken.go
Normal file
@@ -0,0 +1,49 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
package sdkerrors
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type GetTokenErrors struct {
|
||||
Code *float64 `json:"code,omitempty"`
|
||||
Message *string `json:"message,omitempty"`
|
||||
Status *float64 `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (o *GetTokenErrors) GetCode() *float64 {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Code
|
||||
}
|
||||
|
||||
func (o *GetTokenErrors) GetMessage() *string {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Message
|
||||
}
|
||||
|
||||
func (o *GetTokenErrors) GetStatus() *float64 {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
return o.Status
|
||||
}
|
||||
|
||||
// GetTokenResponseBody - X-Plex-Client-Identifier is missing
|
||||
type GetTokenResponseBody struct {
|
||||
Errors []GetTokenErrors `json:"errors,omitempty"`
|
||||
// Raw HTTP response; suitable for custom response parsing
|
||||
RawResponse *http.Response `json:"-"`
|
||||
}
|
||||
|
||||
var _ error = &GetTokenResponseBody{}
|
||||
|
||||
func (e *GetTokenResponseBody) Error() string {
|
||||
data, _ := json.Marshal(e)
|
||||
return string(data)
|
||||
}
|
||||
16
plex.go
Normal file
16
plex.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
package plexgo
|
||||
|
||||
type Plex struct {
|
||||
Tv *Tv
|
||||
|
||||
sdkConfiguration sdkConfiguration
|
||||
}
|
||||
|
||||
func newPlex(sdkConfig sdkConfiguration) *Plex {
|
||||
return &Plex{
|
||||
sdkConfiguration: sdkConfig,
|
||||
Tv: newTv(sdkConfig),
|
||||
}
|
||||
}
|
||||
@@ -97,6 +97,7 @@ type PlexAPI struct {
|
||||
// Submit logs to the Log Handler for Plex Media Server
|
||||
//
|
||||
Log *Log
|
||||
Plex *Plex
|
||||
// Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as "all albums from 2017").
|
||||
// They can be organized in (optionally nesting) folders.
|
||||
// Retrieving a playlist, or its items, will trigger a refresh of its metadata.
|
||||
@@ -251,9 +252,9 @@ func New(opts ...SDKOption) *PlexAPI {
|
||||
sdkConfiguration: sdkConfiguration{
|
||||
Language: "go",
|
||||
OpenAPIDocVersion: "0.0.3",
|
||||
SDKVersion: "0.1.2",
|
||||
GenVersion: "2.237.3",
|
||||
UserAgent: "speakeasy-sdk/go 0.1.2 2.237.3 0.0.3 github.com/LukeHagar/plexgo",
|
||||
SDKVersion: "0.2.0",
|
||||
GenVersion: "2.239.4",
|
||||
UserAgent: "speakeasy-sdk/go 0.2.0 2.239.4 0.0.3 github.com/LukeHagar/plexgo",
|
||||
ServerDefaults: []map[string]string{
|
||||
{
|
||||
"protocol": "http",
|
||||
@@ -295,6 +296,8 @@ func New(opts ...SDKOption) *PlexAPI {
|
||||
|
||||
sdk.Log = newLog(sdk.sdkConfiguration)
|
||||
|
||||
sdk.Plex = newPlex(sdk.sdkConfiguration)
|
||||
|
||||
sdk.Playlists = newPlaylists(sdk.sdkConfiguration)
|
||||
|
||||
sdk.Security = newSecurity(sdk.sdkConfiguration)
|
||||
|
||||
207
tv.go
Normal file
207
tv.go
Normal file
@@ -0,0 +1,207 @@
|
||||
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
|
||||
package plexgo
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/LukeHagar/plexgo/internal/utils"
|
||||
"github.com/LukeHagar/plexgo/models/operations"
|
||||
"github.com/LukeHagar/plexgo/models/sdkerrors"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Tv struct {
|
||||
sdkConfiguration sdkConfiguration
|
||||
}
|
||||
|
||||
func newTv(sdkConfig sdkConfiguration) *Tv {
|
||||
return &Tv{
|
||||
sdkConfiguration: sdkConfig,
|
||||
}
|
||||
}
|
||||
|
||||
// GetPin - Get a Pin
|
||||
// Retrieve a Pin from Plex.tv for authentication flows
|
||||
func (s *Tv) GetPin(ctx context.Context, xPlexClientIdentifier string, strong *bool, opts ...operations.Option) (*operations.GetPinResponse, error) {
|
||||
request := operations.GetPinRequest{
|
||||
XPlexClientIdentifier: xPlexClientIdentifier,
|
||||
Strong: strong,
|
||||
}
|
||||
|
||||
o := operations.Options{}
|
||||
supportedOptions := []string{
|
||||
operations.SupportedOptionServerURL,
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
if err := opt(&o, supportedOptions...); err != nil {
|
||||
return nil, fmt.Errorf("error applying option: %w", err)
|
||||
}
|
||||
}
|
||||
baseURL := utils.ReplaceParameters(operations.GetPinServerList[0], map[string]string{})
|
||||
if o.ServerURL != nil {
|
||||
baseURL = *o.ServerURL
|
||||
}
|
||||
|
||||
url := strings.TrimSuffix(baseURL, "/") + "/pins"
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, "POST", url, nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating request: %w", err)
|
||||
}
|
||||
req.Header.Set("Accept", "application/json")
|
||||
req.Header.Set("user-agent", s.sdkConfiguration.UserAgent)
|
||||
|
||||
utils.PopulateHeaders(ctx, req, request)
|
||||
|
||||
if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil {
|
||||
return nil, fmt.Errorf("error populating query params: %w", err)
|
||||
}
|
||||
|
||||
client := s.sdkConfiguration.SecurityClient
|
||||
|
||||
httpRes, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error sending request: %w", err)
|
||||
}
|
||||
if httpRes == nil {
|
||||
return nil, fmt.Errorf("error sending request: no response")
|
||||
}
|
||||
|
||||
contentType := httpRes.Header.Get("Content-Type")
|
||||
|
||||
res := &operations.GetPinResponse{
|
||||
StatusCode: httpRes.StatusCode,
|
||||
ContentType: contentType,
|
||||
RawResponse: httpRes,
|
||||
}
|
||||
|
||||
rawBody, err := io.ReadAll(httpRes.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error reading response body: %w", err)
|
||||
}
|
||||
httpRes.Body.Close()
|
||||
httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
|
||||
switch {
|
||||
case httpRes.StatusCode == 200:
|
||||
switch {
|
||||
case utils.MatchContentType(contentType, `application/json`):
|
||||
var out operations.GetPinResponseBody
|
||||
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res.Object = &out
|
||||
default:
|
||||
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes)
|
||||
}
|
||||
case httpRes.StatusCode == 400:
|
||||
switch {
|
||||
case utils.MatchContentType(contentType, `application/json`):
|
||||
var out sdkerrors.GetPinResponseBody
|
||||
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out.RawResponse = httpRes
|
||||
|
||||
return nil, &out
|
||||
default:
|
||||
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes)
|
||||
}
|
||||
case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
|
||||
fallthrough
|
||||
case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
|
||||
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// GetToken - Get Access Token
|
||||
// Retrieve an Access Token from Plex.tv after the Pin has already been authenticated
|
||||
func (s *Tv) GetToken(ctx context.Context, pinID string, xPlexClientIdentifier string, opts ...operations.Option) (*operations.GetTokenResponse, error) {
|
||||
request := operations.GetTokenRequest{
|
||||
PinID: pinID,
|
||||
XPlexClientIdentifier: xPlexClientIdentifier,
|
||||
}
|
||||
|
||||
o := operations.Options{}
|
||||
supportedOptions := []string{
|
||||
operations.SupportedOptionServerURL,
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
if err := opt(&o, supportedOptions...); err != nil {
|
||||
return nil, fmt.Errorf("error applying option: %w", err)
|
||||
}
|
||||
}
|
||||
baseURL := utils.ReplaceParameters(operations.GetTokenServerList[0], map[string]string{})
|
||||
if o.ServerURL != nil {
|
||||
baseURL = *o.ServerURL
|
||||
}
|
||||
|
||||
url, err := utils.GenerateURL(ctx, baseURL, "/pins/{pinID}", request, nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error generating URL: %w", err)
|
||||
}
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating request: %w", err)
|
||||
}
|
||||
req.Header.Set("Accept", "application/json")
|
||||
req.Header.Set("user-agent", s.sdkConfiguration.UserAgent)
|
||||
|
||||
utils.PopulateHeaders(ctx, req, request)
|
||||
|
||||
client := s.sdkConfiguration.SecurityClient
|
||||
|
||||
httpRes, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error sending request: %w", err)
|
||||
}
|
||||
if httpRes == nil {
|
||||
return nil, fmt.Errorf("error sending request: no response")
|
||||
}
|
||||
|
||||
contentType := httpRes.Header.Get("Content-Type")
|
||||
|
||||
res := &operations.GetTokenResponse{
|
||||
StatusCode: httpRes.StatusCode,
|
||||
ContentType: contentType,
|
||||
RawResponse: httpRes,
|
||||
}
|
||||
|
||||
rawBody, err := io.ReadAll(httpRes.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error reading response body: %w", err)
|
||||
}
|
||||
httpRes.Body.Close()
|
||||
httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
|
||||
switch {
|
||||
case httpRes.StatusCode == 200:
|
||||
case httpRes.StatusCode == 400:
|
||||
switch {
|
||||
case utils.MatchContentType(contentType, `application/json`):
|
||||
var out sdkerrors.GetTokenResponseBody
|
||||
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out.RawResponse = httpRes
|
||||
|
||||
return nil, &out
|
||||
default:
|
||||
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes)
|
||||
}
|
||||
case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
|
||||
fallthrough
|
||||
case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
|
||||
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
Reference in New Issue
Block a user