Compare commits

..

8 Commits

Author SHA1 Message Date
speakeasybot
2b4d612003 ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.166.1 2024-02-05 14:24:08 +00:00
speakeasy-bot
853bfe69d5 🐝 Add license. 2024-02-01 16:30:13 +00:00
speakeasy-bot
81cfd47570 🐝 Update gen.yaml 2024-02-01 16:30:13 +00:00
speakeasy-bot
44e551a11d 🐝 Update workflow file 2024-02-01 16:30:12 +00:00
speakeasybot
264d228db7 ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.161.0 2024-02-01 00:46:59 +00:00
speakeasybot
c1bc2419c8 ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.158.0 2024-01-31 15:06:07 +00:00
speakeasybot
471d850f17 ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.150.0 2024-01-23 21:56:23 +00:00
speakeasybot
b3ac2d0c2e ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.150.0 2024-01-23 20:47:32 +00:00
48 changed files with 2196 additions and 213 deletions

View File

@@ -1,12 +1,12 @@
lockVersion: 2.0.0 lockVersion: 2.0.0
id: dfa99515-01c0-42eb-9be5-ee212fd03eb3 id: dfa99515-01c0-42eb-9be5-ee212fd03eb3
management: management:
docChecksum: 7aba498c024534142941d65a7c2e649c docChecksum: 099fc5bbb987ae7e391f7f07b4212860
docVersion: 0.0.3 docVersion: 0.0.3
speakeasyVersion: internal speakeasyVersion: internal
generationVersion: 2.237.3 generationVersion: 2.249.1
releaseVersion: 0.1.1 releaseVersion: 0.3.0
configChecksum: 75ea35f7a212ecc077e24de582ed767e configChecksum: ae48b3df080bde21a30ed099e1ffc0d8
repoURL: https://github.com/LukeHagar/plexgo.git repoURL: https://github.com/LukeHagar/plexgo.git
repoSubDirectory: . repoSubDirectory: .
installationURL: https://github.com/LukeHagar/plexgo installationURL: https://github.com/LukeHagar/plexgo
@@ -14,10 +14,11 @@ management:
features: features:
go: go:
constsAndDefaults: 0.1.2 constsAndDefaults: 0.1.2
core: 3.3.1 core: 3.3.2
flattening: 2.81.1 flattening: 2.81.1
globalSecurity: 2.82.4 globalSecurity: 2.82.6
globalServerURLs: 2.82.1 globalServerURLs: 2.82.1
methodServerURLs: 2.82.1
nameOverrides: 2.81.1 nameOverrides: 2.81.1
unions: 2.85.2 unions: 2.85.2
generatedFiles: generatedFiles:
@@ -29,6 +30,7 @@ generatedFiles:
- search.go - search.go
- library.go - library.go
- log.go - log.go
- plex.go
- playlists.go - playlists.go
- security.go - security.go
- sessions.go - sessions.go
@@ -83,12 +85,15 @@ generatedFiles:
- /models/operations/deletelibrary.go - /models/operations/deletelibrary.go
- /models/operations/getlibraryitems.go - /models/operations/getlibraryitems.go
- /models/operations/refreshlibrary.go - /models/operations/refreshlibrary.go
- /models/operations/searchlibrary.go
- /models/operations/getmetadata.go - /models/operations/getmetadata.go
- /models/operations/getmetadatachildren.go - /models/operations/getmetadatachildren.go
- /models/operations/getondeck.go - /models/operations/getondeck.go
- /models/operations/logline.go - /models/operations/logline.go
- /models/operations/logmultiline.go - /models/operations/logmultiline.go
- /models/operations/enablepapertrail.go - /models/operations/enablepapertrail.go
- /models/operations/getpin.go
- /models/operations/gettoken.go
- /models/operations/createplaylist.go - /models/operations/createplaylist.go
- /models/operations/getplaylists.go - /models/operations/getplaylists.go
- /models/operations/getplaylist.go - /models/operations/getplaylist.go
@@ -144,6 +149,8 @@ generatedFiles:
- /models/sdkerrors/logline.go - /models/sdkerrors/logline.go
- /models/sdkerrors/logmultiline.go - /models/sdkerrors/logmultiline.go
- /models/sdkerrors/enablepapertrail.go - /models/sdkerrors/enablepapertrail.go
- /models/sdkerrors/getpin.go
- /models/sdkerrors/gettoken.go
- /models/sdkerrors/createplaylist.go - /models/sdkerrors/createplaylist.go
- /models/sdkerrors/getplaylists.go - /models/sdkerrors/getplaylists.go
- /models/sdkerrors/getplaylist.go - /models/sdkerrors/getplaylist.go
@@ -274,7 +281,7 @@ generatedFiles:
- docs/models/operations/getrecentlyaddedmediacontainer.md - docs/models/operations/getrecentlyaddedmediacontainer.md
- docs/models/operations/getrecentlyaddedresponsebody.md - docs/models/operations/getrecentlyaddedresponsebody.md
- docs/models/operations/getrecentlyaddedresponse.md - docs/models/operations/getrecentlyaddedresponse.md
- docs/models/operations/location.md - docs/models/operations/getlibrarieslocation.md
- docs/models/operations/getlibrariesdirectory.md - docs/models/operations/getlibrariesdirectory.md
- docs/models/operations/getlibrariesmediacontainer.md - docs/models/operations/getlibrariesmediacontainer.md
- docs/models/operations/getlibrariesresponsebody.md - docs/models/operations/getlibrariesresponsebody.md
@@ -308,6 +315,12 @@ generatedFiles:
- docs/models/operations/getlibraryitemsresponse.md - docs/models/operations/getlibraryitemsresponse.md
- docs/models/operations/refreshlibraryrequest.md - docs/models/operations/refreshlibraryrequest.md
- docs/models/operations/refreshlibraryresponse.md - docs/models/operations/refreshlibraryresponse.md
- docs/models/operations/type.md
- docs/models/operations/searchlibraryrequest.md
- docs/models/operations/searchlibrarymetadata.md
- docs/models/operations/searchlibrarymediacontainer.md
- docs/models/operations/searchlibraryresponsebody.md
- docs/models/operations/searchlibraryresponse.md
- docs/models/operations/getmetadatarequest.md - docs/models/operations/getmetadatarequest.md
- docs/models/operations/stream.md - docs/models/operations/stream.md
- docs/models/operations/getmetadatapart.md - docs/models/operations/getmetadatapart.md
@@ -343,7 +356,13 @@ generatedFiles:
- docs/models/operations/loglineresponse.md - docs/models/operations/loglineresponse.md
- docs/models/operations/logmultilineresponse.md - docs/models/operations/logmultilineresponse.md
- docs/models/operations/enablepapertrailresponse.md - docs/models/operations/enablepapertrailresponse.md
- docs/models/operations/type.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/smart.md
- docs/models/operations/createplaylistrequest.md - docs/models/operations/createplaylistrequest.md
- docs/models/operations/createplaylistmetadata.md - docs/models/operations/createplaylistmetadata.md
@@ -388,7 +407,7 @@ generatedFiles:
- docs/models/operations/force.md - docs/models/operations/force.md
- docs/models/operations/uploadplaylistrequest.md - docs/models/operations/uploadplaylistrequest.md
- docs/models/operations/uploadplaylistresponse.md - docs/models/operations/uploadplaylistresponse.md
- docs/models/operations/queryparamtype.md - docs/models/operations/gettransienttokenqueryparamtype.md
- docs/models/operations/scope.md - docs/models/operations/scope.md
- docs/models/operations/gettransienttokenrequest.md - docs/models/operations/gettransienttokenrequest.md
- docs/models/operations/gettransienttokenresponse.md - docs/models/operations/gettransienttokenresponse.md
@@ -500,6 +519,10 @@ generatedFiles:
- docs/models/sdkerrors/logmultilineresponsebody.md - docs/models/sdkerrors/logmultilineresponsebody.md
- docs/models/sdkerrors/enablepapertrailerrors.md - docs/models/sdkerrors/enablepapertrailerrors.md
- docs/models/sdkerrors/enablepapertrailresponsebody.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/createplaylisterrors.md
- docs/models/sdkerrors/createplaylistresponsebody.md - docs/models/sdkerrors/createplaylistresponsebody.md
- docs/models/sdkerrors/getplaylistserrors.md - docs/models/sdkerrors/getplaylistserrors.md
@@ -550,10 +573,13 @@ generatedFiles:
- docs/sdks/search/README.md - docs/sdks/search/README.md
- docs/sdks/library/README.md - docs/sdks/library/README.md
- docs/sdks/log/README.md - docs/sdks/log/README.md
- docs/models/operations/option.md
- docs/sdks/plex/README.md
- docs/sdks/playlists/README.md - docs/sdks/playlists/README.md
- docs/sdks/security/README.md - docs/sdks/security/README.md
- docs/sdks/sessions/README.md - docs/sdks/sessions/README.md
- docs/sdks/updater/README.md - docs/sdks/updater/README.md
- docs/sdks/video/README.md - docs/sdks/video/README.md
- USAGE.md - USAGE.md
- models/operations/options.go
- .gitattributes - .gitattributes

View File

@@ -102,6 +102,7 @@ func main() {
* [DeleteLibrary](docs/sdks/library/README.md#deletelibrary) - Delete Library Section * [DeleteLibrary](docs/sdks/library/README.md#deletelibrary) - Delete Library Section
* [GetLibraryItems](docs/sdks/library/README.md#getlibraryitems) - Get Library Items * [GetLibraryItems](docs/sdks/library/README.md#getlibraryitems) - Get Library Items
* [RefreshLibrary](docs/sdks/library/README.md#refreshlibrary) - Refresh Library * [RefreshLibrary](docs/sdks/library/README.md#refreshlibrary) - Refresh Library
* [SearchLibrary](docs/sdks/library/README.md#searchlibrary) - Search Library
* [GetMetadata](docs/sdks/library/README.md#getmetadata) - Get Items Metadata * [GetMetadata](docs/sdks/library/README.md#getmetadata) - Get Items Metadata
* [GetMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) - Get Items Children * [GetMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) - Get Items Children
* [GetOnDeck](docs/sdks/library/README.md#getondeck) - Get On Deck * [GetOnDeck](docs/sdks/library/README.md#getondeck) - Get On Deck
@@ -112,6 +113,11 @@ func main() {
* [LogMultiLine](docs/sdks/log/README.md#logmultiline) - Logging a multi-line message * [LogMultiLine](docs/sdks/log/README.md#logmultiline) - Logging a multi-line message
* [EnablePaperTrail](docs/sdks/log/README.md#enablepapertrail) - Enabling Papertrail * [EnablePaperTrail](docs/sdks/log/README.md#enablepapertrail) - Enabling Papertrail
### [Plex](docs/sdks/plex/README.md)
* [GetPin](docs/sdks/plex/README.md#getpin) - Get a Pin
* [GetToken](docs/sdks/plex/README.md#gettoken) - Get Access Token
### [Playlists](docs/sdks/playlists/README.md) ### [Playlists](docs/sdks/playlists/README.md)
* [CreatePlaylist](docs/sdks/playlists/README.md#createplaylist) - Create a Playlist * [CreatePlaylist](docs/sdks/playlists/README.md#createplaylist) - Create a Playlist
@@ -277,6 +283,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.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] --> <!-- End Server Selection [server] -->

View File

@@ -68,4 +68,54 @@ Based on:
### Generated ### Generated
- [go v0.1.1] . - [go v0.1.1] .
### Releases ### Releases
- [Go v0.1.1] https://github.com/LukeHagar/plexgo/releases/tag/v0.1.1 - . - [Go v0.1.1] https://github.com/LukeHagar/plexgo/releases/tag/v0.1.1 - .
## 2024-01-23 20:47:20
### 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.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 - .
## 2024-02-01 00:46:46
### Changes
Based on:
- OpenAPI Doc 0.0.3
- Speakeasy CLI 1.161.0 (2.245.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v0.2.1] .
### Releases
- [Go v0.2.1] https://github.com/LukeHagar/plexgo/releases/tag/v0.2.1 - .
## 2024-02-05 14:23:54
### Changes
Based on:
- OpenAPI Doc 0.0.3
- Speakeasy CLI 1.166.1 (2.249.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v0.3.0] .
### Releases
- [Go v0.3.0] https://github.com/LukeHagar/plexgo/releases/tag/v0.3.0 - .

View File

@@ -3,10 +3,10 @@
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description |
| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| `Title` | *string* | :heavy_check_mark: | name of the playlist | | `Title` | *string* | :heavy_check_mark: | name of the playlist |
| `Type` | [operations.Type](../../models/operations/type.md) | :heavy_check_mark: | type of playlist to create | | `Type` | [operations.QueryParamType](../../models/operations/queryparamtype.md) | :heavy_check_mark: | type of playlist to create |
| `Smart` | [operations.Smart](../../models/operations/smart.md) | :heavy_check_mark: | whether the playlist is smart or not | | `Smart` | [operations.Smart](../../models/operations/smart.md) | :heavy_check_mark: | whether the playlist is smart or not |
| `URI` | *string* | :heavy_check_mark: | the content URI for the playlist | | `URI` | *string* | :heavy_check_mark: | the content URI for the playlist |
| `PlayQueueID` | **float64* | :heavy_minus_sign: | the play queue to copy to a playlist | | `PlayQueueID` | **float64* | :heavy_minus_sign: | the play queue to copy to a playlist |

View File

@@ -3,26 +3,26 @@
## Fields ## Fields
| Field | Type | Required | Description | Example | | Field | Type | Required | Description | Example |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | true | | `AllowSync` | **bool* | :heavy_minus_sign: | N/A | true |
| `Art` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg | | `Art` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg |
| `Composite` | **string* | :heavy_minus_sign: | N/A | /library/sections/1/composite/1705615584 | | `Composite` | **string* | :heavy_minus_sign: | N/A | /library/sections/1/composite/1705615584 |
| `Filters` | **bool* | :heavy_minus_sign: | N/A | true | | `Filters` | **bool* | :heavy_minus_sign: | N/A | true |
| `Refreshing` | **bool* | :heavy_minus_sign: | N/A | false | | `Refreshing` | **bool* | :heavy_minus_sign: | N/A | false |
| `Thumb` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie.png | | `Thumb` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie.png |
| `Key` | **string* | :heavy_minus_sign: | N/A | 1 | | `Key` | **string* | :heavy_minus_sign: | N/A | 1 |
| `Type` | **string* | :heavy_minus_sign: | N/A | movie | | `Type` | **string* | :heavy_minus_sign: | N/A | movie |
| `Title` | **string* | :heavy_minus_sign: | N/A | Movies | | `Title` | **string* | :heavy_minus_sign: | N/A | Movies |
| `Agent` | **string* | :heavy_minus_sign: | N/A | tv.plex.agents.movie | | `Agent` | **string* | :heavy_minus_sign: | N/A | tv.plex.agents.movie |
| `Scanner` | **string* | :heavy_minus_sign: | N/A | Plex Movie | | `Scanner` | **string* | :heavy_minus_sign: | N/A | Plex Movie |
| `Language` | **string* | :heavy_minus_sign: | N/A | en-US | | `Language` | **string* | :heavy_minus_sign: | N/A | en-US |
| `UUID` | **string* | :heavy_minus_sign: | N/A | 322a231a-b7f7-49f5-920f-14c61199cd30 | | `UUID` | **string* | :heavy_minus_sign: | N/A | 322a231a-b7f7-49f5-920f-14c61199cd30 |
| `UpdatedAt` | **int* | :heavy_minus_sign: | N/A | 1705615634 | | `UpdatedAt` | **int* | :heavy_minus_sign: | N/A | 1705615634 |
| `CreatedAt` | **int* | :heavy_minus_sign: | N/A | 1654131312 | | `CreatedAt` | **int* | :heavy_minus_sign: | N/A | 1654131312 |
| `ScannedAt` | **int* | :heavy_minus_sign: | N/A | 1705615584 | | `ScannedAt` | **int* | :heavy_minus_sign: | N/A | 1705615584 |
| `Content` | **bool* | :heavy_minus_sign: | N/A | true | | `Content` | **bool* | :heavy_minus_sign: | N/A | true |
| `Directory` | **bool* | :heavy_minus_sign: | N/A | true | | `Directory` | **bool* | :heavy_minus_sign: | N/A | true |
| `ContentChangedAt` | **int* | :heavy_minus_sign: | N/A | 3192854 | | `ContentChangedAt` | **int* | :heavy_minus_sign: | N/A | 3192854 |
| `Hidden` | **int* | :heavy_minus_sign: | N/A | 0 | | `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"}] |

View 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

View File

@@ -27,6 +27,13 @@
| `ChapterSource` | **string* | :heavy_minus_sign: | N/A | media | | `ChapterSource` | **string* | :heavy_minus_sign: | N/A | media |
| `PrimaryExtraKey` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58684 | | `PrimaryExtraKey` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58684 |
| `RatingImage` | **string* | :heavy_minus_sign: | N/A | rottentomatoes://image.rating.ripe | | `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}] | | `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"}] | | `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"}] | | `Country` | [][operations.GetLibraryItemsCountry](../../models/operations/getlibraryitemscountry.md) | :heavy_minus_sign: | N/A | [{"tag":"United States of America"}] |
@@ -38,4 +45,20 @@
| `LastViewedAt` | **int* | :heavy_minus_sign: | N/A | 1682752242 | | `LastViewedAt` | **int* | :heavy_minus_sign: | N/A | 1682752242 |
| `OriginalTitle` | **string* | :heavy_minus_sign: | N/A | 映画 ブラッククローバー 魔法帝の剣 | | `OriginalTitle` | **string* | :heavy_minus_sign: | N/A | 映画 ブラッククローバー 魔法帝の剣 |
| `ViewOffset` | **int* | :heavy_minus_sign: | N/A | 5222500 | | `ViewOffset` | **int* | :heavy_minus_sign: | N/A | 5222500 |
| `SkipCount` | **int* | :heavy_minus_sign: | N/A | 1 | | `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 |

View File

@@ -0,0 +1,9 @@
# GetPinRequest
## Fields
| Field | Type | Required | Description |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `XPlexClientIdentifier` | *string* | :heavy_check_mark: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> |
| `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/> |

View 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 |

View 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 | |

View 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: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> |

View 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 |

View File

@@ -0,0 +1,10 @@
# GetTransientTokenQueryParamType
`delegation` - This is the only supported `type` parameter.
## Values
| Name | Value |
| ------------------------------------------- | ------------------------------------------- |
| `GetTransientTokenQueryParamTypeDelegation` | delegation |

View File

@@ -3,7 +3,7 @@
## Fields ## Fields
| Field | Type | Required | Description | | Field | Type | Required | Description |
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `Type` | [operations.QueryParamType](../../models/operations/queryparamtype.md) | :heavy_check_mark: | `delegation` - This is the only supported `type` parameter. | | `Type` | [operations.GetTransientTokenQueryParamType](../../models/operations/gettransienttokenqueryparamtype.md) | :heavy_check_mark: | `delegation` - This is the only supported `type` parameter. |
| `Scope` | [operations.Scope](../../models/operations/scope.md) | :heavy_check_mark: | `all` - This is the only supported `scope` parameter. | | `Scope` | [operations.Scope](../../models/operations/scope.md) | :heavy_check_mark: | `all` - This is the only supported `scope` parameter. |

View File

@@ -3,7 +3,15 @@
## Fields ## Fields
| Field | Type | Required | Description | Example | | Field | Type | Required | Description | Example |
| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- |
| `ID` | **int* | :heavy_minus_sign: | N/A | 1 | | `Code` | **string* | :heavy_minus_sign: | N/A | US |
| `Path` | **string* | :heavy_minus_sign: | N/A | /movies | | `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 |

View 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,
})
```

View File

@@ -1,10 +1,12 @@
# QueryParamType # QueryParamType
`delegation` - This is the only supported `type` parameter. type of playlist to create
## Values ## Values
| Name | Value | | Name | Value |
| -------------------------- | -------------------------- | | --------------------- | --------------------- |
| `QueryParamTypeDelegation` | delegation | | `QueryParamTypeAudio` | audio |
| `QueryParamTypeVideo` | video |
| `QueryParamTypePhoto` | photo |

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,27 @@
# SearchLibraryMetadata
## Fields
| Field | Type | Required | Description | Example |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `RatingKey` | **string* | :heavy_minus_sign: | N/A | 2 |
| `Key` | **string* | :heavy_minus_sign: | N/A | /library/metadata/2/children |
| `ParentRatingKey` | **string* | :heavy_minus_sign: | N/A | 1 |
| `GUID` | **string* | :heavy_minus_sign: | N/A | plex://season/602e67e766dfdb002c0a1b5b |
| `ParentGUID` | **string* | :heavy_minus_sign: | N/A | plex://show/5d9c086c7d06d9001ffd27aa |
| `ParentStudio` | **string* | :heavy_minus_sign: | N/A | Mutant Enemy Productions |
| `Type` | **string* | :heavy_minus_sign: | N/A | season |
| `Title` | **string* | :heavy_minus_sign: | N/A | Season 1 |
| `ParentKey` | **string* | :heavy_minus_sign: | N/A | /library/metadata/1 |
| `ParentTitle` | **string* | :heavy_minus_sign: | N/A | Firefly |
| `Summary` | **string* | :heavy_minus_sign: | N/A | Captain Malcolm 'Mal' Reynolds is a former galactic war veteran who is the captain of the transport ship "Serenity". Mal and his crew, ensign Zoe Alleyne Washburne; Zoe's husband, pilot Hoban 'Wash' Washburne; muscular mercenary Jayne Cobb; young mechanic Kaylee Frye; former Alliance medical officer Simon Tam; his disturbed teenage sister River (both on the run from the interplanetary government "The Alliance"); the beautiful courtesan Inara Serra; and preacher Shepherd Book do any jobs, legal or illegal, they can find as the Serenity crew travels across the outskirts of outer space. |
| `Index` | **int* | :heavy_minus_sign: | N/A | 1 |
| `ParentIndex` | **int* | :heavy_minus_sign: | N/A | 1 |
| `ParentYear` | **int* | :heavy_minus_sign: | N/A | 2002 |
| `Thumb` | **string* | :heavy_minus_sign: | N/A | /library/metadata/2/thumb/1705636920 |
| `Art` | **string* | :heavy_minus_sign: | N/A | /library/metadata/1/art/1705636920 |
| `ParentThumb` | **string* | :heavy_minus_sign: | N/A | /library/metadata/1/thumb/1705636920 |
| `ParentTheme` | **string* | :heavy_minus_sign: | N/A | /library/metadata/1/theme/1705636920 |
| `AddedAt` | **int* | :heavy_minus_sign: | N/A | 1705636916 |
| `UpdatedAt` | **int* | :heavy_minus_sign: | N/A | 1705636920 |

View File

@@ -0,0 +1,9 @@
# SearchLibraryRequest
## Fields
| Field | Type | Required | Description |
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
| `SectionID` | *int64* | :heavy_check_mark: | the Id of the library to query |
| `Type` | [operations.Type](../../models/operations/type.md) | :heavy_check_mark: | Plex content type to search for |

View File

@@ -0,0 +1,11 @@
# SearchLibraryResponse
## 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.SearchLibraryResponseBody](../../models/operations/searchlibraryresponsebody.md) | :heavy_minus_sign: | The contents of the library by section and type |

View File

@@ -0,0 +1,10 @@
# SearchLibraryResponseBody
The contents of the library by section and type
## Fields
| Field | Type | Required | Description |
| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `MediaContainer` | [*operations.SearchLibraryMediaContainer](../../models/operations/searchlibrarymediacontainer.md) | :heavy_minus_sign: | N/A |

View File

@@ -5,25 +5,24 @@ A key representing a specific tag within the section.
## Values ## Values
| Name | Value | | Name | Value |
| --------------------- | --------------------- | | ------------------- | ------------------- |
| `TagAll` | all | | `TagAll` | all |
| `TagUnwatched` | unwatched | | `TagUnwatched` | unwatched |
| `TagNewest` | newest | | `TagNewest` | newest |
| `TagRecentlyAdded` | recentlyAdded | | `TagRecentlyAdded` | recentlyAdded |
| `TagRecentlyViewed` | recentlyViewed | | `TagRecentlyViewed` | recentlyViewed |
| `TagOnDeck` | onDeck | | `TagOnDeck` | onDeck |
| `TagCollection` | collection | | `TagCollection` | collection |
| `TagEdition` | edition | | `TagEdition` | edition |
| `TagGenre` | genre | | `TagGenre` | genre |
| `TagYear` | year | | `TagYear` | year |
| `TagDecade` | decade | | `TagDecade` | decade |
| `TagDirector` | director | | `TagDirector` | director |
| `TagActor` | actor | | `TagActor` | actor |
| `TagCountry` | country | | `TagCountry` | country |
| `TagContentRating` | contentRating | | `TagContentRating` | contentRating |
| `TagRating` | rating | | `TagRating` | rating |
| `TagResolution` | resolution | | `TagResolution` | resolution |
| `TagFirstCharacter` | firstCharacter | | `TagFirstCharacter` | firstCharacter |
| `TagFolder` | folder | | `TagFolder` | folder |
| `TagSearchTypeEqual1` | search?type=1 |

View File

@@ -1,12 +1,13 @@
# Type # Type
type of playlist to create Plex content type to search for
## Values ## Values
| Name | Value | | Name | Value |
| ----------- | ----------- | | ----------- | ----------- |
| `TypeAudio` | audio | | `TypeOne` | 1 |
| `TypeVideo` | video | | `TypeTwo` | 2 |
| `TypePhoto` | photo | | `TypeThree` | 3 |
| `TypeFour` | 4 |

View 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 |

View 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 |

View 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 |

View 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 |

View File

@@ -15,6 +15,7 @@ API Calls interacting with Plex Media Server Libraries
* [DeleteLibrary](#deletelibrary) - Delete Library Section * [DeleteLibrary](#deletelibrary) - Delete Library Section
* [GetLibraryItems](#getlibraryitems) - Get Library Items * [GetLibraryItems](#getlibraryitems) - Get Library Items
* [RefreshLibrary](#refreshlibrary) - Refresh Library * [RefreshLibrary](#refreshlibrary) - Refresh Library
* [SearchLibrary](#searchlibrary) - Search Library
* [GetMetadata](#getmetadata) - Get Items Metadata * [GetMetadata](#getmetadata) - Get Items Metadata
* [GetMetadataChildren](#getmetadatachildren) - Get Items Children * [GetMetadataChildren](#getmetadatachildren) - Get Items Children
* [GetOnDeck](#getondeck) - Get On Deck * [GetOnDeck](#getondeck) - Get On Deck
@@ -348,7 +349,6 @@ Fetches details from a specific section of the library identified by a section k
- `resolution`: Items categorized by resolution. - `resolution`: Items categorized by resolution.
- `firstCharacter`: Items categorized by the first letter. - `firstCharacter`: Items categorized by the first letter.
- `folder`: Items categorized by folder. - `folder`: Items categorized by folder.
- `search?type=1`: Search functionality within the section.
### Example Usage ### Example Usage
@@ -456,6 +456,79 @@ func main() {
| sdkerrors.RefreshLibraryResponseBody | 401 | application/json | | sdkerrors.RefreshLibraryResponseBody | 401 | application/json |
| sdkerrors.SDKError | 4xx-5xx | */* | | sdkerrors.SDKError | 4xx-5xx | */* |
## SearchLibrary
Search for content within a specific section of the library.
### Types
Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls:
- **Type Object Attributes**:
- `type`: Metadata type (if standard Plex type).
- `title`: Title for this content type (e.g., "Movies").
- **Filter Objects**:
- Subset of the media query language.
- Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`.
- **Sort Objects**:
- Description of sort fields.
- Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`.
> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.
### Example Usage
```go
package main
import(
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
var sectionID int64 = 933505
var type_ operations.Type = operations.TypeFour
ctx := context.Background()
res, err := s.Library.SearchLibrary(ctx, sectionID, type_)
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. |
| `sectionID` | *int64* | :heavy_check_mark: | the Id of the library to query |
| `type_` | [operations.Type](../../models/operations/type.md) | :heavy_check_mark: | Plex content type to search for |
### Response
**[*operations.SearchLibraryResponse](../../models/operations/searchlibraryresponse.md), error**
| Error Object | Status Code | Content Type |
| ------------------ | ------------------ | ------------------ |
| sdkerrors.SDKError | 4xx-5xx | */* |
## GetMetadata ## GetMetadata
This endpoint will return the metadata of a library item specified with the ratingKey. This endpoint will return the metadata of a library item specified with the ratingKey.

View File

@@ -49,7 +49,7 @@ func main() {
ctx := context.Background() ctx := context.Background()
res, err := s.Playlists.CreatePlaylist(ctx, operations.CreatePlaylistRequest{ res, err := s.Playlists.CreatePlaylist(ctx, operations.CreatePlaylistRequest{
Title: "string", Title: "string",
Type: operations.TypePhoto, Type: operations.QueryParamTypePhoto,
Smart: operations.SmartOne, Smart: operations.SmartOne,
URI: "https://inborn-brochure.biz", URI: "https://inborn-brochure.biz",
}) })

125
docs/sdks/plex/README.md Normal file
View File

@@ -0,0 +1,125 @@
# Plex
(*Plex*)
## Overview
API Calls that perform operations directly against https://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.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: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> |
| `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.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: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> |
| `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 | */* |

View File

@@ -36,7 +36,7 @@ func main() {
) )
var type_ operations.QueryParamType = operations.QueryParamTypeDelegation var type_ operations.GetTransientTokenQueryParamType = operations.GetTransientTokenQueryParamTypeDelegation
var scope operations.Scope = operations.ScopeAll var scope operations.Scope = operations.ScopeAll
@@ -54,11 +54,11 @@ func main() {
### Parameters ### Parameters
| Parameter | Type | Required | Description | | Parameter | Type | Required | Description |
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. |
| `type_` | [operations.QueryParamType](../../models/operations/queryparamtype.md) | :heavy_check_mark: | `delegation` - This is the only supported `type` parameter. | | `type_` | [operations.GetTransientTokenQueryParamType](../../models/operations/gettransienttokenqueryparamtype.md) | :heavy_check_mark: | `delegation` - This is the only supported `type` parameter. |
| `scope` | [operations.Scope](../../models/operations/scope.md) | :heavy_check_mark: | `all` - This is the only supported `scope` parameter. | | `scope` | [operations.Scope](../../models/operations/scope.md) | :heavy_check_mark: | `all` - This is the only supported `scope` parameter. |
### Response ### Response

View File

@@ -7,8 +7,9 @@ generation:
useClassNamesForArrayFields: true useClassNamesForArrayFields: true
fixes: fixes:
nameResolutionDec2023: false nameResolutionDec2023: false
parameterOrderingFeb2024: false
go: go:
version: 0.1.1 version: 0.3.0
clientServerStatusCodesAsErrors: true clientServerStatusCodesAsErrors: true
flattenGlobalSecurity: true flattenGlobalSecurity: true
imports: imports:

View File

@@ -465,7 +465,6 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionID float64) (*operat
// - `resolution`: Items categorized by resolution. // - `resolution`: Items categorized by resolution.
// - `firstCharacter`: Items categorized by the first letter. // - `firstCharacter`: Items categorized by the first letter.
// - `folder`: Items categorized by folder. // - `folder`: Items categorized by folder.
// - `search?type=1`: Search functionality within the section.
func (s *Library) GetLibraryItems(ctx context.Context, sectionID int64, tag operations.Tag) (*operations.GetLibraryItemsResponse, error) { func (s *Library) GetLibraryItems(ctx context.Context, sectionID int64, tag operations.Tag) (*operations.GetLibraryItemsResponse, error) {
request := operations.GetLibraryItemsRequest{ request := operations.GetLibraryItemsRequest{
SectionID: sectionID, SectionID: sectionID,
@@ -601,6 +600,94 @@ func (s *Library) RefreshLibrary(ctx context.Context, sectionID float64) (*opera
return res, nil return res, nil
} }
// SearchLibrary - Search Library
// Search for content within a specific section of the library.
//
// ### Types
// Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls:
//
// - **Type Object Attributes**:
// - `type`: Metadata type (if standard Plex type).
// - `title`: Title for this content type (e.g., "Movies").
//
// - **Filter Objects**:
// - Subset of the media query language.
// - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`.
//
// - **Sort Objects**:
// - Description of sort fields.
// - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`.
//
// > **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.
func (s *Library) SearchLibrary(ctx context.Context, sectionID int64, type_ operations.Type) (*operations.SearchLibraryResponse, error) {
request := operations.SearchLibraryRequest{
SectionID: sectionID,
Type: type_,
}
baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
url, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionId}/search", 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)
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.SearchLibraryResponse{
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.SearchLibraryResponseBody
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 && 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
}
// GetMetadata - Get Items Metadata // GetMetadata - Get Items Metadata
// This endpoint will return the metadata of a library item specified with the ratingKey. // This endpoint will return the metadata of a library item specified with the ratingKey.
func (s *Library) GetMetadata(ctx context.Context, ratingKey float64) (*operations.GetMetadataResponse, error) { func (s *Library) GetMetadata(ctx context.Context, ratingKey float64) (*operations.GetMetadataResponse, error) {

View File

@@ -8,20 +8,20 @@ import (
"net/http" "net/http"
) )
// Type - type of playlist to create // QueryParamType - type of playlist to create
type Type string type QueryParamType string
const ( const (
TypeAudio Type = "audio" QueryParamTypeAudio QueryParamType = "audio"
TypeVideo Type = "video" QueryParamTypeVideo QueryParamType = "video"
TypePhoto Type = "photo" QueryParamTypePhoto QueryParamType = "photo"
) )
func (e Type) ToPointer() *Type { func (e QueryParamType) ToPointer() *QueryParamType {
return &e return &e
} }
func (e *Type) UnmarshalJSON(data []byte) error { func (e *QueryParamType) UnmarshalJSON(data []byte) error {
var v string var v string
if err := json.Unmarshal(data, &v); err != nil { if err := json.Unmarshal(data, &v); err != nil {
return err return err
@@ -32,10 +32,10 @@ func (e *Type) UnmarshalJSON(data []byte) error {
case "video": case "video":
fallthrough fallthrough
case "photo": case "photo":
*e = Type(v) *e = QueryParamType(v)
return nil return nil
default: default:
return fmt.Errorf("invalid value for Type: %v", v) return fmt.Errorf("invalid value for QueryParamType: %v", v)
} }
} }
@@ -71,7 +71,7 @@ type CreatePlaylistRequest struct {
// name of the playlist // name of the playlist
Title string `queryParam:"style=form,explode=true,name=title"` Title string `queryParam:"style=form,explode=true,name=title"`
// type of playlist to create // type of playlist to create
Type Type `queryParam:"style=form,explode=true,name=type"` Type QueryParamType `queryParam:"style=form,explode=true,name=type"`
// whether the playlist is smart or not // whether the playlist is smart or not
Smart Smart `queryParam:"style=form,explode=true,name=smart"` Smart Smart `queryParam:"style=form,explode=true,name=smart"`
// the content URI for the playlist // the content URI for the playlist
@@ -87,9 +87,9 @@ func (o *CreatePlaylistRequest) GetTitle() string {
return o.Title return o.Title
} }
func (o *CreatePlaylistRequest) GetType() Type { func (o *CreatePlaylistRequest) GetType() QueryParamType {
if o == nil { if o == nil {
return Type("") return QueryParamType("")
} }
return o.Type return o.Type
} }

View File

@@ -6,19 +6,19 @@ import (
"net/http" "net/http"
) )
type Location struct { type GetLibrariesLocation struct {
ID *int `json:"id,omitempty"` ID *int `json:"id,omitempty"`
Path *string `json:"path,omitempty"` Path *string `json:"path,omitempty"`
} }
func (o *Location) GetID() *int { func (o *GetLibrariesLocation) GetID() *int {
if o == nil { if o == nil {
return nil return nil
} }
return o.ID return o.ID
} }
func (o *Location) GetPath() *string { func (o *GetLibrariesLocation) GetPath() *string {
if o == nil { if o == nil {
return nil return nil
} }
@@ -26,27 +26,27 @@ func (o *Location) GetPath() *string {
} }
type GetLibrariesDirectory struct { type GetLibrariesDirectory struct {
AllowSync *bool `json:"allowSync,omitempty"` AllowSync *bool `json:"allowSync,omitempty"`
Art *string `json:"art,omitempty"` Art *string `json:"art,omitempty"`
Composite *string `json:"composite,omitempty"` Composite *string `json:"composite,omitempty"`
Filters *bool `json:"filters,omitempty"` Filters *bool `json:"filters,omitempty"`
Refreshing *bool `json:"refreshing,omitempty"` Refreshing *bool `json:"refreshing,omitempty"`
Thumb *string `json:"thumb,omitempty"` Thumb *string `json:"thumb,omitempty"`
Key *string `json:"key,omitempty"` Key *string `json:"key,omitempty"`
Type *string `json:"type,omitempty"` Type *string `json:"type,omitempty"`
Title *string `json:"title,omitempty"` Title *string `json:"title,omitempty"`
Agent *string `json:"agent,omitempty"` Agent *string `json:"agent,omitempty"`
Scanner *string `json:"scanner,omitempty"` Scanner *string `json:"scanner,omitempty"`
Language *string `json:"language,omitempty"` Language *string `json:"language,omitempty"`
UUID *string `json:"uuid,omitempty"` UUID *string `json:"uuid,omitempty"`
UpdatedAt *int `json:"updatedAt,omitempty"` UpdatedAt *int `json:"updatedAt,omitempty"`
CreatedAt *int `json:"createdAt,omitempty"` CreatedAt *int `json:"createdAt,omitempty"`
ScannedAt *int `json:"scannedAt,omitempty"` ScannedAt *int `json:"scannedAt,omitempty"`
Content *bool `json:"content,omitempty"` Content *bool `json:"content,omitempty"`
Directory *bool `json:"directory,omitempty"` Directory *bool `json:"directory,omitempty"`
ContentChangedAt *int `json:"contentChangedAt,omitempty"` ContentChangedAt *int `json:"contentChangedAt,omitempty"`
Hidden *int `json:"hidden,omitempty"` Hidden *int `json:"hidden,omitempty"`
Location []Location `json:"Location,omitempty"` Location []GetLibrariesLocation `json:"Location,omitempty"`
} }
func (o *GetLibrariesDirectory) GetAllowSync() *bool { func (o *GetLibrariesDirectory) GetAllowSync() *bool {
@@ -189,7 +189,7 @@ func (o *GetLibrariesDirectory) GetHidden() *int {
return o.Hidden return o.Hidden
} }
func (o *GetLibrariesDirectory) GetLocation() []Location { func (o *GetLibrariesDirectory) GetLocation() []GetLibrariesLocation {
if o == nil { if o == nil {
return nil return nil
} }

View File

@@ -14,26 +14,25 @@ import (
type Tag string type Tag string
const ( const (
TagAll Tag = "all" TagAll Tag = "all"
TagUnwatched Tag = "unwatched" TagUnwatched Tag = "unwatched"
TagNewest Tag = "newest" TagNewest Tag = "newest"
TagRecentlyAdded Tag = "recentlyAdded" TagRecentlyAdded Tag = "recentlyAdded"
TagRecentlyViewed Tag = "recentlyViewed" TagRecentlyViewed Tag = "recentlyViewed"
TagOnDeck Tag = "onDeck" TagOnDeck Tag = "onDeck"
TagCollection Tag = "collection" TagCollection Tag = "collection"
TagEdition Tag = "edition" TagEdition Tag = "edition"
TagGenre Tag = "genre" TagGenre Tag = "genre"
TagYear Tag = "year" TagYear Tag = "year"
TagDecade Tag = "decade" TagDecade Tag = "decade"
TagDirector Tag = "director" TagDirector Tag = "director"
TagActor Tag = "actor" TagActor Tag = "actor"
TagCountry Tag = "country" TagCountry Tag = "country"
TagContentRating Tag = "contentRating" TagContentRating Tag = "contentRating"
TagRating Tag = "rating" TagRating Tag = "rating"
TagResolution Tag = "resolution" TagResolution Tag = "resolution"
TagFirstCharacter Tag = "firstCharacter" TagFirstCharacter Tag = "firstCharacter"
TagFolder Tag = "folder" TagFolder Tag = "folder"
TagSearchTypeEqual1 Tag = "search?type=1"
) )
func (e Tag) ToPointer() *Tag { func (e Tag) ToPointer() *Tag {
@@ -83,8 +82,6 @@ func (e *Tag) UnmarshalJSON(data []byte) error {
case "firstCharacter": case "firstCharacter":
fallthrough fallthrough
case "folder": case "folder":
fallthrough
case "search?type=1":
*e = Tag(v) *e = Tag(v)
return nil return nil
default: default:
@@ -343,40 +340,63 @@ func (o *GetLibraryItemsRole) GetTag() *string {
} }
type GetLibraryItemsMetadata struct { type GetLibraryItemsMetadata struct {
RatingKey *string `json:"ratingKey,omitempty"` RatingKey *string `json:"ratingKey,omitempty"`
Key *string `json:"key,omitempty"` Key *string `json:"key,omitempty"`
GUID *string `json:"guid,omitempty"` GUID *string `json:"guid,omitempty"`
Studio *string `json:"studio,omitempty"` Studio *string `json:"studio,omitempty"`
Type *string `json:"type,omitempty"` Type *string `json:"type,omitempty"`
Title *string `json:"title,omitempty"` Title *string `json:"title,omitempty"`
ContentRating *string `json:"contentRating,omitempty"` ContentRating *string `json:"contentRating,omitempty"`
Summary *string `json:"summary,omitempty"` Summary *string `json:"summary,omitempty"`
Rating *float64 `json:"rating,omitempty"` Rating *float64 `json:"rating,omitempty"`
AudienceRating *float64 `json:"audienceRating,omitempty"` AudienceRating *float64 `json:"audienceRating,omitempty"`
Year *int `json:"year,omitempty"` Year *int `json:"year,omitempty"`
Tagline *string `json:"tagline,omitempty"` Tagline *string `json:"tagline,omitempty"`
Thumb *string `json:"thumb,omitempty"` Thumb *string `json:"thumb,omitempty"`
Art *string `json:"art,omitempty"` Art *string `json:"art,omitempty"`
Duration *int `json:"duration,omitempty"` Duration *int `json:"duration,omitempty"`
OriginallyAvailableAt *types.Date `json:"originallyAvailableAt,omitempty"` OriginallyAvailableAt *types.Date `json:"originallyAvailableAt,omitempty"`
AddedAt *int `json:"addedAt,omitempty"` AddedAt *int `json:"addedAt,omitempty"`
UpdatedAt *int `json:"updatedAt,omitempty"` UpdatedAt *int `json:"updatedAt,omitempty"`
AudienceRatingImage *string `json:"audienceRatingImage,omitempty"` AudienceRatingImage *string `json:"audienceRatingImage,omitempty"`
ChapterSource *string `json:"chapterSource,omitempty"` ChapterSource *string `json:"chapterSource,omitempty"`
PrimaryExtraKey *string `json:"primaryExtraKey,omitempty"` PrimaryExtraKey *string `json:"primaryExtraKey,omitempty"`
RatingImage *string `json:"ratingImage,omitempty"` RatingImage *string `json:"ratingImage,omitempty"`
Media []GetLibraryItemsMedia `json:"Media,omitempty"` GrandparentRatingKey *string `json:"grandparentRatingKey,omitempty"`
Genre []GetLibraryItemsGenre `json:"Genre,omitempty"` GrandparentGUID *string `json:"grandparentGuid,omitempty"`
Country []GetLibraryItemsCountry `json:"Country,omitempty"` GrandparentKey *string `json:"grandparentKey,omitempty"`
Director []GetLibraryItemsDirector `json:"Director,omitempty"` GrandparentTitle *string `json:"grandparentTitle,omitempty"`
Writer []GetLibraryItemsWriter `json:"Writer,omitempty"` GrandparentThumb *string `json:"grandparentThumb,omitempty"`
Role []GetLibraryItemsRole `json:"Role,omitempty"` GrandparentArt *string `json:"grandparentArt,omitempty"`
TitleSort *string `json:"titleSort,omitempty"` GrandparentTheme *string `json:"grandparentTheme,omitempty"`
ViewCount *int `json:"viewCount,omitempty"` Media []GetLibraryItemsMedia `json:"Media,omitempty"`
LastViewedAt *int `json:"lastViewedAt,omitempty"` Genre []GetLibraryItemsGenre `json:"Genre,omitempty"`
OriginalTitle *string `json:"originalTitle,omitempty"` Country []GetLibraryItemsCountry `json:"Country,omitempty"`
ViewOffset *int `json:"viewOffset,omitempty"` Director []GetLibraryItemsDirector `json:"Director,omitempty"`
SkipCount *int `json:"skipCount,omitempty"` Writer []GetLibraryItemsWriter `json:"Writer,omitempty"`
Role []GetLibraryItemsRole `json:"Role,omitempty"`
TitleSort *string `json:"titleSort,omitempty"`
ViewCount *int `json:"viewCount,omitempty"`
LastViewedAt *int `json:"lastViewedAt,omitempty"`
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) { func (g GetLibraryItemsMetadata) MarshalJSON() ([]byte, error) {
@@ -544,6 +564,55 @@ func (o *GetLibraryItemsMetadata) GetRatingImage() *string {
return o.RatingImage 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 { func (o *GetLibraryItemsMetadata) GetMedia() []GetLibraryItemsMedia {
if o == nil { if o == nil {
return nil return nil
@@ -628,6 +697,118 @@ func (o *GetLibraryItemsMetadata) GetSkipCount() *int {
return o.SkipCount 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 { type GetLibraryItemsMediaContainer struct {
Size *int `json:"size,omitempty"` Size *int `json:"size,omitempty"`
AllowSync *bool `json:"allowSync,omitempty"` AllowSync *bool `json:"allowSync,omitempty"`
@@ -643,6 +824,7 @@ type GetLibraryItemsMediaContainer struct {
Title2 *string `json:"title2,omitempty"` Title2 *string `json:"title2,omitempty"`
ViewGroup *string `json:"viewGroup,omitempty"` ViewGroup *string `json:"viewGroup,omitempty"`
ViewMode *int `json:"viewMode,omitempty"` ViewMode *int `json:"viewMode,omitempty"`
MixedParents *bool `json:"mixedParents,omitempty"`
Metadata []GetLibraryItemsMetadata `json:"Metadata,omitempty"` Metadata []GetLibraryItemsMetadata `json:"Metadata,omitempty"`
} }
@@ -744,6 +926,13 @@ func (o *GetLibraryItemsMediaContainer) GetViewMode() *int {
return o.ViewMode return o.ViewMode
} }
func (o *GetLibraryItemsMediaContainer) GetMixedParents() *bool {
if o == nil {
return nil
}
return o.MixedParents
}
func (o *GetLibraryItemsMediaContainer) GetMetadata() []GetLibraryItemsMetadata { func (o *GetLibraryItemsMediaContainer) GetMetadata() []GetLibraryItemsMetadata {
if o == nil { if o == nil {
return nil return nil

289
models/operations/getpin.go Normal file
View File

@@ -0,0 +1,289 @@
// 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 {
// 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)
//
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
}

View File

@@ -0,0 +1,65 @@
// 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"`
// 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)
//
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
}

View File

@@ -8,28 +8,28 @@ import (
"net/http" "net/http"
) )
// QueryParamType - `delegation` - This is the only supported `type` parameter. // GetTransientTokenQueryParamType - `delegation` - This is the only supported `type` parameter.
type QueryParamType string type GetTransientTokenQueryParamType string
const ( const (
QueryParamTypeDelegation QueryParamType = "delegation" GetTransientTokenQueryParamTypeDelegation GetTransientTokenQueryParamType = "delegation"
) )
func (e QueryParamType) ToPointer() *QueryParamType { func (e GetTransientTokenQueryParamType) ToPointer() *GetTransientTokenQueryParamType {
return &e return &e
} }
func (e *QueryParamType) UnmarshalJSON(data []byte) error { func (e *GetTransientTokenQueryParamType) UnmarshalJSON(data []byte) error {
var v string var v string
if err := json.Unmarshal(data, &v); err != nil { if err := json.Unmarshal(data, &v); err != nil {
return err return err
} }
switch v { switch v {
case "delegation": case "delegation":
*e = QueryParamType(v) *e = GetTransientTokenQueryParamType(v)
return nil return nil
default: default:
return fmt.Errorf("invalid value for QueryParamType: %v", v) return fmt.Errorf("invalid value for GetTransientTokenQueryParamType: %v", v)
} }
} }
@@ -60,14 +60,14 @@ func (e *Scope) UnmarshalJSON(data []byte) error {
type GetTransientTokenRequest struct { type GetTransientTokenRequest struct {
// `delegation` - This is the only supported `type` parameter. // `delegation` - This is the only supported `type` parameter.
Type QueryParamType `queryParam:"style=form,explode=true,name=type"` Type GetTransientTokenQueryParamType `queryParam:"style=form,explode=true,name=type"`
// `all` - This is the only supported `scope` parameter. // `all` - This is the only supported `scope` parameter.
Scope Scope `queryParam:"style=form,explode=true,name=scope"` Scope Scope `queryParam:"style=form,explode=true,name=scope"`
} }
func (o *GetTransientTokenRequest) GetType() QueryParamType { func (o *GetTransientTokenRequest) GetType() GetTransientTokenQueryParamType {
if o == nil { if o == nil {
return QueryParamType("") return GetTransientTokenQueryParamType("")
} }
return o.Type return o.Type
} }

View 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
}
}

View File

@@ -0,0 +1,385 @@
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package operations
import (
"encoding/json"
"fmt"
"net/http"
)
// Type - Plex content type to search for
type Type int64
const (
TypeOne Type = 1
TypeTwo Type = 2
TypeThree Type = 3
TypeFour Type = 4
)
func (e Type) ToPointer() *Type {
return &e
}
func (e *Type) UnmarshalJSON(data []byte) error {
var v int64
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 1:
fallthrough
case 2:
fallthrough
case 3:
fallthrough
case 4:
*e = Type(v)
return nil
default:
return fmt.Errorf("invalid value for Type: %v", v)
}
}
type SearchLibraryRequest struct {
// the Id of the library to query
SectionID int64 `pathParam:"style=simple,explode=false,name=sectionId"`
// Plex content type to search for
Type Type `queryParam:"style=form,explode=true,name=type"`
}
func (o *SearchLibraryRequest) GetSectionID() int64 {
if o == nil {
return 0
}
return o.SectionID
}
func (o *SearchLibraryRequest) GetType() Type {
if o == nil {
return Type(0)
}
return o.Type
}
type SearchLibraryMetadata struct {
RatingKey *string `json:"ratingKey,omitempty"`
Key *string `json:"key,omitempty"`
ParentRatingKey *string `json:"parentRatingKey,omitempty"`
GUID *string `json:"guid,omitempty"`
ParentGUID *string `json:"parentGuid,omitempty"`
ParentStudio *string `json:"parentStudio,omitempty"`
Type *string `json:"type,omitempty"`
Title *string `json:"title,omitempty"`
ParentKey *string `json:"parentKey,omitempty"`
ParentTitle *string `json:"parentTitle,omitempty"`
Summary *string `json:"summary,omitempty"`
Index *int `json:"index,omitempty"`
ParentIndex *int `json:"parentIndex,omitempty"`
ParentYear *int `json:"parentYear,omitempty"`
Thumb *string `json:"thumb,omitempty"`
Art *string `json:"art,omitempty"`
ParentThumb *string `json:"parentThumb,omitempty"`
ParentTheme *string `json:"parentTheme,omitempty"`
AddedAt *int `json:"addedAt,omitempty"`
UpdatedAt *int `json:"updatedAt,omitempty"`
}
func (o *SearchLibraryMetadata) GetRatingKey() *string {
if o == nil {
return nil
}
return o.RatingKey
}
func (o *SearchLibraryMetadata) GetKey() *string {
if o == nil {
return nil
}
return o.Key
}
func (o *SearchLibraryMetadata) GetParentRatingKey() *string {
if o == nil {
return nil
}
return o.ParentRatingKey
}
func (o *SearchLibraryMetadata) GetGUID() *string {
if o == nil {
return nil
}
return o.GUID
}
func (o *SearchLibraryMetadata) GetParentGUID() *string {
if o == nil {
return nil
}
return o.ParentGUID
}
func (o *SearchLibraryMetadata) GetParentStudio() *string {
if o == nil {
return nil
}
return o.ParentStudio
}
func (o *SearchLibraryMetadata) GetType() *string {
if o == nil {
return nil
}
return o.Type
}
func (o *SearchLibraryMetadata) GetTitle() *string {
if o == nil {
return nil
}
return o.Title
}
func (o *SearchLibraryMetadata) GetParentKey() *string {
if o == nil {
return nil
}
return o.ParentKey
}
func (o *SearchLibraryMetadata) GetParentTitle() *string {
if o == nil {
return nil
}
return o.ParentTitle
}
func (o *SearchLibraryMetadata) GetSummary() *string {
if o == nil {
return nil
}
return o.Summary
}
func (o *SearchLibraryMetadata) GetIndex() *int {
if o == nil {
return nil
}
return o.Index
}
func (o *SearchLibraryMetadata) GetParentIndex() *int {
if o == nil {
return nil
}
return o.ParentIndex
}
func (o *SearchLibraryMetadata) GetParentYear() *int {
if o == nil {
return nil
}
return o.ParentYear
}
func (o *SearchLibraryMetadata) GetThumb() *string {
if o == nil {
return nil
}
return o.Thumb
}
func (o *SearchLibraryMetadata) GetArt() *string {
if o == nil {
return nil
}
return o.Art
}
func (o *SearchLibraryMetadata) GetParentThumb() *string {
if o == nil {
return nil
}
return o.ParentThumb
}
func (o *SearchLibraryMetadata) GetParentTheme() *string {
if o == nil {
return nil
}
return o.ParentTheme
}
func (o *SearchLibraryMetadata) GetAddedAt() *int {
if o == nil {
return nil
}
return o.AddedAt
}
func (o *SearchLibraryMetadata) GetUpdatedAt() *int {
if o == nil {
return nil
}
return o.UpdatedAt
}
type SearchLibraryMediaContainer struct {
Size *int `json:"size,omitempty"`
AllowSync *bool `json:"allowSync,omitempty"`
Art *string `json:"art,omitempty"`
Identifier *string `json:"identifier,omitempty"`
MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"`
MediaTagVersion *int `json:"mediaTagVersion,omitempty"`
Nocache *bool `json:"nocache,omitempty"`
Thumb *string `json:"thumb,omitempty"`
Title1 *string `json:"title1,omitempty"`
Title2 *string `json:"title2,omitempty"`
ViewGroup *string `json:"viewGroup,omitempty"`
ViewMode *int `json:"viewMode,omitempty"`
Metadata []SearchLibraryMetadata `json:"Metadata,omitempty"`
}
func (o *SearchLibraryMediaContainer) GetSize() *int {
if o == nil {
return nil
}
return o.Size
}
func (o *SearchLibraryMediaContainer) GetAllowSync() *bool {
if o == nil {
return nil
}
return o.AllowSync
}
func (o *SearchLibraryMediaContainer) GetArt() *string {
if o == nil {
return nil
}
return o.Art
}
func (o *SearchLibraryMediaContainer) GetIdentifier() *string {
if o == nil {
return nil
}
return o.Identifier
}
func (o *SearchLibraryMediaContainer) GetMediaTagPrefix() *string {
if o == nil {
return nil
}
return o.MediaTagPrefix
}
func (o *SearchLibraryMediaContainer) GetMediaTagVersion() *int {
if o == nil {
return nil
}
return o.MediaTagVersion
}
func (o *SearchLibraryMediaContainer) GetNocache() *bool {
if o == nil {
return nil
}
return o.Nocache
}
func (o *SearchLibraryMediaContainer) GetThumb() *string {
if o == nil {
return nil
}
return o.Thumb
}
func (o *SearchLibraryMediaContainer) GetTitle1() *string {
if o == nil {
return nil
}
return o.Title1
}
func (o *SearchLibraryMediaContainer) GetTitle2() *string {
if o == nil {
return nil
}
return o.Title2
}
func (o *SearchLibraryMediaContainer) GetViewGroup() *string {
if o == nil {
return nil
}
return o.ViewGroup
}
func (o *SearchLibraryMediaContainer) GetViewMode() *int {
if o == nil {
return nil
}
return o.ViewMode
}
func (o *SearchLibraryMediaContainer) GetMetadata() []SearchLibraryMetadata {
if o == nil {
return nil
}
return o.Metadata
}
// SearchLibraryResponseBody - The contents of the library by section and type
type SearchLibraryResponseBody struct {
MediaContainer *SearchLibraryMediaContainer `json:"MediaContainer,omitempty"`
}
func (o *SearchLibraryResponseBody) GetMediaContainer() *SearchLibraryMediaContainer {
if o == nil {
return nil
}
return o.MediaContainer
}
type SearchLibraryResponse 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 contents of the library by section and type
Object *SearchLibraryResponseBody
}
func (o *SearchLibraryResponse) GetContentType() string {
if o == nil {
return ""
}
return o.ContentType
}
func (o *SearchLibraryResponse) GetStatusCode() int {
if o == nil {
return 0
}
return o.StatusCode
}
func (o *SearchLibraryResponse) GetRawResponse() *http.Response {
if o == nil {
return nil
}
return o.RawResponse
}
func (o *SearchLibraryResponse) GetObject() *SearchLibraryResponseBody {
if o == nil {
return nil
}
return o.Object
}

View 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)
}

View 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)
}

208
plex.go Normal file
View File

@@ -0,0 +1,208 @@
// 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"
)
// Plex - API Calls that perform operations directly against https://Plex.tv
type Plex struct {
sdkConfiguration sdkConfiguration
}
func newPlex(sdkConfig sdkConfiguration) *Plex {
return &Plex{
sdkConfiguration: sdkConfig,
}
}
// GetPin - Get a Pin
// Retrieve a Pin from Plex.tv for authentication flows
func (s *Plex) 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 *Plex) 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
}

View File

@@ -97,6 +97,9 @@ type PlexAPI struct {
// Submit logs to the Log Handler for Plex Media Server // Submit logs to the Log Handler for Plex Media Server
// //
Log *Log Log *Log
// API Calls that perform operations directly against https://Plex.tv
//
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"). // 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. // They can be organized in (optionally nesting) folders.
// Retrieving a playlist, or its items, will trigger a refresh of its metadata. // Retrieving a playlist, or its items, will trigger a refresh of its metadata.
@@ -239,6 +242,15 @@ func WithSecurity(accessToken string) SDKOption {
} }
} }
// WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication
func WithSecuritySource(security func(context.Context) (components.Security, error)) SDKOption {
return func(sdk *PlexAPI) {
sdk.sdkConfiguration.Security = func(ctx context.Context) (interface{}, error) {
return security(ctx)
}
}
}
func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption { func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption {
return func(sdk *PlexAPI) { return func(sdk *PlexAPI) {
sdk.sdkConfiguration.RetryConfig = &retryConfig sdk.sdkConfiguration.RetryConfig = &retryConfig
@@ -251,9 +263,9 @@ func New(opts ...SDKOption) *PlexAPI {
sdkConfiguration: sdkConfiguration{ sdkConfiguration: sdkConfiguration{
Language: "go", Language: "go",
OpenAPIDocVersion: "0.0.3", OpenAPIDocVersion: "0.0.3",
SDKVersion: "0.1.1", SDKVersion: "0.3.0",
GenVersion: "2.237.3", GenVersion: "2.249.1",
UserAgent: "speakeasy-sdk/go 0.1.1 2.237.3 0.0.3 github.com/LukeHagar/plexgo", UserAgent: "speakeasy-sdk/go 0.3.0 2.249.1 0.0.3 github.com/LukeHagar/plexgo",
ServerDefaults: []map[string]string{ ServerDefaults: []map[string]string{
{ {
"protocol": "http", "protocol": "http",
@@ -295,6 +307,8 @@ func New(opts ...SDKOption) *PlexAPI {
sdk.Log = newLog(sdk.sdkConfiguration) sdk.Log = newLog(sdk.sdkConfiguration)
sdk.Plex = newPlex(sdk.sdkConfiguration)
sdk.Playlists = newPlaylists(sdk.sdkConfiguration) sdk.Playlists = newPlaylists(sdk.sdkConfiguration)
sdk.Security = newSecurity(sdk.sdkConfiguration) sdk.Security = newSecurity(sdk.sdkConfiguration)

View File

@@ -27,7 +27,7 @@ func newSecurity(sdkConfig sdkConfiguration) *Security {
// GetTransientToken - Get a Transient Token. // GetTransientToken - Get a 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. // 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.
func (s *Security) GetTransientToken(ctx context.Context, type_ operations.QueryParamType, scope operations.Scope) (*operations.GetTransientTokenResponse, error) { func (s *Security) GetTransientToken(ctx context.Context, type_ operations.GetTransientTokenQueryParamType, scope operations.Scope) (*operations.GetTransientTokenResponse, error) {
request := operations.GetTransientTokenRequest{ request := operations.GetTransientTokenRequest{
Type: type_, Type: type_,
Scope: scope, Scope: scope,