diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index dc1fe6c..35a36a9 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: dfa99515-01c0-42eb-9be5-ee212fd03eb3 management: - docChecksum: 2554ade61ed4d42b8e095168765d7dc0 + docChecksum: 48a69156b6fa2af10cd43e971790441b docVersion: 0.0.3 - speakeasyVersion: 1.438.3 - generationVersion: 2.457.9 - releaseVersion: 0.16.1 - configChecksum: 6ccd9fc43de5adcdeb47f4fb3cd81c3e + speakeasyVersion: 1.459.2 + generationVersion: 2.483.1 + releaseVersion: 0.17.0 + configChecksum: fb22f5a3ef98ee90825c83f15f4d9021 repoURL: https://github.com/LukeHagar/plexgo.git repoSubDirectory: . installationURL: https://github.com/LukeHagar/plexgo @@ -15,7 +15,7 @@ features: go: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.6 - core: 3.5.16 + core: 3.6.2 defaultEnabledRetries: 0.2.0 deprecations: 2.81.1 downloadStreams: 0.1.2 @@ -27,15 +27,13 @@ features: globalSecurityCallbacks: 0.1.0 globalSecurityFlattening: 0.1.0 globalServerURLs: 2.82.2 - globals: 2.82.2 intellisenseMarkdownSupport: 0.1.0 methodServerURLs: 2.82.1 nameOverrides: 2.81.2 nullables: 0.1.0 responseFormat: 0.1.2 - retries: 2.83.0 + retries: 2.83.1 sdkHooks: 0.1.0 - tests: 0.6.0 generatedFiles: - .gitattributes - /models/components/security.go @@ -384,7 +382,6 @@ generatedFiles: - docs/models/operations/getondeckresponsebody.md - docs/models/operations/getondeckstream.md - docs/models/operations/getpinauthpincontainer.md - - docs/models/operations/getpinglobals.md - docs/models/operations/getpinrequest.md - docs/models/operations/getpinresponse.md - docs/models/operations/getplaylistcontentscountry.md @@ -453,7 +450,6 @@ generatedFiles: - docs/models/operations/getsearchalllibrariesdirector.md - docs/models/operations/getsearchalllibrariesflattenseasons.md - docs/models/operations/getsearchalllibrariesgenre.md - - docs/models/operations/getsearchalllibrariesglobals.md - docs/models/operations/getsearchalllibrarieshasthumbnail.md - docs/models/operations/getsearchalllibrariesimage.md - docs/models/operations/getsearchalllibrarieslibrarytype.md @@ -507,7 +503,6 @@ generatedFiles: - docs/models/operations/getserverpreferencesmediacontainer.md - docs/models/operations/getserverpreferencesresponse.md - docs/models/operations/getserverpreferencesresponsebody.md - - docs/models/operations/getserverresourcesglobals.md - docs/models/operations/getserverresourcesrequest.md - docs/models/operations/getserverresourcesresponse.md - docs/models/operations/getsessionhistorymediacontainer.md @@ -536,7 +531,6 @@ generatedFiles: - docs/models/operations/gettimelineresponse.md - docs/models/operations/gettokenbypinidauthpincontainer.md - docs/models/operations/gettokenbypinidgeodata.md - - docs/models/operations/gettokenbypinidglobals.md - docs/models/operations/gettokenbypinidrequest.md - docs/models/operations/gettokenbypinidresponse.md - docs/models/operations/gettokendetailsauthenticationresponsestatus.md @@ -623,7 +617,6 @@ generatedFiles: - docs/models/operations/postuserssignindataautoselectsubtitle.md - docs/models/operations/postuserssignindatadefaultsubtitleaccessibility.md - docs/models/operations/postuserssignindatadefaultsubtitleforced.md - - docs/models/operations/postuserssignindataglobals.md - docs/models/operations/postuserssignindatamailingliststatus.md - docs/models/operations/postuserssignindatamediareviewsvisibility.md - docs/models/operations/postuserssignindatarequest.md @@ -1014,9 +1007,9 @@ generatedFiles: - docs/types/date.md - go.mod - hubs.go - - internal/globals/globals.go - internal/hooks/hooks.go - internal/utils/contenttype.go + - internal/utils/env.go - internal/utils/form.go - internal/utils/headers.go - internal/utils/json.go @@ -1055,7 +1048,8 @@ examples: application/json: {"errors": []} "401": application/json: {"errors": []} - "200": {} + "200": + application/json: {} getServerPreferences: speakeasy-default-get-server-preferences: responses: @@ -1259,7 +1253,8 @@ examples: application/json: {"errors": []} "401": application/json: {"errors": []} - "200": {} + "200": + application/json: {} cancelServerActivities: "": parameters: @@ -1565,7 +1560,7 @@ examples: X-Plex-Container-Size: 50 responses: "200": - application/json: {"MediaContainer": {"Type": [{"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [{"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}], "Sort": [{"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}, {"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}], "FieldType": [{"type": "tag", "Operator": [{"key": "=", "title": "is"}, {"key": "=", "title": "is"}, {"key": "=", "title": "is"}]}, {"type": "tag", "Operator": [{"key": "=", "title": "is"}, {"key": "=", "title": "is"}]}, {"type": "tag", "Operator": [{"key": "=", "title": "is"}, {"key": "=", "title": "is"}]}], "size": 70, "totalSize": 170, "offset": 0, "content": "secondary", "allowSync": true, "nocache": true, "art": "/:/resources/movie-fanart.jpg", "identifier": "com.plexapp.plugins.library", "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionUUID": "322a231a-b7f7-49f5-920f-14c61199cd30", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1701731894, "thumb": "/:/resources/movie.png", "title1": "Movies", "title2": "Recently Released", "viewGroup": "movie", "viewMode": 65592, "mixedParents": true, "Metadata": [{"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "dvd", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [{"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}, {"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}, {"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}]}], "Genre": [{"tag": "Adventure"}, {"tag": "Adventure"}, {"tag": "Adventure"}], "Country": [{"tag": "United States of America"}, {"tag": "United States of America"}], "Director": [{"tag": "James Cameron"}, {"tag": "James Cameron"}], "Writer": [{"tag": "James Cameron"}], "Collection": [{"tag": "Working NL Subs"}], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [{"path": "/TV Shows/House"}], "Guid": [{"id": "imdb://tt13015952"}], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [{"image": "themoviedb://image.rating", "value": 3, "type": "audience"}], "Image": [{"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}, {"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}, {"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "dvd", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [{"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}]}], "Genre": [], "Country": [{"tag": "United States of America"}], "Director": [{"tag": "James Cameron"}, {"tag": "James Cameron"}, {"tag": "James Cameron"}], "Writer": [{"tag": "James Cameron"}], "Collection": [{"tag": "Working NL Subs"}, {"tag": "Working NL Subs"}], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [{"path": "/TV Shows/House"}, {"path": "/TV Shows/House"}], "Guid": [{"id": "imdb://tt13015952"}], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [], "Image": [{"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}], "Meta": {"Type": [{"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [], "Sort": [], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}, {"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [{"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}], "Sort": [], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}], "FieldType": [{"type": "tag", "Operator": [{"key": "=", "title": "is"}]}, {"type": "tag", "Operator": [{"key": "=", "title": "is"}, {"key": "=", "title": "is"}]}, {"type": "tag", "Operator": [{"key": "=", "title": "is"}, {"key": "=", "title": "is"}]}]}}} + application/json: {"MediaContainer": {"Type": [{"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [{"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}], "Sort": [{"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}, {"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}], "FieldType": [{"type": "tag", "Operator": [{"key": "=", "title": "is"}, {"key": "=", "title": "is"}, {"key": "=", "title": "is"}]}, {"type": "tag", "Operator": [{"key": "=", "title": "is"}, {"key": "=", "title": "is"}]}, {"type": "tag", "Operator": [{"key": "=", "title": "is"}, {"key": "=", "title": "is"}]}], "size": 70, "totalSize": 170, "offset": 0, "content": "secondary", "allowSync": true, "nocache": true, "art": "/:/resources/movie-fanart.jpg", "identifier": "com.plexapp.plugins.library", "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionUUID": "322a231a-b7f7-49f5-920f-14c61199cd30", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1701731894, "thumb": "/:/resources/movie.png", "title1": "Movies", "title2": "Recently Released", "viewGroup": "movie", "viewMode": 65592, "mixedParents": true, "Metadata": [{"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "tvdbDvd", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [{"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}, {"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}, {"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}]}], "Genre": [{"tag": "Adventure"}, {"tag": "Adventure"}, {"tag": "Adventure"}], "Country": [{"tag": "United States of America"}, {"tag": "United States of America"}], "Director": [{"tag": "James Cameron"}, {"tag": "James Cameron"}], "Writer": [{"tag": "James Cameron"}], "Collection": [{"tag": "Working NL Subs"}], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [{"path": "/TV Shows/House"}], "Guid": [{"id": "imdb://tt13015952"}], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [{"image": "themoviedb://image.rating", "value": 3, "type": "audience"}], "Image": [{"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}, {"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}, {"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "tvdbDvd", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [{"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}]}], "Genre": [], "Country": [{"tag": "United States of America"}], "Director": [{"tag": "James Cameron"}, {"tag": "James Cameron"}, {"tag": "James Cameron"}], "Writer": [{"tag": "James Cameron"}], "Collection": [{"tag": "Working NL Subs"}, {"tag": "Working NL Subs"}], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [{"path": "/TV Shows/House"}, {"path": "/TV Shows/House"}], "Guid": [{"id": "imdb://tt13015952"}], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [], "Image": [{"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}], "Meta": {"Type": [{"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [], "Sort": [], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}, {"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [{"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}], "Sort": [], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}], "FieldType": [{"type": "tag", "Operator": [{"key": "=", "title": "is"}]}, {"type": "tag", "Operator": [{"key": "=", "title": "is"}, {"key": "=", "title": "is"}]}, {"type": "tag", "Operator": [{"key": "=", "title": "is"}, {"key": "=", "title": "is"}]}]}}} "400": application/json: {"errors": [{"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}]} "401": @@ -1686,7 +1681,8 @@ examples: application/json: {"errors": []} "401": application/json: {"errors": []} - "200": {} + "200": + application/json: {} logLine: speakeasy-default-log-line: parameters: @@ -2086,7 +2082,7 @@ examples: X-Plex-Container-Size: 50 responses: "200": - application/json: {"MediaContainer": {"size": 50, "identifier": "com.plexapp.plugins.library", "Meta": {"Type": [{"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [{"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}], "Sort": [{"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}, {"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [{"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}], "Sort": [{"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}, {"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}, {"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}, {"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [{"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}], "Sort": [{"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}, {"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}], "FieldType": [{"type": "tag", "Operator": [{"key": "=", "title": "is"}]}, {"type": "tag", "Operator": []}, {"type": "tag", "Operator": []}]}, "Metadata": [{"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "dvd", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [{"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}, {"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": []}]}], "Genre": [{"tag": "Adventure"}], "Country": [], "Director": [{"tag": "James Cameron"}, {"tag": "James Cameron"}], "Writer": [], "Collection": [], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [{"path": "/TV Shows/House"}], "Guid": [{"id": "imdb://tt13015952"}, {"id": "imdb://tt13015952"}, {"id": "imdb://tt13015952"}], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [], "Image": [{"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}, {"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}, {"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}]}} + application/json: {"MediaContainer": {"size": 50, "identifier": "com.plexapp.plugins.library", "Meta": {"Type": [{"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [{"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}], "Sort": [{"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}, {"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [{"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}], "Sort": [{"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}, {"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}, {"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}, {"key": "/library/sections/2/all?type=2", "type": "show", "title": "TV Shows", "active": false, "Filter": [{"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}, {"filter": "genre", "filterType": "string", "key": "/library/sections/2/genre?type=2", "title": "Genre", "type": "filter"}], "Sort": [{"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}, {"default": "asc", "active": false, "activeDirection": "asc", "defaultDirection": "asc", "descKey": "titleSort:desc", "firstCharacterKey": "/library/sections/2/firstCharacter", "key": "titleSort", "title": "Title"}], "Field": [{"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}, {"key": "show.title", "title": "Show Title", "type": "string", "subType": "rating"}]}], "FieldType": [{"type": "tag", "Operator": [{"key": "=", "title": "is"}]}, {"type": "tag", "Operator": []}, {"type": "tag", "Operator": []}]}, "Metadata": [{"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "tvdbDvd", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [{"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}, {"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": []}]}], "Genre": [{"tag": "Adventure"}], "Country": [], "Director": [{"tag": "James Cameron"}, {"tag": "James Cameron"}], "Writer": [], "Collection": [], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [{"path": "/TV Shows/House"}], "Guid": [{"id": "imdb://tt13015952"}, {"id": "imdb://tt13015952"}, {"id": "imdb://tt13015952"}], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [], "Image": [{"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}, {"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}, {"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}]}} get-recently-added-library: speakeasy-default-get-recently-added-library: parameters: @@ -2117,8 +2113,9 @@ examples: X-Plex-Client-Identifier: "3381b62b-9ab7-4e37-827b-203e9809eb58" responses: "200": - application/json: {"MediaContainer": {"size": "9266.90", "SearchResult": [{"score": "2698.71", "Metadata": {"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "dvd", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [{"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}]}, {"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}, {"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}, {"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}]}], "Genre": [{"tag": "Adventure"}, {"tag": "Adventure"}, {"tag": "Adventure"}], "Country": [{"tag": "United States of America"}], "Director": [{"tag": "James Cameron"}], "Writer": [], "Collection": [{"tag": "Working NL Subs"}, {"tag": "Working NL Subs"}], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [], "Guid": [{"id": "imdb://tt13015952"}, {"id": "imdb://tt13015952"}], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [], "Image": [{"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}}, {"score": "9681.40", "Metadata": {"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "dvd", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [], "Genre": [], "Country": [], "Director": [{"tag": "James Cameron"}, {"tag": "James Cameron"}, {"tag": "James Cameron"}], "Writer": [{"tag": "James Cameron"}, {"tag": "James Cameron"}], "Collection": [{"tag": "Working NL Subs"}], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [{"path": "/TV Shows/House"}, {"path": "/TV Shows/House"}, {"path": "/TV Shows/House"}], "Guid": [], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [{"image": "themoviedb://image.rating", "value": 3, "type": "audience"}], "Image": [], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}}, {"score": "1665.12", "Metadata": {"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "dvd", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [{"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}]}], "Genre": [{"tag": "Adventure"}, {"tag": "Adventure"}], "Country": [{"tag": "United States of America"}, {"tag": "United States of America"}], "Director": [{"tag": "James Cameron"}], "Writer": [{"tag": "James Cameron"}], "Collection": [{"tag": "Working NL Subs"}, {"tag": "Working NL Subs"}], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [{"path": "/TV Shows/House"}, {"path": "/TV Shows/House"}, {"path": "/TV Shows/House"}], "Guid": [{"id": "imdb://tt13015952"}, {"id": "imdb://tt13015952"}], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [{"image": "themoviedb://image.rating", "value": 3, "type": "audience"}], "Image": [{"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}, {"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}}]}} + application/json: {"MediaContainer": {"size": "9266.90", "SearchResult": [{"score": "2698.71", "Metadata": {"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "tvdbAbsolute", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [{"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}]}, {"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}, {"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}, {"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}]}], "Genre": [{"tag": "Adventure"}, {"tag": "Adventure"}, {"tag": "Adventure"}], "Country": [{"tag": "United States of America"}], "Director": [{"tag": "James Cameron"}], "Writer": [], "Collection": [{"tag": "Working NL Subs"}, {"tag": "Working NL Subs"}], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [], "Guid": [{"id": "imdb://tt13015952"}, {"id": "imdb://tt13015952"}], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [], "Image": [{"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}}, {"score": "9681.40", "Metadata": {"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "tvdbAbsolute", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [], "Genre": [], "Country": [], "Director": [{"tag": "James Cameron"}, {"tag": "James Cameron"}, {"tag": "James Cameron"}], "Writer": [{"tag": "James Cameron"}, {"tag": "James Cameron"}], "Collection": [{"tag": "Working NL Subs"}], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [{"path": "/TV Shows/House"}, {"path": "/TV Shows/House"}, {"path": "/TV Shows/House"}], "Guid": [], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [{"image": "themoviedb://image.rating", "value": 3, "type": "audience"}], "Image": [], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}}, {"score": "1665.12", "Metadata": {"ratingKey": "58683", "key": "/library/metadata/58683", "guid": "plex://movie/5d7768ba96b655001fdc0408", "studio": "20th Century Studios", "skipChildren": false, "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionKey": "/library/sections/1", "type": "movie", "title": "Avatar: The Way of Water", "slug": "4-for-texas", "contentRating": "PG-13", "summary": "Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.", "rating": 7.6, "audienceRating": 9.2, "year": 2022, "seasonCount": 2022, "tagline": "Return to Pandora.", "flattenSeasons": "1", "showOrdering": "tmdbAiring", "thumb": "/library/metadata/58683/thumb/1703239236", "art": "/library/metadata/58683/art/1703239236", "banner": "/library/metadata/58683/banner/1703239236", "duration": 11558112, "originallyAvailableAt": "2022-12-14T00:00:00Z", "addedAt": 1556281940, "updatedAt": 1556281940, "audienceRatingImage": "rottentomatoes://image.rating.upright", "chapterSource": "media", "primaryExtraKey": "/library/metadata/58684", "ratingImage": "rottentomatoes://image.rating.ripe", "grandparentRatingKey": "66", "grandparentGuid": "plex://show/5d9c081b170e24001f2a7be4", "grandparentKey": "/library/metadata/66", "grandparentTitle": "Caprica", "grandparentThumb": "/library/metadata/66/thumb/1705716261", "parentSlug": "alice-in-borderland-2020", "grandparentSlug": "alice-in-borderland-2020", "grandparentArt": "/library/metadata/66/art/1705716261", "grandparentTheme": "/library/metadata/66/theme/1705716261", "Media": [{"id": 119534, "duration": 11558112, "bitrate": 25025, "width": 3840, "height": 2072, "aspectRatio": 1.85, "audioProfile": "dts", "audioChannels": 6, "audioCodec": "eac3", "videoCodec": "hevc", "videoResolution": "4k", "container": "mkv", "videoFrameRate": "24p", "videoProfile": "main 10", "hasVoiceActivity": false, "optimizedForStreaming": 1, "has64bitOffsets": false, "Part": [{"id": 119542, "key": "/library/parts/119542/1680457526/file.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", "size": 36158371307, "container": "mkv", "audioProfile": "dts", "has64bitOffsets": false, "optimizedForStreaming": false, "videoProfile": "main 10", "indexes": "sd", "hasThumbnail": "1", "Stream": [{"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}, {"id": 272796, "streamType": 1, "default": true, "selected": true, "codec": "h264", "index": 0, "bitrate": 6273, "colorPrimaries": "bt709", "colorRange": "tv", "colorSpace": "bt709", "colorTrc": "bt709", "bitDepth": 8, "chromaLocation": "left", "streamIdentifier": "2", "chromaSubsampling": "4:2:0", "codedHeight": 1088, "codedWidth": 1920, "frameRate": 29.97, "hasScalingMatrix": false, "hearingImpaired": false, "closedCaptions": false, "embeddedInVideo": "1", "height": 1080, "level": 40, "profile": "main", "refFrames": 4, "scanType": "progressive", "width": 1920, "displayTitle": "1080p (H.264)", "extendedDisplayTitle": "1080p (H.264)", "channels": 2, "language": "English", "languageTag": "en", "languageCode": "eng", "audioChannelLayout": "stereo", "samplingRate": 48000, "title": "English", "canAutoSync": false}]}]}], "Genre": [{"tag": "Adventure"}, {"tag": "Adventure"}], "Country": [{"tag": "United States of America"}, {"tag": "United States of America"}], "Director": [{"tag": "James Cameron"}], "Writer": [{"tag": "James Cameron"}], "Collection": [{"tag": "Working NL Subs"}, {"tag": "Working NL Subs"}], "Role": [{"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}, {"id": 294129, "filter": "actor=294129", "thumb": "https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg", "tag": "Mike Smith", "tagKey": "668e7e7b22bcad9064350c91", "role": "Self"}], "Location": [{"path": "/TV Shows/House"}, {"path": "/TV Shows/House"}, {"path": "/TV Shows/House"}], "Guid": [{"id": "imdb://tt13015952"}, {"id": "imdb://tt13015952"}], "UltraBlurColors": {"topLeft": "11333b", "topRight": "0a232d", "bottomRight": "73958", "bottomLeft": "1f5066"}, "Rating": [{"image": "themoviedb://image.rating", "value": 3, "type": "audience"}], "Image": [{"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}, {"alt": "Episode 1", "type": "background", "url": "/library/metadata/45521/thumb/1644710589"}], "titleSort": "Whale", "viewCount": 1, "lastViewedAt": 1682752242, "originalTitle": "映画 ブラッククローバー 魔法帝の剣", "viewOffset": 5222500, "skipCount": 1, "index": 1, "theme": "/library/metadata/1/theme/1705636920", "leafCount": 14, "viewedLeafCount": 0, "childCount": 1, "hasPremiumExtras": "1", "hasPremiumPrimaryExtra": "1", "parentRatingKey": "66", "parentGuid": "plex://show/5d9c081b170e24001f2a7be4", "parentStudio": "UCP", "parentKey": "/library/metadata/66", "parentTitle": "Caprica", "parentIndex": 1, "parentYear": 2010, "parentThumb": "/library/metadata/66/thumb/1705716261", "parentTheme": "/library/metadata/66/theme/1705716261"}}]}} "400": application/json: {"errors": []} "401": application/json: {"errors": [{"code": 1001, "message": "User could not be authenticated", "status": 401}]} +generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 3431dc6..2a794e8 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -13,7 +13,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false go: - version: 0.16.1 + version: 0.17.0 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index fdeda36..40ced83 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.438.3 +speakeasyVersion: 1.459.2 sources: my-source: sourceNamespace: my-source @@ -9,19 +9,19 @@ sources: - main plexapi: sourceNamespace: plexapi - sourceRevisionDigest: sha256:37c6bfb15f4154eb89b112465107f20757411f22bd1cc7d0a04335df7127fcb4 - sourceBlobDigest: sha256:290473ebc909cada80ff428c685b897f4621cf121397e1417355e06d334e7206 + sourceRevisionDigest: sha256:ccba0c42f1644923e2209e28da7a78195a843e48da1aeaaedbf8759f1a8a0fe0 + sourceBlobDigest: sha256:b362c110ef633288220a55ab50627374b996c64f2d9b8e020944e84ea2840332 tags: - latest - - main + - speakeasy-sdk-regen-1734739746 targets: plexgo: source: plexapi sourceNamespace: plexapi - sourceRevisionDigest: sha256:37c6bfb15f4154eb89b112465107f20757411f22bd1cc7d0a04335df7127fcb4 - sourceBlobDigest: sha256:290473ebc909cada80ff428c685b897f4621cf121397e1417355e06d334e7206 + sourceRevisionDigest: sha256:ccba0c42f1644923e2209e28da7a78195a843e48da1aeaaedbf8759f1a8a0fe0 + sourceBlobDigest: sha256:b362c110ef633288220a55ab50627374b996c64f2d9b8e020944e84ea2840332 codeSamplesNamespace: code-samples-go-plexgo - codeSamplesRevisionDigest: sha256:3d3923d5080a3df76181c5e2c153e6f9c88470f8366cbdea5628bb47fd67fd1b + codeSamplesRevisionDigest: sha256:41f5625e2b9341f86b5070f1425b466d26339870e28947bc87cb7c3fb30a9177 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index edf493a..eb6a15a 100644 --- a/README.md +++ b/README.md @@ -40,16 +40,24 @@ The following SDKs are generated from the OpenAPI Specification. They are automa ## Table of Contents + +* [github.com/LukeHagar/plexgo](#githubcomlukehagarplexgo) +* [Plex Media Server OpenAPI Specification](#plex-media-server-openapi-specification) + * [Documentation](#documentation) + * [SDKs](#sdks) + * [SDK Installation](#sdk-installation) + * [SDK Example Usage](#sdk-example-usage) + * [Available Resources and Operations](#available-resources-and-operations) + * [Retries](#retries) + * [Error Handling](#error-handling) + * [Server Selection](#server-selection) + * [Custom HTTP Client](#custom-http-client) + * [Authentication](#authentication) + * [Special Types](#special-types) +* [Development](#development) + * [Maturity](#maturity) + * [Contributions](#contributions) -* [SDK Installation](#sdk-installation) -* [SDK Example Usage](#sdk-example-usage) -* [Available Resources and Operations](#available-resources-and-operations) -* [Retries](#retries) -* [Error Handling](#error-handling) -* [Server Selection](#server-selection) -* [Custom HTTP Client](#custom-http-client) -* [Authentication](#authentication) -* [Special Types](#special-types) @@ -76,16 +84,12 @@ import ( ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetServerCapabilities(ctx) if err != nil { log.Fatal(err) @@ -250,16 +254,12 @@ import ( ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetServerCapabilities(ctx, operations.WithRetries( retry.Config{ Strategy: "backoff", @@ -293,6 +293,8 @@ import ( ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithRetryConfig( retry.Config{ @@ -306,14 +308,8 @@ func main() { RetryConnectionErrors: false, }), plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetServerCapabilities(ctx) if err != nil { log.Fatal(err) @@ -355,16 +351,12 @@ import ( ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetServerCapabilities(ctx) if err != nil { @@ -414,17 +406,13 @@ import ( ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithServerURL("https://10.10.10.47:32400"), plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetServerCapabilities(ctx) if err != nil { log.Fatal(err) @@ -450,16 +438,12 @@ import ( ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Plex.GetCompanionsData(ctx, operations.WithServerURL("https://plex.tv/api/v2")) if err != nil { log.Fatal(err) @@ -523,16 +507,12 @@ import ( ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetServerCapabilities(ctx) if err != nil { log.Fatal(err) diff --git a/RELEASES.md b/RELEASES.md index 4b9622b..8818428 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -972,4 +972,14 @@ Based on: ### Generated - [go v0.16.1] . ### Releases -- [Go v0.16.1] https://github.com/LukeHagar/plexgo/releases/tag/v0.16.1 - . \ No newline at end of file +- [Go v0.16.1] https://github.com/LukeHagar/plexgo/releases/tag/v0.16.1 - . + +## 2024-12-21 00:09:02 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.459.2 (2.483.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.17.0] . +### Releases +- [Go v0.17.0] https://github.com/LukeHagar/plexgo/releases/tag/v0.17.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 768027a..70f78b3 100644 --- a/USAGE.md +++ b/USAGE.md @@ -9,16 +9,12 @@ import ( ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetServerCapabilities(ctx) if err != nil { log.Fatal(err) diff --git a/activities.go b/activities.go index 1959ed7..28c8460 100644 --- a/activities.go +++ b/activities.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -54,7 +54,12 @@ func (s *Activities) GetServerActivities(ctx context.Context, opts ...operations } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/activities") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -82,6 +87,10 @@ func (s *Activities) GetServerActivities(ctx context.Context, opts ...operations return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -112,7 +121,11 @@ func (s *Activities) GetServerActivities(ctx context.Context, opts ...operations req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -285,7 +298,12 @@ func (s *Activities) CancelServerActivities(ctx context.Context, activityUUID st } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/activities/{activityUUID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -313,6 +331,10 @@ func (s *Activities) CancelServerActivities(ctx context.Context, activityUUID st return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -343,7 +365,11 @@ func (s *Activities) CancelServerActivities(ctx context.Context, activityUUID st req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/authentication.go b/authentication.go index 23c7c53..478f53b 100644 --- a/authentication.go +++ b/authentication.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -53,7 +53,12 @@ func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/security/token") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -85,6 +90,10 @@ func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -115,7 +124,11 @@ func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -269,7 +282,12 @@ func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, sou } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/security/resources") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -301,6 +319,10 @@ func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, sou return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -331,7 +353,11 @@ func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, sou req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -470,7 +496,6 @@ func (s *Authentication) GetTokenDetails(ctx context.Context, opts ...operations o := operations.Options{} supportedOptions := []string{ - operations.SupportedOptionServerURL, operations.SupportedOptionRetries, operations.SupportedOptionTimeout, } @@ -513,6 +538,10 @@ func (s *Authentication) GetTokenDetails(ctx context.Context, opts ...operations return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -543,7 +572,11 @@ func (s *Authentication) GetTokenDetails(ctx context.Context, opts ...operations req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -700,17 +733,8 @@ func (s *Authentication) PostUsersSignInData(ctx context.Context, request operat SecuritySource: nil, } - globals := operations.PostUsersSignInDataGlobals{ - ClientID: s.sdkConfiguration.Globals.ClientID, - ClientName: s.sdkConfiguration.Globals.ClientName, - DeviceNickname: s.sdkConfiguration.Globals.DeviceNickname, - ClientVersion: s.sdkConfiguration.Globals.ClientVersion, - Platform: s.sdkConfiguration.Globals.Platform, - } - o := operations.Options{} supportedOptions := []string{ - operations.SupportedOptionServerURL, operations.SupportedOptionRetries, operations.SupportedOptionTimeout, } @@ -755,7 +779,11 @@ func (s *Authentication) PostUsersSignInData(ctx context.Context, request operat req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) req.Header.Set("Content-Type", reqContentType) - utils.PopulateHeaders(ctx, req, request, globals) + utils.PopulateHeaders(ctx, req, request, nil) + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries @@ -787,7 +815,11 @@ func (s *Authentication) PostUsersSignInData(ctx context.Context, request operat req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/butler.go b/butler.go index 154900d..5470e29 100644 --- a/butler.go +++ b/butler.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -48,7 +48,12 @@ func (s *Butler) GetButlerTasks(ctx context.Context, opts ...operations.Option) } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/butler") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -76,6 +81,10 @@ func (s *Butler) GetButlerTasks(ctx context.Context, opts ...operations.Option) return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -106,7 +115,11 @@ func (s *Butler) GetButlerTasks(ctx context.Context, opts ...operations.Option) req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -279,7 +292,12 @@ func (s *Butler) StartAllTasks(ctx context.Context, opts ...operations.Option) ( } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/butler") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -307,6 +325,10 @@ func (s *Butler) StartAllTasks(ctx context.Context, opts ...operations.Option) ( return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -337,7 +359,11 @@ func (s *Butler) StartAllTasks(ctx context.Context, opts ...operations.Option) ( req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -486,7 +512,12 @@ func (s *Butler) StopAllTasks(ctx context.Context, opts ...operations.Option) (* } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/butler") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -514,6 +545,10 @@ func (s *Butler) StopAllTasks(ctx context.Context, opts ...operations.Option) (* return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -544,7 +579,11 @@ func (s *Butler) StopAllTasks(ctx context.Context, opts ...operations.Option) (* req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -701,7 +740,12 @@ func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName, op } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/butler/{taskName}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -729,6 +773,10 @@ func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName, op return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -759,7 +807,11 @@ func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName, op req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -914,7 +966,12 @@ func (s *Butler) StopTask(ctx context.Context, taskName operations.PathParamTask } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/butler/{taskName}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -942,6 +999,10 @@ func (s *Butler) StopTask(ctx context.Context, taskName operations.PathParamTask return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -972,7 +1033,11 @@ func (s *Butler) StopTask(ctx context.Context, taskName operations.PathParamTask req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/codeSamples.yaml b/codeSamples.yaml index ecbb52a..a15e698 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -8,2641 +8,454 @@ actions: x-codeSamples: - lang: go label: getServerCapabilities - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Server.GetServerCapabilities(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetServerCapabilities(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/:/prefs"]["get"] update: x-codeSamples: - lang: go label: getServerPreferences - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Server.GetServerPreferences(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetServerPreferences(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/:/progress"]["post"] update: x-codeSamples: - lang: go label: updatePlayProgress - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Media.UpdatePlayProgress(ctx, "", 90000, "played") - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Media.UpdatePlayProgress(ctx, \"\", 90000, \"played\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/:/scrobble"]["get"] update: x-codeSamples: - lang: go label: markPlayed - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Media.MarkPlayed(ctx, 59398) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Media.MarkPlayed(ctx, 59398)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/:/timeline"]["get"] update: x-codeSamples: - lang: go label: getTimeline - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Video.GetTimeline(ctx, operations.GetTimelineRequest{ - RatingKey: 23409, - Key: "/library/metadata/23409", - State: operations.StatePlaying, - HasMDE: 1, - Time: 2000, - Duration: 10000, - Context: "home:hub.continueWatching", - PlayQueueItemID: 1, - PlayBackTime: 2000, - Row: 1, - }) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Video.GetTimeline(ctx, operations.GetTimelineRequest{\n RatingKey: 23409,\n Key: \"/library/metadata/23409\",\n State: operations.StatePlaying,\n HasMDE: 1,\n Time: 2000,\n Duration: 10000,\n Context: \"home:hub.continueWatching\",\n PlayQueueItemID: 1,\n PlayBackTime: 2000,\n Row: 1,\n })\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/:/unscrobble"]["get"] update: x-codeSamples: - lang: go label: markUnplayed - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Media.MarkUnplayed(ctx, 59398) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Media.MarkUnplayed(ctx, 59398)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/activities"]["get"] update: x-codeSamples: - lang: go label: getServerActivities - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Activities.GetServerActivities(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Activities.GetServerActivities(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/activities/{activityUUID}"]["delete"] update: x-codeSamples: - lang: go label: cancelServerActivities - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Activities.CancelServerActivities(ctx, "25b71ed5-0f9d-461c-baa7-d404e9e10d3e") - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Activities.CancelServerActivities(ctx, \"25b71ed5-0f9d-461c-baa7-d404e9e10d3e\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/butler"]["delete"] update: x-codeSamples: - lang: go label: stopAllTasks - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Butler.StopAllTasks(ctx) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Butler.StopAllTasks(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/butler"]["get"] update: x-codeSamples: - lang: go label: getButlerTasks - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Butler.GetButlerTasks(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Butler.GetButlerTasks(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/butler"]["post"] update: x-codeSamples: - lang: go label: startAllTasks - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Butler.StartAllTasks(ctx) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Butler.StartAllTasks(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/butler/{taskName}"]["delete"] update: x-codeSamples: - lang: go label: stopTask - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Butler.StopTask(ctx, operations.PathParamTaskNameBackupDatabase) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Butler.StopTask(ctx, operations.PathParamTaskNameBackupDatabase)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/butler/{taskName}"]["post"] update: x-codeSamples: - lang: go label: startTask - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Butler.StartTask(ctx, operations.TaskNameCleanOldBundles) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Butler.StartTask(ctx, operations.TaskNameCleanOldBundles)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/clients"]["get"] update: x-codeSamples: - lang: go label: getAvailableClients - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Server.GetAvailableClients(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetAvailableClients(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/companions"]["get"] update: x-codeSamples: - lang: go label: getCompanionsData - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Plex.GetCompanionsData(ctx) - if err != nil { - log.Fatal(err) - } - if res.ResponseBodies != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Plex.GetCompanionsData(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseBodies != nil {\n // handle response\n }\n}" - target: $["paths"]["/devices"]["get"] update: x-codeSamples: - lang: go label: getDevices - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Server.GetDevices(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetDevices(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/friends"]["get"] update: x-codeSamples: - lang: go label: getUserFriends - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Plex.GetUserFriends(ctx) - if err != nil { - log.Fatal(err) - } - if res.Friends != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Plex.GetUserFriends(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Friends != nil {\n // handle response\n }\n}" - target: $["paths"]["/geoip"]["get"] update: x-codeSamples: - lang: go label: getGeoData - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Plex.GetGeoData(ctx) - if err != nil { - log.Fatal(err) - } - if res.GeoData != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Plex.GetGeoData(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.GeoData != nil {\n // handle response\n }\n}" - target: $["paths"]["/home"]["get"] update: x-codeSamples: - lang: go label: getHomeData - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Plex.GetHomeData(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Plex.GetHomeData(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/hubs"]["get"] update: x-codeSamples: - lang: go label: getGlobalHubs - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Hubs.GetGlobalHubs(ctx, nil, nil) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Hubs.GetGlobalHubs(ctx, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/hubs/home/recentlyAdded"]["get"] update: x-codeSamples: - lang: go label: added - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Hubs.GetRecentlyAdded(ctx, operations.GetRecentlyAddedRequest{ - ContentDirectoryID: 470161, - SectionID: plexgo.Int64(2), - Type: operations.TypeTvShow, - IncludeMeta: operations.IncludeMetaEnable.ToPointer(), - XPlexContainerStart: plexgo.Int(0), - XPlexContainerSize: plexgo.Int(50), - }) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Hubs.GetRecentlyAdded(ctx, operations.GetRecentlyAddedRequest{\n ContentDirectoryID: 470161,\n SectionID: plexgo.Int64(2),\n Type: operations.TypeTvShow,\n IncludeMeta: operations.IncludeMetaEnable.ToPointer(),\n XPlexContainerStart: plexgo.Int(0),\n XPlexContainerSize: plexgo.Int(50),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/hubs/search"]["get"] update: x-codeSamples: - lang: go label: performSearch - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Search.PerformSearch(ctx, "dylan", nil, plexgo.Float64(5)) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Search.PerformSearch(ctx, \"dylan\", nil, plexgo.Float64(5))\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/hubs/search/voice"]["get"] update: x-codeSamples: - lang: go label: performVoiceSearch - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Search.PerformVoiceSearch(ctx, "dead+poop", nil, plexgo.Float64(5)) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Search.PerformVoiceSearch(ctx, \"dead+poop\", nil, plexgo.Float64(5))\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/hubs/sections/{sectionId}"]["get"] update: x-codeSamples: - lang: go label: getLibraryHubs - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Hubs.GetLibraryHubs(ctx, 6728.76, nil, nil) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Hubs.GetLibraryHubs(ctx, 6728.76, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/identity"]["get"] update: x-codeSamples: - lang: go label: identity - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Server.GetServerIdentity(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Server.GetServerIdentity(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/all/top"]["get"] update: x-codeSamples: - lang: go label: getTopWatchedContent - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetTopWatchedContent(ctx, operations.GetTopWatchedContentQueryParamTypeTvShow, plexgo.Int64(1)) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetTopWatchedContent(ctx, operations.GetTopWatchedContentQueryParamTypeTvShow, plexgo.Int64(1))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/hashes"]["get"] update: x-codeSamples: - lang: go label: getFileHash - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetFileHash(ctx, "file://C:\Image.png&type=13", nil) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetFileHash(ctx, \"file://C:\\Image.png&type=13\", nil)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/metadata/{ratingKey}"]["get"] update: x-codeSamples: - lang: go label: key - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetMetaDataByRatingKey(ctx, 9518) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetMetaDataByRatingKey(ctx, 9518)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/metadata/{ratingKey}/banner"]["get"] update: x-codeSamples: - lang: go label: image - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Media.GetBannerImage(ctx, operations.GetBannerImageRequest{ - RatingKey: 9518, - Width: 396, - Height: 396, - MinSize: 1, - Upscale: 1, - XPlexToken: "CV5xoxjTpFKUzBTShsaf", - }) - if err != nil { - log.Fatal(err) - } - if res.ResponseStream != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Media.GetBannerImage(ctx, operations.GetBannerImageRequest{\n RatingKey: 9518,\n Width: 396,\n Height: 396,\n MinSize: 1,\n Upscale: 1,\n XPlexToken: \"CV5xoxjTpFKUzBTShsaf\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseStream != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/metadata/{ratingKey}/children"]["get"] update: x-codeSamples: - lang: go label: getMetadataChildren - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetMetadataChildren(ctx, 1539.15, plexgo.String("Stream")) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetMetadataChildren(ctx, 1539.15, plexgo.String(\"Stream\"))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/metadata/{ratingKey}/thumb"]["get"] update: x-codeSamples: - lang: go label: image - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Media.GetThumbImage(ctx, operations.GetThumbImageRequest{ - RatingKey: 9518, - Width: 396, - Height: 396, - MinSize: 1, - Upscale: 1, - XPlexToken: "CV5xoxjTpFKUzBTShsaf", - }) - if err != nil { - log.Fatal(err) - } - if res.ResponseStream != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Media.GetThumbImage(ctx, operations.GetThumbImageRequest{\n RatingKey: 9518,\n Width: 396,\n Height: 396,\n MinSize: 1,\n Upscale: 1,\n XPlexToken: \"CV5xoxjTpFKUzBTShsaf\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.ResponseStream != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/onDeck"]["get"] update: x-codeSamples: - lang: go label: getOnDeck - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetOnDeck(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetOnDeck(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/recentlyAdded"]["get"] update: x-codeSamples: - lang: go label: library - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetRecentlyAddedLibrary(ctx, operations.GetRecentlyAddedLibraryRequest{ - ContentDirectoryID: plexgo.Int64(2), - PinnedContentDirectoryID: []int64{ - 3, - 5, - 7, - 13, - 12, - 1, - 6, - 14, - 2, - 10, - 16, - 17, - }, - SectionID: plexgo.Int64(2), - Type: operations.QueryParamTypeTvShow, - IncludeMeta: operations.QueryParamIncludeMetaEnable.ToPointer(), - XPlexContainerStart: plexgo.Int(0), - XPlexContainerSize: plexgo.Int(50), - }) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetRecentlyAddedLibrary(ctx, operations.GetRecentlyAddedLibraryRequest{\n ContentDirectoryID: plexgo.Int64(2),\n PinnedContentDirectoryID: []int64{\n 3,\n 5,\n 7,\n 13,\n 12,\n 1,\n 6,\n 14,\n 2,\n 10,\n 16,\n 17,\n },\n SectionID: plexgo.Int64(2),\n Type: operations.QueryParamTypeTvShow,\n IncludeMeta: operations.QueryParamIncludeMetaEnable.ToPointer(),\n XPlexContainerStart: plexgo.Int(0),\n XPlexContainerSize: plexgo.Int(50),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/search"]["get"] update: x-codeSamples: - lang: go label: libraries - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetSearchAllLibraries(ctx, operations.GetSearchAllLibrariesRequest{ - Query: "", - SearchTypes: []operations.SearchTypes{ - operations.SearchTypesPeople, - }, - IncludeCollections: operations.QueryParamIncludeCollectionsEnable.ToPointer(), - IncludeExternalMedia: operations.QueryParamIncludeExternalMediaEnable.ToPointer(), - }) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetSearchAllLibraries(ctx, operations.GetSearchAllLibrariesRequest{\n Query: \"\",\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n SearchTypes: []operations.SearchTypes{\n operations.SearchTypesPeople,\n },\n IncludeCollections: operations.QueryParamIncludeCollectionsEnable.ToPointer(),\n IncludeExternalMedia: operations.QueryParamIncludeExternalMediaEnable.ToPointer(),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/sections"]["get"] update: x-codeSamples: - lang: go label: libraries - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetAllLibraries(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetAllLibraries(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/sections/watchlist/{filter}"]["get"] update: x-codeSamples: - lang: go label: list - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Watchlist.GetWatchList(ctx, operations.GetWatchListRequest{ - Filter: operations.FilterAvailable, - XPlexContainerStart: plexgo.Int(0), - XPlexContainerSize: plexgo.Int(50), - XPlexToken: "CV5xoxjTpFKUzBTShsaf", - }) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Watchlist.GetWatchList(ctx, operations.GetWatchListRequest{\n Filter: operations.FilterAvailable,\n XPlexContainerStart: plexgo.Int(0),\n XPlexContainerSize: plexgo.Int(50),\n XPlexToken: \"CV5xoxjTpFKUzBTShsaf\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/sections/{sectionKey}"]["delete"] update: x-codeSamples: - lang: go label: deleteLibrary - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.DeleteLibrary(ctx, 9518) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.DeleteLibrary(ctx, 9518)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/sections/{sectionKey}"]["get"] update: x-codeSamples: - lang: go label: details - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetLibraryDetails(ctx, 9518, nil) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetLibraryDetails(ctx, 9518, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/sections/{sectionKey}/refresh"]["get"] update: x-codeSamples: - lang: go label: metadata - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetRefreshLibraryMetadata(ctx, 9518, operations.ForceOne.ToPointer()) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetRefreshLibraryMetadata(ctx, 9518, operations.ForceOne.ToPointer())\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/sections/{sectionKey}/search"]["get"] update: x-codeSamples: - lang: go label: library - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetSearchLibrary(ctx, 9518, operations.GetSearchLibraryQueryParamTypeTvShow) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetSearchLibrary(ctx, 9518, operations.GetSearchLibraryQueryParamTypeTvShow)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/library/sections/{sectionKey}/{tag}"]["get"] update: x-codeSamples: - lang: go label: items - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Library.GetLibraryItems(ctx, operations.GetLibraryItemsRequest{ - Tag: operations.TagEdition, - IncludeGuids: operations.IncludeGuidsEnable.ToPointer(), - Type: operations.GetLibraryItemsQueryParamTypeTvShow.ToPointer(), - SectionKey: 9518, - IncludeMeta: operations.GetLibraryItemsQueryParamIncludeMetaEnable.ToPointer(), - XPlexContainerStart: plexgo.Int(0), - XPlexContainerSize: plexgo.Int(50), - }) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Library.GetLibraryItems(ctx, operations.GetLibraryItemsRequest{\n Tag: operations.TagEdition,\n IncludeGuids: operations.IncludeGuidsEnable.ToPointer(),\n Type: operations.GetLibraryItemsQueryParamTypeTvShow.ToPointer(),\n SectionKey: 9518,\n IncludeMeta: operations.GetLibraryItemsQueryParamIncludeMetaEnable.ToPointer(),\n XPlexContainerStart: plexgo.Int(0),\n XPlexContainerSize: plexgo.Int(50),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/log"]["get"] update: x-codeSamples: - lang: go label: logLine - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Log.LogLine(ctx, operations.LevelThree, "Test log message", "Postman") - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Log.LogLine(ctx, operations.LevelThree, \"Test log message\", \"Postman\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/log"]["post"] update: x-codeSamples: - lang: go label: logMultiLine - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Log.LogMultiLine(ctx, "level=4&message=Test%20message%201&source=postman\n" + - "level=3&message=Test%20message%202&source=postman\n" + - "level=1&message=Test%20message%203&source=postman") - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Log.LogMultiLine(ctx, \"level=4&message=Test%20message%201&source=postman\\n\" +\n \"level=3&message=Test%20message%202&source=postman\\n\" +\n \"level=1&message=Test%20message%203&source=postman\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/log/networked"]["get"] update: x-codeSamples: - lang: go label: enablePaperTrail - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Log.EnablePaperTrail(ctx) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Log.EnablePaperTrail(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/media/providers"]["get"] update: x-codeSamples: - lang: go label: providers - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Server.GetMediaProviders(ctx, "CV5xoxjTpFKUzBTShsaf") - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetMediaProviders(ctx, \"CV5xoxjTpFKUzBTShsaf\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/myplex/account"]["get"] update: x-codeSamples: - lang: go label: getMyPlexAccount - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Server.GetMyPlexAccount(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetMyPlexAccount(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/photo/:/transcode"]["get"] update: x-codeSamples: - lang: go label: getResizedPhoto - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Server.GetResizedPhoto(ctx, operations.GetResizedPhotoRequest{ - Width: 110, - Height: 165, - Opacity: 100, - Blur: 0, - MinSize: operations.MinSizeOne, - Upscale: operations.UpscaleOne, - URL: "/library/metadata/49564/thumb/1654258204", - }) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetResizedPhoto(ctx, operations.GetResizedPhotoRequest{\n Width: 110,\n Height: 165,\n Opacity: 100,\n Blur: 0,\n MinSize: operations.MinSizeOne,\n Upscale: operations.UpscaleOne,\n URL: \"/library/metadata/49564/thumb/1654258204\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/pins"]["post"] update: x-codeSamples: - lang: go label: getPin - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Plex.GetPin(ctx, operations.GetPinRequest{}) - if err != nil { - log.Fatal(err) - } - if res.AuthPinContainer != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Plex.GetPin(ctx, operations.GetPinRequest{\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.AuthPinContainer != nil {\n // handle response\n }\n}" - target: $["paths"]["/pins/{pinID}"]["get"] update: x-codeSamples: - lang: go label: getTokenByPinId - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Plex.GetTokenByPinID(ctx, operations.GetTokenByPinIDRequest{ - PinID: 408895, - }) - if err != nil { - log.Fatal(err) - } - if res.AuthPinContainer != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Plex.GetTokenByPinID(ctx, operations.GetTokenByPinIDRequest{\n PinID: 408895,\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.AuthPinContainer != nil {\n // handle response\n }\n}" - target: $["paths"]["/playlists"]["get"] update: x-codeSamples: - lang: go label: getPlaylists - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Playlists.GetPlaylists(ctx, nil, nil) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.GetPlaylists(ctx, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/playlists"]["post"] update: x-codeSamples: - lang: go label: createPlaylist - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Playlists.CreatePlaylist(ctx, operations.CreatePlaylistRequest{ - Title: "", - Type: operations.CreatePlaylistQueryParamTypePhoto, - Smart: operations.SmartOne, - URI: "https://hoarse-testing.info/", - }) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.CreatePlaylist(ctx, operations.CreatePlaylistRequest{\n Title: \"\",\n Type: operations.CreatePlaylistQueryParamTypePhoto,\n Smart: operations.SmartOne,\n URI: \"https://hoarse-testing.info/\",\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/playlists/upload"]["post"] update: x-codeSamples: - lang: go label: uploadPlaylist - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Playlists.UploadPlaylist(ctx, "/home/barkley/playlist.m3u", operations.QueryParamForceZero, 1) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.UploadPlaylist(ctx, \"/home/barkley/playlist.m3u\", operations.QueryParamForceZero, 1)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/playlists/{playlistID}"]["delete"] update: x-codeSamples: - lang: go label: deletePlaylist - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Playlists.DeletePlaylist(ctx, 216.22) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.DeletePlaylist(ctx, 216.22)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/playlists/{playlistID}"]["get"] update: x-codeSamples: - lang: go label: getPlaylist - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Playlists.GetPlaylist(ctx, 4109.48) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.GetPlaylist(ctx, 4109.48)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/playlists/{playlistID}"]["put"] update: x-codeSamples: - lang: go label: updatePlaylist - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Playlists.UpdatePlaylist(ctx, 3915.00, nil, nil) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.UpdatePlaylist(ctx, 3915.00, nil, nil)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/playlists/{playlistID}/items"]["delete"] update: x-codeSamples: - lang: go label: clearPlaylistContents - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Playlists.ClearPlaylistContents(ctx, 1893.18) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.ClearPlaylistContents(ctx, 1893.18)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/playlists/{playlistID}/items"]["get"] update: x-codeSamples: - lang: go label: getPlaylistContents - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Playlists.GetPlaylistContents(ctx, 5004.46, operations.GetPlaylistContentsQueryParamTypeTvShow) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.GetPlaylistContents(ctx, 5004.46, operations.GetPlaylistContentsQueryParamTypeTvShow)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/playlists/{playlistID}/items"]["put"] update: x-codeSamples: - lang: go label: addPlaylistContents - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Playlists.AddPlaylistContents(ctx, 8502.00, "server://12345/com.plexapp.plugins.library/library/metadata/1", plexgo.Float64(123)) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Playlists.AddPlaylistContents(ctx, 8502.00, \"server://12345/com.plexapp.plugins.library/library/metadata/1\", plexgo.Float64(123))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/resources"]["get"] update: x-codeSamples: - lang: go label: resources - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Plex.GetServerResources(ctx, operations.IncludeHTTPSEnable.ToPointer(), operations.IncludeRelayEnable.ToPointer(), operations.IncludeIPv6Enable.ToPointer(), plexgo.String("3381b62b-9ab7-4e37-827b-203e9809eb58")) - if err != nil { - log.Fatal(err) - } - if res.PlexDevices != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Plex.GetServerResources(ctx, \"3381b62b-9ab7-4e37-827b-203e9809eb58\", operations.IncludeHTTPSEnable.ToPointer(), operations.IncludeRelayEnable.ToPointer(), operations.IncludeIPv6Enable.ToPointer())\n if err != nil {\n log.Fatal(err)\n }\n if res.PlexDevices != nil {\n // handle response\n }\n}" - target: $["paths"]["/search"]["get"] update: x-codeSamples: - lang: go label: getSearchResults - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Search.GetSearchResults(ctx, "110") - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Search.GetSearchResults(ctx, \"110\")\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/security/resources"]["get"] update: x-codeSamples: - lang: go label: getSourceConnectionInformation - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Authentication.GetSourceConnectionInformation(ctx, "provider://provider-identifier") - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Authentication.GetSourceConnectionInformation(ctx, \"provider://provider-identifier\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/security/token"]["get"] update: x-codeSamples: - lang: go label: getTransientToken - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Authentication.GetTransientToken(ctx, operations.GetTransientTokenQueryParamTypeDelegation, operations.ScopeAll) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Authentication.GetTransientToken(ctx, operations.GetTransientTokenQueryParamTypeDelegation, operations.ScopeAll)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/servers"]["get"] update: x-codeSamples: - lang: go label: getServerList - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Server.GetServerList(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Server.GetServerList(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/statistics/bandwidth"]["get"] update: x-codeSamples: - lang: go label: getBandwidthStatistics - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Statistics.GetBandwidthStatistics(ctx, plexgo.Int64(4)) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Statistics.GetBandwidthStatistics(ctx, plexgo.Int64(4))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/statistics/media"]["get"] update: x-codeSamples: - lang: go label: getStatistics - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Statistics.GetStatistics(ctx, plexgo.Int64(4)) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Statistics.GetStatistics(ctx, plexgo.Int64(4))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/statistics/resources"]["get"] update: x-codeSamples: - lang: go label: getResourcesStatistics - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Statistics.GetResourcesStatistics(ctx, plexgo.Int64(4)) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Statistics.GetResourcesStatistics(ctx, plexgo.Int64(4))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/status/sessions"]["get"] update: x-codeSamples: - lang: go label: getSessions - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Sessions.GetSessions(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Sessions.GetSessions(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/status/sessions/history/all"]["get"] update: x-codeSamples: - lang: go label: getSessionHistory - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Sessions.GetSessionHistory(ctx, plexgo.String("viewedAt:desc"), plexgo.Int64(1), &operations.QueryParamFilter{}, plexgo.Int64(12)) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Sessions.GetSessionHistory(ctx, plexgo.String(\"viewedAt:desc\"), plexgo.Int64(1), &operations.QueryParamFilter{}, plexgo.Int64(12))\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/transcode/sessions"]["get"] update: x-codeSamples: - lang: go label: getTranscodeSessions - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Sessions.GetTranscodeSessions(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Sessions.GetTranscodeSessions(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/transcode/sessions/{sessionKey}"]["delete"] update: x-codeSamples: - lang: go label: stopTranscodeSession - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Sessions.StopTranscodeSession(ctx, "zz7llzqlx8w9vnrsbnwhbmep") - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Sessions.StopTranscodeSession(ctx, \"zz7llzqlx8w9vnrsbnwhbmep\")\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/updater/apply"]["put"] update: x-codeSamples: - lang: go label: applyUpdates - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Updater.ApplyUpdates(ctx, operations.TonightOne.ToPointer(), operations.SkipOne.ToPointer()) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Updater.ApplyUpdates(ctx, operations.TonightOne.ToPointer(), operations.SkipOne.ToPointer())\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/updater/check"]["put"] update: x-codeSamples: - lang: go label: checkForUpdates - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Updater.CheckForUpdates(ctx, operations.DownloadOne.ToPointer()) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Updater.CheckForUpdates(ctx, operations.DownloadOne.ToPointer())\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" - target: $["paths"]["/updater/status"]["get"] update: x-codeSamples: - lang: go label: getUpdateStatus - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Updater.GetUpdateStatus(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Updater.GetUpdateStatus(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Object != nil {\n // handle response\n }\n}" - target: $["paths"]["/user"]["get"] update: x-codeSamples: - lang: go label: getTokenDetails - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Authentication.GetTokenDetails(ctx) - if err != nil { - log.Fatal(err) - } - if res.UserPlexAccount != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Authentication.GetTokenDetails(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.UserPlexAccount != nil {\n // handle response\n }\n}" - target: $["paths"]["/users/signin"]["post"] update: x-codeSamples: - lang: go label: data - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Authentication.PostUsersSignInData(ctx, operations.PostUsersSignInDataRequest{ - RequestBody: &operations.PostUsersSignInDataRequestBody{ - Login: "username@email.com", - Password: "password123", - VerificationCode: plexgo.String("123456"), - }, - }) - if err != nil { - log.Fatal(err) - } - if res.UserPlexAccount != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New()\n\n res, err := s.Authentication.PostUsersSignInData(ctx, operations.PostUsersSignInDataRequest{\n ClientID: \"3381b62b-9ab7-4e37-827b-203e9809eb58\",\n ClientName: plexgo.String(\"Plex for Roku\"),\n DeviceNickname: plexgo.String(\"Roku 3\"),\n ClientVersion: plexgo.String(\"2.4.1\"),\n Platform: plexgo.String(\"Roku\"),\n RequestBody: &operations.PostUsersSignInDataRequestBody{\n Login: \"username@email.com\",\n Password: \"password123\",\n VerificationCode: plexgo.String(\"123456\"),\n },\n })\n if err != nil {\n log.Fatal(err)\n }\n if res.UserPlexAccount != nil {\n // handle response\n }\n}" - target: $["paths"]["/video/:/transcode/universal/start.mpd"]["get"] update: x-codeSamples: - lang: go label: startUniversalTranscode - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "github.com/LukeHagar/plexgo/models/operations" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - - ctx := context.Background() - res, err := s.Video.StartUniversalTranscode(ctx, operations.StartUniversalTranscodeRequest{ - HasMDE: 1, - Path: "/library/metadata/23409", - MediaIndex: 0, - PartIndex: 0, - Protocol: "hls", - FastSeek: plexgo.Float64(0), - DirectPlay: plexgo.Float64(0), - DirectStream: plexgo.Float64(0), - SubtitleSize: plexgo.Float64(100), - Subtites: plexgo.String("burn"), - AudioBoost: plexgo.Float64(100), - Location: plexgo.String("lan"), - MediaBufferSize: plexgo.Float64(102400), - Session: plexgo.String("zvcage8b7rkioqcm8f4uns4c"), - AddDebugOverlay: plexgo.Float64(0), - AutoAdjustQuality: plexgo.Float64(0), - }) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } + source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/LukeHagar/plexgo\"\n\t\"github.com/LukeHagar/plexgo/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n ctx := context.Background()\n \n s := plexgo.New(\n plexgo.WithSecurity(\"\"),\n )\n\n res, err := s.Video.StartUniversalTranscode(ctx, operations.StartUniversalTranscodeRequest{\n HasMDE: 1,\n Path: \"/library/metadata/23409\",\n MediaIndex: 0,\n PartIndex: 0,\n Protocol: \"hls\",\n FastSeek: plexgo.Float64(0),\n DirectPlay: plexgo.Float64(0),\n DirectStream: plexgo.Float64(0),\n SubtitleSize: plexgo.Float64(100),\n Subtites: plexgo.String(\"burn\"),\n AudioBoost: plexgo.Float64(100),\n Location: plexgo.String(\"lan\"),\n MediaBufferSize: plexgo.Float64(102400),\n Session: plexgo.String(\"zvcage8b7rkioqcm8f4uns4c\"),\n AddDebugOverlay: plexgo.Float64(0),\n AutoAdjustQuality: plexgo.Float64(0),\n })\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" diff --git a/docs/models/operations/getlibraryitemsmetadata.md b/docs/models/operations/getlibraryitemsmetadata.md index db4af80..7933f75 100644 --- a/docs/models/operations/getlibraryitemsmetadata.md +++ b/docs/models/operations/getlibraryitemsmetadata.md @@ -24,7 +24,7 @@ | `SeasonCount` | **int* | :heavy_minus_sign: | N/A | 2022 | | `Tagline` | **string* | :heavy_minus_sign: | N/A | Return to Pandora. | | `FlattenSeasons` | [*operations.GetLibraryItemsFlattenSeasons](../../models/operations/getlibraryitemsflattenseasons.md) | :heavy_minus_sign: | N/A | 1 | -| `ShowOrdering` | [*operations.GetLibraryItemsShowOrdering](../../models/operations/getlibraryitemsshowordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show
None = Library default,
tmdbAiring = The Movie Database (Aired),
aired = TheTVDB (Aired),
dvd = TheTVDB (DVD),
absolute = TheTVDB (Absolute)).
| dvd | +| `ShowOrdering` | [*operations.GetLibraryItemsShowOrdering](../../models/operations/getlibraryitemsshowordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show
None = Library default,
tmdbAiring = The Movie Database (Aired),
tvdbAiring = TheTVDB (Aired),
tvdbDvd = TheTVDB (DVD),
tvdbAbsolute = TheTVDB (Absolute)).
| tvdbDvd | | `Thumb` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/thumb/1703239236 | | `Art` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/art/1703239236 | | `Banner` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/banner/1703239236 | diff --git a/docs/models/operations/getlibraryitemsqueryparamtype.md b/docs/models/operations/getlibraryitemsqueryparamtype.md index 4433535..03df8f3 100644 --- a/docs/models/operations/getlibraryitemsqueryparamtype.md +++ b/docs/models/operations/getlibraryitemsqueryparamtype.md @@ -17,4 +17,6 @@ E.g. A movie library will not return anything with type 3 as there are no season | `GetLibraryItemsQueryParamTypeTvShow` | 2 | | `GetLibraryItemsQueryParamTypeSeason` | 3 | | `GetLibraryItemsQueryParamTypeEpisode` | 4 | -| `GetLibraryItemsQueryParamTypeAudio` | 8 | \ No newline at end of file +| `GetLibraryItemsQueryParamTypeAudio` | 8 | +| `GetLibraryItemsQueryParamTypeAlbum` | 9 | +| `GetLibraryItemsQueryParamTypeTrack` | 10 | \ No newline at end of file diff --git a/docs/models/operations/getlibraryitemsshowordering.md b/docs/models/operations/getlibraryitemsshowordering.md index f8f95e1..0e3b3cf 100644 --- a/docs/models/operations/getlibraryitemsshowordering.md +++ b/docs/models/operations/getlibraryitemsshowordering.md @@ -1,20 +1,20 @@ # GetLibraryItemsShowOrdering -Setting that indicates the episode ordering for the show -None = Library default, -tmdbAiring = The Movie Database (Aired), -aired = TheTVDB (Aired), -dvd = TheTVDB (DVD), -absolute = TheTVDB (Absolute)). +Setting that indicates the episode ordering for the show +None = Library default, +tmdbAiring = The Movie Database (Aired), +tvdbAiring = TheTVDB (Aired), +tvdbDvd = TheTVDB (DVD), +tvdbAbsolute = TheTVDB (Absolute)). ## Values -| Name | Value | -| --------------------------------------- | --------------------------------------- | -| `GetLibraryItemsShowOrderingNone` | None | -| `GetLibraryItemsShowOrderingTmdbAiring` | tmdbAiring | -| `GetLibraryItemsShowOrderingAired` | aired | -| `GetLibraryItemsShowOrderingDvd` | dvd | -| `GetLibraryItemsShowOrderingAbsolute` | absolute | \ No newline at end of file +| Name | Value | +| ----------------------------------------- | ----------------------------------------- | +| `GetLibraryItemsShowOrderingNone` | None | +| `GetLibraryItemsShowOrderingTmdbAiring` | tmdbAiring | +| `GetLibraryItemsShowOrderingTvdbAiring` | tvdbAiring | +| `GetLibraryItemsShowOrderingTvdbDvd` | tvdbDvd | +| `GetLibraryItemsShowOrderingTvdbAbsolute` | tvdbAbsolute | \ No newline at end of file diff --git a/docs/models/operations/getmetadatabyratingkeymetadata.md b/docs/models/operations/getmetadatabyratingkeymetadata.md index 6d9892d..212f40b 100644 --- a/docs/models/operations/getmetadatabyratingkeymetadata.md +++ b/docs/models/operations/getmetadatabyratingkeymetadata.md @@ -14,6 +14,11 @@ | `LibrarySectionTitle` | **string* | :heavy_minus_sign: | N/A | Movies | | `LibrarySectionID` | **int* | :heavy_minus_sign: | N/A | 1 | | `LibrarySectionKey` | **string* | :heavy_minus_sign: | N/A | /library/sections/1 | +| `GrandparentTitle` | **string* | :heavy_minus_sign: | The name of the album artist for the track when audio, and the name of the TV show for the episode when video. | | +| `ParentTitle` | **string* | :heavy_minus_sign: | The name of the album for the track when audio, and the name of the season for the episode when TV show. | | +| `OriginalTitle` | **string* | :heavy_minus_sign: | The orginal untranslated name of the media item when non-english. | | +| `Index` | **int64* | :heavy_minus_sign: | The index starting from 0 of this media item in the MetaData array. | | +| `ParentIndex` | **int64* | :heavy_minus_sign: | The parent index starting from 0 of this media item in the parent MetaData array. | | | `ContentRating` | **string* | :heavy_minus_sign: | N/A | PG-13 | | `Summary` | **string* | :heavy_minus_sign: | N/A | Serenity continues the story of the TV series it was based upon ("Firefly"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job. | | `Rating` | **float64* | :heavy_minus_sign: | N/A | 8.2 | diff --git a/docs/models/operations/getpinglobals.md b/docs/models/operations/getpinglobals.md deleted file mode 100644 index 8917015..0000000 --- a/docs/models/operations/getpinglobals.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetPinGlobals - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `ClientID` | **string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | -| `ClientName` | **string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku | -| `DeviceNickname` | **string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 | -| `ClientVersion` | **string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 | -| `Platform` | **string* | :heavy_minus_sign: | The platform of the client application. | Roku | \ No newline at end of file diff --git a/docs/models/operations/getpinrequest.md b/docs/models/operations/getpinrequest.md index 727abd1..a73c917 100644 --- a/docs/models/operations/getpinrequest.md +++ b/docs/models/operations/getpinrequest.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | `Strong` | **bool* | :heavy_minus_sign: | 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`
| | -| `ClientID` | **string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | +| `ClientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | | `ClientName` | **string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku | | `DeviceNickname` | **string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 | | `ClientVersion` | **string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 | diff --git a/docs/models/operations/getplaylistcontentsqueryparamtype.md b/docs/models/operations/getplaylistcontentsqueryparamtype.md index 45dc8d4..086d0a5 100644 --- a/docs/models/operations/getplaylistcontentsqueryparamtype.md +++ b/docs/models/operations/getplaylistcontentsqueryparamtype.md @@ -17,4 +17,6 @@ E.g. A movie library will not return anything with type 3 as there are no season | `GetPlaylistContentsQueryParamTypeTvShow` | 2 | | `GetPlaylistContentsQueryParamTypeSeason` | 3 | | `GetPlaylistContentsQueryParamTypeEpisode` | 4 | -| `GetPlaylistContentsQueryParamTypeAudio` | 8 | \ No newline at end of file +| `GetPlaylistContentsQueryParamTypeAudio` | 8 | +| `GetPlaylistContentsQueryParamTypeAlbum` | 9 | +| `GetPlaylistContentsQueryParamTypeTrack` | 10 | \ No newline at end of file diff --git a/docs/models/operations/getrecentlyaddedmetadata.md b/docs/models/operations/getrecentlyaddedmetadata.md index 96e073d..df4a114 100644 --- a/docs/models/operations/getrecentlyaddedmetadata.md +++ b/docs/models/operations/getrecentlyaddedmetadata.md @@ -24,7 +24,7 @@ | `SeasonCount` | **int* | :heavy_minus_sign: | N/A | 2022 | | `Tagline` | **string* | :heavy_minus_sign: | N/A | Return to Pandora. | | `FlattenSeasons` | [*operations.FlattenSeasons](../../models/operations/flattenseasons.md) | :heavy_minus_sign: | N/A | 1 | -| `ShowOrdering` | [*operations.ShowOrdering](../../models/operations/showordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show
None = Library default,
tmdbAiring = The Movie Database (Aired),
aired = TheTVDB (Aired),
dvd = TheTVDB (DVD),
absolute = TheTVDB (Absolute)).
| dvd | +| `ShowOrdering` | [*operations.ShowOrdering](../../models/operations/showordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show
None = Library default,
tmdbAiring = The Movie Database (Aired),
tvdbAiring = TheTVDB (Aired),
tvdbDvd = TheTVDB (DVD),
tvdbAbsolute = TheTVDB (Absolute)).
| tvdbDvd | | `Thumb` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/thumb/1703239236 | | `Art` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/art/1703239236 | | `Banner` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/banner/1703239236 | diff --git a/docs/models/operations/getsearchalllibrariesglobals.md b/docs/models/operations/getsearchalllibrariesglobals.md deleted file mode 100644 index 6f4d3c6..0000000 --- a/docs/models/operations/getsearchalllibrariesglobals.md +++ /dev/null @@ -1,8 +0,0 @@ -# GetSearchAllLibrariesGlobals - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `ClientID` | **string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | \ No newline at end of file diff --git a/docs/models/operations/getsearchalllibrariesmetadata.md b/docs/models/operations/getsearchalllibrariesmetadata.md index 39227dc..cc06bf3 100644 --- a/docs/models/operations/getsearchalllibrariesmetadata.md +++ b/docs/models/operations/getsearchalllibrariesmetadata.md @@ -24,7 +24,7 @@ | `SeasonCount` | **int* | :heavy_minus_sign: | N/A | 2022 | | `Tagline` | **string* | :heavy_minus_sign: | N/A | Return to Pandora. | | `FlattenSeasons` | [*operations.GetSearchAllLibrariesFlattenSeasons](../../models/operations/getsearchalllibrariesflattenseasons.md) | :heavy_minus_sign: | N/A | 1 | -| `ShowOrdering` | [*operations.GetSearchAllLibrariesShowOrdering](../../models/operations/getsearchalllibrariesshowordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show
None = Library default,
tmdbAiring = The Movie Database (Aired),
aired = TheTVDB (Aired),
dvd = TheTVDB (DVD),
absolute = TheTVDB (Absolute)).
| dvd | +| `ShowOrdering` | [*operations.GetSearchAllLibrariesShowOrdering](../../models/operations/getsearchalllibrariesshowordering.md) | :heavy_minus_sign: | Setting that indicates the episode ordering for the show
None = Library default,
tmdbAiring = The Movie Database (Aired),
tvdbAiring = TheTVDB (Aired),
tvdbDvd = TheTVDB (DVD),
tvdbAbsolute = TheTVDB (Absolute)).
| tvdbDvd | | `Thumb` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/thumb/1703239236 | | `Art` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/art/1703239236 | | `Banner` | **string* | :heavy_minus_sign: | N/A | /library/metadata/58683/banner/1703239236 | diff --git a/docs/models/operations/getsearchalllibrariesrequest.md b/docs/models/operations/getsearchalllibrariesrequest.md index 3ece3c8..b7f8565 100644 --- a/docs/models/operations/getsearchalllibrariesrequest.md +++ b/docs/models/operations/getsearchalllibrariesrequest.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | | `Query` | *string* | :heavy_check_mark: | The search query term. | | -| `ClientID` | **string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | +| `ClientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | | `Limit` | **int64* | :heavy_minus_sign: | Limit the number of results returned. | | | `SearchTypes` | [][operations.SearchTypes](../../models/operations/searchtypes.md) | :heavy_minus_sign: | A comma-separated list of search types to include. Valid values are: movies, music, otherVideos, people, tv.
| movies,music,otherVideos,people,tv | | `IncludeCollections` | [*operations.QueryParamIncludeCollections](../../models/operations/queryparamincludecollections.md) | :heavy_minus_sign: | Whether to include collections in the search results. | 1 | diff --git a/docs/models/operations/getsearchalllibrariesshowordering.md b/docs/models/operations/getsearchalllibrariesshowordering.md index a415a98..2557d03 100644 --- a/docs/models/operations/getsearchalllibrariesshowordering.md +++ b/docs/models/operations/getsearchalllibrariesshowordering.md @@ -1,20 +1,20 @@ # GetSearchAllLibrariesShowOrdering -Setting that indicates the episode ordering for the show -None = Library default, -tmdbAiring = The Movie Database (Aired), -aired = TheTVDB (Aired), -dvd = TheTVDB (DVD), -absolute = TheTVDB (Absolute)). +Setting that indicates the episode ordering for the show +None = Library default, +tmdbAiring = The Movie Database (Aired), +tvdbAiring = TheTVDB (Aired), +tvdbDvd = TheTVDB (DVD), +tvdbAbsolute = TheTVDB (Absolute)). ## Values -| Name | Value | -| --------------------------------------------- | --------------------------------------------- | -| `GetSearchAllLibrariesShowOrderingNone` | None | -| `GetSearchAllLibrariesShowOrderingTmdbAiring` | tmdbAiring | -| `GetSearchAllLibrariesShowOrderingAired` | aired | -| `GetSearchAllLibrariesShowOrderingDvd` | dvd | -| `GetSearchAllLibrariesShowOrderingAbsolute` | absolute | \ No newline at end of file +| Name | Value | +| ----------------------------------------------- | ----------------------------------------------- | +| `GetSearchAllLibrariesShowOrderingNone` | None | +| `GetSearchAllLibrariesShowOrderingTmdbAiring` | tmdbAiring | +| `GetSearchAllLibrariesShowOrderingTvdbAiring` | tvdbAiring | +| `GetSearchAllLibrariesShowOrderingTvdbDvd` | tvdbDvd | +| `GetSearchAllLibrariesShowOrderingTvdbAbsolute` | tvdbAbsolute | \ No newline at end of file diff --git a/docs/models/operations/getsearchlibraryqueryparamtype.md b/docs/models/operations/getsearchlibraryqueryparamtype.md index 7f57fd1..d9a9dbd 100644 --- a/docs/models/operations/getsearchlibraryqueryparamtype.md +++ b/docs/models/operations/getsearchlibraryqueryparamtype.md @@ -17,4 +17,6 @@ E.g. A movie library will not return anything with type 3 as there are no season | `GetSearchLibraryQueryParamTypeTvShow` | 2 | | `GetSearchLibraryQueryParamTypeSeason` | 3 | | `GetSearchLibraryQueryParamTypeEpisode` | 4 | -| `GetSearchLibraryQueryParamTypeAudio` | 8 | \ No newline at end of file +| `GetSearchLibraryQueryParamTypeAudio` | 8 | +| `GetSearchLibraryQueryParamTypeAlbum` | 9 | +| `GetSearchLibraryQueryParamTypeTrack` | 10 | \ No newline at end of file diff --git a/docs/models/operations/getserverresourcesglobals.md b/docs/models/operations/getserverresourcesglobals.md deleted file mode 100644 index 07c1390..0000000 --- a/docs/models/operations/getserverresourcesglobals.md +++ /dev/null @@ -1,8 +0,0 @@ -# GetServerResourcesGlobals - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `ClientID` | **string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | \ No newline at end of file diff --git a/docs/models/operations/getserverresourcesrequest.md b/docs/models/operations/getserverresourcesrequest.md index 019194f..daf0301 100644 --- a/docs/models/operations/getserverresourcesrequest.md +++ b/docs/models/operations/getserverresourcesrequest.md @@ -8,4 +8,4 @@ | `IncludeHTTPS` | [*operations.IncludeHTTPS](../../models/operations/includehttps.md) | :heavy_minus_sign: | Include Https entries in the results | 1 | | `IncludeRelay` | [*operations.IncludeRelay](../../models/operations/includerelay.md) | :heavy_minus_sign: | Include Relay addresses in the results
E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
| 1 | | `IncludeIPv6` | [*operations.IncludeIPv6](../../models/operations/includeipv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | 1 | -| `ClientID` | **string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | \ No newline at end of file +| `ClientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | \ No newline at end of file diff --git a/docs/models/operations/gettokenbypinidglobals.md b/docs/models/operations/gettokenbypinidglobals.md deleted file mode 100644 index 5c51221..0000000 --- a/docs/models/operations/gettokenbypinidglobals.md +++ /dev/null @@ -1,12 +0,0 @@ -# GetTokenByPinIDGlobals - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `ClientID` | **string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | -| `ClientName` | **string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku | -| `DeviceNickname` | **string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 | -| `ClientVersion` | **string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 | -| `Platform` | **string* | :heavy_minus_sign: | The platform of the client application. | Roku | \ No newline at end of file diff --git a/docs/models/operations/gettokenbypinidrequest.md b/docs/models/operations/gettokenbypinidrequest.md index be6ad8d..d4ccbc7 100644 --- a/docs/models/operations/gettokenbypinidrequest.md +++ b/docs/models/operations/gettokenbypinidrequest.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | | `PinID` | *int64* | :heavy_check_mark: | The PinID to retrieve an access token for | | -| `ClientID` | **string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | +| `ClientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | | `ClientName` | **string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku | | `DeviceNickname` | **string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 | | `ClientVersion` | **string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 | diff --git a/docs/models/operations/gettopwatchedcontentqueryparamtype.md b/docs/models/operations/gettopwatchedcontentqueryparamtype.md index 2135501..e88fb4d 100644 --- a/docs/models/operations/gettopwatchedcontentqueryparamtype.md +++ b/docs/models/operations/gettopwatchedcontentqueryparamtype.md @@ -17,4 +17,6 @@ E.g. A movie library will not return anything with type 3 as there are no season | `GetTopWatchedContentQueryParamTypeTvShow` | 2 | | `GetTopWatchedContentQueryParamTypeSeason` | 3 | | `GetTopWatchedContentQueryParamTypeEpisode` | 4 | -| `GetTopWatchedContentQueryParamTypeAudio` | 8 | \ No newline at end of file +| `GetTopWatchedContentQueryParamTypeAudio` | 8 | +| `GetTopWatchedContentQueryParamTypeAlbum` | 9 | +| `GetTopWatchedContentQueryParamTypeTrack` | 10 | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindataglobals.md b/docs/models/operations/postuserssignindataglobals.md deleted file mode 100644 index fa80dd0..0000000 --- a/docs/models/operations/postuserssignindataglobals.md +++ /dev/null @@ -1,12 +0,0 @@ -# PostUsersSignInDataGlobals - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `ClientID` | **string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | -| `ClientName` | **string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku | -| `DeviceNickname` | **string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 | -| `ClientVersion` | **string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 | -| `Platform` | **string* | :heavy_minus_sign: | The platform of the client application. | Roku | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatarequest.md b/docs/models/operations/postuserssignindatarequest.md index 69054c8..5f330fb 100644 --- a/docs/models/operations/postuserssignindatarequest.md +++ b/docs/models/operations/postuserssignindatarequest.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -| `ClientID` | **string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | +| `ClientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | | `ClientName` | **string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku | | `DeviceNickname` | **string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 | | `ClientVersion` | **string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 | diff --git a/docs/models/operations/queryparamtype.md b/docs/models/operations/queryparamtype.md index c3552ed..cd4ef99 100644 --- a/docs/models/operations/queryparamtype.md +++ b/docs/models/operations/queryparamtype.md @@ -17,4 +17,6 @@ E.g. A movie library will not return anything with type 3 as there are no season | `QueryParamTypeTvShow` | 2 | | `QueryParamTypeSeason` | 3 | | `QueryParamTypeEpisode` | 4 | -| `QueryParamTypeAudio` | 8 | \ No newline at end of file +| `QueryParamTypeAudio` | 8 | +| `QueryParamTypeAlbum` | 9 | +| `QueryParamTypeTrack` | 10 | \ No newline at end of file diff --git a/docs/models/operations/showordering.md b/docs/models/operations/showordering.md index 7fec21f..99bcabd 100644 --- a/docs/models/operations/showordering.md +++ b/docs/models/operations/showordering.md @@ -1,20 +1,20 @@ # ShowOrdering -Setting that indicates the episode ordering for the show -None = Library default, -tmdbAiring = The Movie Database (Aired), -aired = TheTVDB (Aired), -dvd = TheTVDB (DVD), -absolute = TheTVDB (Absolute)). +Setting that indicates the episode ordering for the show +None = Library default, +tmdbAiring = The Movie Database (Aired), +tvdbAiring = TheTVDB (Aired), +tvdbDvd = TheTVDB (DVD), +tvdbAbsolute = TheTVDB (Absolute)). ## Values -| Name | Value | -| ------------------------ | ------------------------ | -| `ShowOrderingNone` | None | -| `ShowOrderingTmdbAiring` | tmdbAiring | -| `ShowOrderingAired` | aired | -| `ShowOrderingDvd` | dvd | -| `ShowOrderingAbsolute` | absolute | \ No newline at end of file +| Name | Value | +| -------------------------- | -------------------------- | +| `ShowOrderingNone` | None | +| `ShowOrderingTmdbAiring` | tmdbAiring | +| `ShowOrderingTvdbAiring` | tvdbAiring | +| `ShowOrderingTvdbDvd` | tvdbDvd | +| `ShowOrderingTvdbAbsolute` | tvdbAbsolute | \ No newline at end of file diff --git a/docs/models/operations/tag.md b/docs/models/operations/tag.md index b85428b..a945827 100644 --- a/docs/models/operations/tag.md +++ b/docs/models/operations/tag.md @@ -25,4 +25,5 @@ A key representing a specific tag within the section. | `TagRating` | rating | | `TagResolution` | resolution | | `TagFirstCharacter` | firstCharacter | -| `TagFolder` | folder | \ No newline at end of file +| `TagFolder` | folder | +| `TagAlbums` | albums | \ No newline at end of file diff --git a/docs/models/operations/type.md b/docs/models/operations/type.md index 6ad3314..3b57841 100644 --- a/docs/models/operations/type.md +++ b/docs/models/operations/type.md @@ -17,4 +17,6 @@ E.g. A movie library will not return anything with type 3 as there are no season | `TypeTvShow` | 2 | | `TypeSeason` | 3 | | `TypeEpisode` | 4 | -| `TypeAudio` | 8 | \ No newline at end of file +| `TypeAudio` | 8 | +| `TypeAlbum` | 9 | +| `TypeTrack` | 10 | \ No newline at end of file diff --git a/docs/sdks/activities/README.md b/docs/sdks/activities/README.md index 6db7536..cc57fd7 100644 --- a/docs/sdks/activities/README.md +++ b/docs/sdks/activities/README.md @@ -27,22 +27,18 @@ Get Server Activities package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Activities.GetServerActivities(ctx) if err != nil { log.Fatal(err) @@ -82,22 +78,18 @@ Cancel Server Activities package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Activities.CancelServerActivities(ctx, "25b71ed5-0f9d-461c-baa7-d404e9e10d3e") if err != nil { log.Fatal(err) diff --git a/docs/sdks/authentication/README.md b/docs/sdks/authentication/README.md index e12778d..2ebe8c8 100644 --- a/docs/sdks/authentication/README.md +++ b/docs/sdks/authentication/README.md @@ -24,23 +24,19 @@ This endpoint provides the caller with a temporary token with the same access le package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Authentication.GetTransientToken(ctx, operations.GetTransientTokenQueryParamTypeDelegation, operations.ScopeAll) if err != nil { log.Fatal(err) @@ -84,22 +80,18 @@ Note: requires Plex Media Server >= 1.15.4. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Authentication.GetSourceConnectionInformation(ctx, "provider://provider-identifier") if err != nil { log.Fatal(err) @@ -140,22 +132,18 @@ Get the User data from the provided X-Plex-Token package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Authentication.GetTokenDetails(ctx) if err != nil { log.Fatal(err) @@ -195,23 +183,23 @@ Sign in user with username and password and return user data with Plex authentic package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { - s := plexgo.New( - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - ctx := context.Background() + + s := plexgo.New() + res, err := s.Authentication.PostUsersSignInData(ctx, operations.PostUsersSignInDataRequest{ + ClientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + ClientName: plexgo.String("Plex for Roku"), + DeviceNickname: plexgo.String("Roku 3"), + ClientVersion: plexgo.String("2.4.1"), + Platform: plexgo.String("Roku"), RequestBody: &operations.PostUsersSignInDataRequestBody{ Login: "username@email.com", Password: "password123", diff --git a/docs/sdks/butler/README.md b/docs/sdks/butler/README.md index 28649c5..07ddf81 100644 --- a/docs/sdks/butler/README.md +++ b/docs/sdks/butler/README.md @@ -24,22 +24,18 @@ Returns a list of butler tasks package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Butler.GetButlerTasks(ctx) if err != nil { log.Fatal(err) @@ -84,22 +80,18 @@ This endpoint will attempt to start all Butler tasks that are enabled in the set package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Butler.StartAllTasks(ctx) if err != nil { log.Fatal(err) @@ -140,22 +132,18 @@ This endpoint will stop all currently running tasks and remove any scheduled tas package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Butler.StopAllTasks(ctx) if err != nil { log.Fatal(err) @@ -200,23 +188,19 @@ This endpoint will attempt to start a single Butler task that is enabled in the package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Butler.StartTask(ctx, operations.TaskNameCleanOldBundles) if err != nil { log.Fatal(err) @@ -258,23 +242,19 @@ This endpoint will stop a currently running task by name, or remove it from the package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Butler.StopTask(ctx, operations.PathParamTaskNameBackupDatabase) if err != nil { log.Fatal(err) diff --git a/docs/sdks/hubs/README.md b/docs/sdks/hubs/README.md index c3b94d6..4506eba 100644 --- a/docs/sdks/hubs/README.md +++ b/docs/sdks/hubs/README.md @@ -22,22 +22,18 @@ Get Global Hubs filtered by the parameters provided. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Hubs.GetGlobalHubs(ctx, nil, nil) if err != nil { log.Fatal(err) @@ -80,23 +76,19 @@ This endpoint will return the recently added content. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Hubs.GetRecentlyAdded(ctx, operations.GetRecentlyAddedRequest{ ContentDirectoryID: 470161, SectionID: plexgo.Int64(2), @@ -143,22 +135,18 @@ This endpoint will return a list of library specific hubs package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Hubs.GetLibraryHubs(ctx, 6728.76, nil, nil) if err != nil { log.Fatal(err) diff --git a/docs/sdks/library/README.md b/docs/sdks/library/README.md index a7a3d35..b407ed9 100644 --- a/docs/sdks/library/README.md +++ b/docs/sdks/library/README.md @@ -32,22 +32,18 @@ This resource returns hash values for local files package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetFileHash(ctx, "file://C:\Image.png&type=13", nil) if err != nil { log.Fatal(err) @@ -90,23 +86,19 @@ This endpoint will return the recently added content. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetRecentlyAddedLibrary(ctx, operations.GetRecentlyAddedLibraryRequest{ ContentDirectoryID: plexgo.Int64(2), PinnedContentDirectoryID: []int64{ @@ -174,22 +166,18 @@ This allows a client to provide a rich interface around the media (e.g. allow so package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetAllLibraries(ctx) if err != nil { log.Fatal(err) @@ -268,22 +256,18 @@ Each type in the library comes with a set of filters and sorts, aiding in buildi package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetLibraryDetails(ctx, 9518, nil) if err != nil { log.Fatal(err) @@ -325,22 +309,18 @@ Delete a library using a specific section id package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.DeleteLibrary(ctx, 9518) if err != nil { log.Fatal(err) @@ -393,6 +373,7 @@ Fetches details from a specific section of the library identified by a section k - `resolution`: Items categorized by resolution. - `firstCharacter`: Items categorized by the first letter. - `folder`: Items categorized by folder. +- `albums`: Items categorized by album. ### Example Usage @@ -401,23 +382,19 @@ Fetches details from a specific section of the library identified by a section k package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetLibraryItems(ctx, operations.GetLibraryItemsRequest{ Tag: operations.TagEdition, IncludeGuids: operations.IncludeGuidsEnable.ToPointer(), @@ -467,23 +444,19 @@ This endpoint Refreshes all the Metadata of the library. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetRefreshLibraryMetadata(ctx, 9518, operations.ForceOne.ToPointer()) if err != nil { log.Fatal(err) @@ -543,23 +516,19 @@ Each type in the library comes with a set of filters and sorts, aiding in buildi package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetSearchLibrary(ctx, 9518, operations.GetSearchLibraryQueryParamTypeTvShow) if err != nil { log.Fatal(err) @@ -602,25 +571,22 @@ Search the provided query across all library sections, or a single section, and package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetSearchAllLibraries(ctx, operations.GetSearchAllLibrariesRequest{ Query: "", + ClientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", SearchTypes: []operations.SearchTypes{ operations.SearchTypesPeople, }, @@ -667,22 +633,18 @@ This endpoint will return the metadata of a library item specified with the rati package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetMetaDataByRatingKey(ctx, 9518) if err != nil { log.Fatal(err) @@ -724,22 +686,18 @@ This endpoint will return the children of of a library item specified with the r package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetMetadataChildren(ctx, 1539.14, plexgo.String("Stream")) if err != nil { log.Fatal(err) @@ -782,23 +740,19 @@ This endpoint will return the top watched content from libraries of a certain ty package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetTopWatchedContent(ctx, operations.GetTopWatchedContentQueryParamTypeTvShow, plexgo.Int64(1)) if err != nil { log.Fatal(err) @@ -841,22 +795,18 @@ This endpoint will return the on deck content. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Library.GetOnDeck(ctx) if err != nil { log.Fatal(err) diff --git a/docs/sdks/log/README.md b/docs/sdks/log/README.md index 19cd3ac..8cfd160 100644 --- a/docs/sdks/log/README.md +++ b/docs/sdks/log/README.md @@ -23,23 +23,19 @@ This endpoint will write a single-line log message, including a level and source package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Log.LogLine(ctx, operations.LevelThree, "Test log message", "Postman") if err != nil { log.Fatal(err) @@ -103,22 +99,18 @@ Ensure each parameter is properly URL-encoded to avoid interpretation issues. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Log.LogMultiLine(ctx, "level=4&message=Test%20message%201&source=postman\n" + "level=3&message=Test%20message%202&source=postman\n" + "level=1&message=Test%20message%203&source=postman") @@ -162,22 +154,18 @@ This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Log.EnablePaperTrail(ctx) if err != nil { log.Fatal(err) diff --git a/docs/sdks/media/README.md b/docs/sdks/media/README.md index 9979b83..0029400 100644 --- a/docs/sdks/media/README.md +++ b/docs/sdks/media/README.md @@ -24,22 +24,18 @@ This will mark the provided media key as Played. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Media.MarkPlayed(ctx, 59398) if err != nil { log.Fatal(err) @@ -80,22 +76,18 @@ This will mark the provided media key as Unplayed. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Media.MarkUnplayed(ctx, 59398) if err != nil { log.Fatal(err) @@ -137,22 +129,18 @@ This API command can be used to update the play progress of a media item. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Media.UpdatePlayProgress(ctx, "", 90000, "played") if err != nil { log.Fatal(err) @@ -195,23 +183,19 @@ Gets the banner image of the media item package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Media.GetBannerImage(ctx, operations.GetBannerImageRequest{ RatingKey: 9518, Width: 396, @@ -259,23 +243,19 @@ Gets the thumbnail image of the media item package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Media.GetThumbImage(ctx, operations.GetThumbImageRequest{ RatingKey: 9518, Width: 396, diff --git a/docs/sdks/playlists/README.md b/docs/sdks/playlists/README.md index 070b3b9..d0c22fd 100644 --- a/docs/sdks/playlists/README.md +++ b/docs/sdks/playlists/README.md @@ -34,23 +34,19 @@ Create a new playlist. By default the playlist is blank. To create a playlist al package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Playlists.CreatePlaylist(ctx, operations.CreatePlaylistRequest{ Title: "", Type: operations.CreatePlaylistQueryParamTypePhoto, @@ -96,22 +92,18 @@ Get All Playlists given the specified filters. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Playlists.GetPlaylists(ctx, nil, nil) if err != nil { log.Fatal(err) @@ -155,22 +147,18 @@ Smart playlist details contain the `content` attribute. This is the content URI package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Playlists.GetPlaylist(ctx, 4109.48) if err != nil { log.Fatal(err) @@ -212,22 +200,18 @@ This endpoint will delete a playlist package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Playlists.DeletePlaylist(ctx, 216.22) if err != nil { log.Fatal(err) @@ -269,22 +253,18 @@ From PMS version 1.9.1 clients can also edit playlist metadata using this endpoi package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Playlists.UpdatePlaylist(ctx, 3915, nil, nil) if err != nil { log.Fatal(err) @@ -331,23 +311,19 @@ Note that for dumb playlists, items have a `playlistItemID` attribute which is u package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Playlists.GetPlaylistContents(ctx, 5004.46, operations.GetPlaylistContentsQueryParamTypeTvShow) if err != nil { log.Fatal(err) @@ -390,22 +366,18 @@ Clears a playlist, only works with dumb playlists. Returns the playlist. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Playlists.ClearPlaylistContents(ctx, 1893.18) if err != nil { log.Fatal(err) @@ -448,22 +420,18 @@ With a smart playlist, passing a new `uri` parameter replaces the rules for the package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Playlists.AddPlaylistContents(ctx, 8502.01, "server://12345/com.plexapp.plugins.library/library/metadata/1", plexgo.Float64(123)) if err != nil { log.Fatal(err) @@ -507,23 +475,19 @@ Imports m3u playlists by passing a path on the server to scan for m3u-formatted package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Playlists.UploadPlaylist(ctx, "/home/barkley/playlist.m3u", operations.QueryParamForceZero, 1) if err != nil { log.Fatal(err) diff --git a/docs/sdks/plex/README.md b/docs/sdks/plex/README.md index 039f6bf..e0a9c20 100644 --- a/docs/sdks/plex/README.md +++ b/docs/sdks/plex/README.md @@ -26,22 +26,18 @@ Get Companions Data package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Plex.GetCompanionsData(ctx) if err != nil { log.Fatal(err) @@ -81,22 +77,18 @@ Get friends of provided auth token. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Plex.GetUserFriends(ctx) if err != nil { log.Fatal(err) @@ -136,21 +128,16 @@ Returns the geolocation and locale data of the caller package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { - s := plexgo.New( - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - ctx := context.Background() + + s := plexgo.New() + res, err := s.Plex.GetGeoData(ctx) if err != nil { log.Fatal(err) @@ -190,22 +177,18 @@ Retrieves the home data for the authenticated user, including details like home package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Plex.GetHomeData(ctx) if err != nil { log.Fatal(err) @@ -245,24 +228,20 @@ Get Plex server access tokens and server connections package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() - res, err := s.Plex.GetServerResources(ctx, operations.IncludeHTTPSEnable.ToPointer(), operations.IncludeRelayEnable.ToPointer(), operations.IncludeIPv6Enable.ToPointer(), plexgo.String("3381b62b-9ab7-4e37-827b-203e9809eb58")) + res, err := s.Plex.GetServerResources(ctx, "3381b62b-9ab7-4e37-827b-203e9809eb58", operations.IncludeHTTPSEnable.ToPointer(), operations.IncludeRelayEnable.ToPointer(), operations.IncludeIPv6Enable.ToPointer()) if err != nil { log.Fatal(err) } @@ -277,10 +256,10 @@ func main() { | Parameter | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `clientID` | *string* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | | `includeHTTPS` | [*operations.IncludeHTTPS](../../models/operations/includehttps.md) | :heavy_minus_sign: | Include Https entries in the results | 1 | | `includeRelay` | [*operations.IncludeRelay](../../models/operations/includerelay.md) | :heavy_minus_sign: | Include Relay addresses in the results
E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
| 1 | | `includeIPv6` | [*operations.IncludeIPv6](../../models/operations/includeipv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | 1 | -| `clientID` | **string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response @@ -305,23 +284,24 @@ Retrieve a Pin ID from Plex.tv to use for authentication flows package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { - s := plexgo.New( - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - ctx := context.Background() - res, err := s.Plex.GetPin(ctx, operations.GetPinRequest{}) + + s := plexgo.New() + + res, err := s.Plex.GetPin(ctx, operations.GetPinRequest{ + ClientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + ClientName: plexgo.String("Plex for Roku"), + DeviceNickname: plexgo.String("Roku 3"), + ClientVersion: plexgo.String("2.4.1"), + Platform: plexgo.String("Roku"), + }) if err != nil { log.Fatal(err) } @@ -360,24 +340,24 @@ Retrieve an Access Token from Plex.tv after the Pin has been authenticated package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { - s := plexgo.New( - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - ctx := context.Background() + + s := plexgo.New() + res, err := s.Plex.GetTokenByPinID(ctx, operations.GetTokenByPinIDRequest{ PinID: 408895, + ClientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + ClientName: plexgo.String("Plex for Roku"), + DeviceNickname: plexgo.String("Roku 3"), + ClientVersion: plexgo.String("2.4.1"), + Platform: plexgo.String("Roku"), }) if err != nil { log.Fatal(err) diff --git a/docs/sdks/plexapi/README.md b/docs/sdks/plexapi/README.md index e91fa37..1e395e4 100644 --- a/docs/sdks/plexapi/README.md +++ b/docs/sdks/plexapi/README.md @@ -26,3 +26,6 @@ The following SDKs are generated from the OpenAPI Specification. They are automa | PHP | [GitHub](https://github.com/LukeHagar/plexphp) | [Releases](https://github.com/LukeHagar/plexphp/releases) | - | | Java | [GitHub](https://github.com/LukeHagar/plexjava) | [Releases](https://github.com/LukeHagar/plexjava/releases) | - | | C# | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases) | - + + +### Available Operations diff --git a/docs/sdks/search/README.md b/docs/sdks/search/README.md index 33fd6b2..1aea0d6 100644 --- a/docs/sdks/search/README.md +++ b/docs/sdks/search/README.md @@ -34,22 +34,18 @@ This request is intended to be very fast, and called as the user types. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Search.PerformSearch(ctx, "dylan", nil, plexgo.Float64(5)) if err != nil { log.Fatal(err) @@ -96,22 +92,18 @@ Results, as well as their containing per-type hubs, contain a `distance` attribu package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Search.PerformVoiceSearch(ctx, "dead+poop", nil, plexgo.Float64(5)) if err != nil { log.Fatal(err) @@ -154,22 +146,18 @@ This will search the database for the string provided. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Search.GetSearchResults(ctx, "110") if err != nil { log.Fatal(err) diff --git a/docs/sdks/server/README.md b/docs/sdks/server/README.md index 87ec497..29e0777 100644 --- a/docs/sdks/server/README.md +++ b/docs/sdks/server/README.md @@ -28,22 +28,18 @@ Get Server Capabilities package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetServerCapabilities(ctx) if err != nil { log.Fatal(err) @@ -83,22 +79,18 @@ Get Server Preferences package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetServerPreferences(ctx) if err != nil { log.Fatal(err) @@ -138,22 +130,18 @@ Get Available Clients package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetAvailableClients(ctx) if err != nil { log.Fatal(err) @@ -193,22 +181,18 @@ Get Devices package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetDevices(ctx) if err != nil { log.Fatal(err) @@ -248,21 +232,16 @@ This request is useful to determine if the server is online or offline package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { - s := plexgo.New( - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), - ) - ctx := context.Background() + + s := plexgo.New() + res, err := s.Server.GetServerIdentity(ctx) if err != nil { log.Fatal(err) @@ -301,22 +280,18 @@ Returns MyPlex Account Information package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetMyPlexAccount(ctx) if err != nil { log.Fatal(err) @@ -357,30 +332,26 @@ Plex's Photo transcoder is used throughout the service to serve images at specif package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetResizedPhoto(ctx, operations.GetResizedPhotoRequest{ Width: 110, Height: 165, Opacity: 100, Blur: 0, MinSize: operations.MinSizeOne, - Upscale: operations.UpscaleOne, + Upscale: operations.UpscaleZero, URL: "/library/metadata/49564/thumb/1654258204", }) if err != nil { @@ -422,22 +393,18 @@ Retrieves media providers and their features from the Plex server. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetMediaProviders(ctx, "CV5xoxjTpFKUzBTShsaf") if err != nil { log.Fatal(err) @@ -478,22 +445,18 @@ Get Server List package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Server.GetServerList(ctx) if err != nil { log.Fatal(err) diff --git a/docs/sdks/sessions/README.md b/docs/sdks/sessions/README.md index 76b6e7e..6be32de 100644 --- a/docs/sdks/sessions/README.md +++ b/docs/sdks/sessions/README.md @@ -23,22 +23,18 @@ This will retrieve the "Now Playing" Information of the PMS. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Sessions.GetSessions(ctx) if err != nil { log.Fatal(err) @@ -78,23 +74,19 @@ This will Retrieve a listing of all history views. package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Sessions.GetSessionHistory(ctx, plexgo.String("viewedAt:desc"), plexgo.Int64(1), &operations.QueryParamFilter{}, plexgo.Int64(12)) if err != nil { log.Fatal(err) @@ -138,22 +130,18 @@ Get Transcode Sessions package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Sessions.GetTranscodeSessions(ctx) if err != nil { log.Fatal(err) @@ -193,22 +181,18 @@ Stop a Transcode Session package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Sessions.StopTranscodeSession(ctx, "zz7llzqlx8w9vnrsbnwhbmep") if err != nil { log.Fatal(err) diff --git a/docs/sdks/statistics/README.md b/docs/sdks/statistics/README.md index 9c0b5c2..adc52e9 100644 --- a/docs/sdks/statistics/README.md +++ b/docs/sdks/statistics/README.md @@ -22,22 +22,18 @@ This will return the media statistics for the server package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Statistics.GetStatistics(ctx, plexgo.Int64(4)) if err != nil { log.Fatal(err) @@ -78,22 +74,18 @@ This will return the resources for the server package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Statistics.GetResourcesStatistics(ctx, plexgo.Int64(4)) if err != nil { log.Fatal(err) @@ -134,22 +126,18 @@ This will return the bandwidth statistics for the server package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Statistics.GetBandwidthStatistics(ctx, plexgo.Int64(4)) if err != nil { log.Fatal(err) diff --git a/docs/sdks/updater/README.md b/docs/sdks/updater/README.md index f650da0..2f59bf9 100644 --- a/docs/sdks/updater/README.md +++ b/docs/sdks/updater/README.md @@ -23,22 +23,18 @@ Querying status of updates package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Updater.GetUpdateStatus(ctx) if err != nil { log.Fatal(err) @@ -78,23 +74,19 @@ Checking for updates package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Updater.CheckForUpdates(ctx, operations.DownloadOne.ToPointer()) if err != nil { log.Fatal(err) @@ -136,23 +128,19 @@ Note that these two parameters are effectively mutually exclusive. The `tonight` package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Updater.ApplyUpdates(ctx, operations.TonightOne.ToPointer(), operations.SkipOne.ToPointer()) if err != nil { log.Fatal(err) diff --git a/docs/sdks/video/README.md b/docs/sdks/video/README.md index a5d8bb9..f7a4fa5 100644 --- a/docs/sdks/video/README.md +++ b/docs/sdks/video/README.md @@ -21,23 +21,19 @@ Get the timeline for a media item package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Video.GetTimeline(ctx, operations.GetTimelineRequest{ RatingKey: 23409, Key: "/library/metadata/23409", @@ -89,23 +85,19 @@ Begin a Universal Transcode Session package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Video.StartUniversalTranscode(ctx, operations.StartUniversalTranscodeRequest{ HasMDE: 1, Path: "/library/metadata/23409", diff --git a/docs/sdks/watchlist/README.md b/docs/sdks/watchlist/README.md index 618911a..8bf63e1 100644 --- a/docs/sdks/watchlist/README.md +++ b/docs/sdks/watchlist/README.md @@ -20,23 +20,19 @@ Get User Watchlist package main import( - "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { + ctx := context.Background() + s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithClientID("3381b62b-9ab7-4e37-827b-203e9809eb58"), - plexgo.WithClientName("Plex for Roku"), - plexgo.WithClientVersion("2.4.1"), - plexgo.WithPlatform("Roku"), - plexgo.WithDeviceNickname("Roku 3"), ) - ctx := context.Background() res, err := s.Watchlist.GetWatchList(ctx, operations.GetWatchListRequest{ Filter: operations.FilterAvailable, XPlexContainerStart: plexgo.Int(0), diff --git a/go.mod b/go.mod index 3478755..476d95a 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,4 @@ module github.com/LukeHagar/plexgo go 1.20 -require ( - github.com/cenkalti/backoff/v4 v4.2.0 - github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 -) +require github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 diff --git a/go.sum b/go.sum index f955779..c5a75f1 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,2 @@ -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 h1:S92OBrGuLLZsyM5ybUzgc/mPjIYk2AZqufieooe98uw= github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05/go.mod h1:M9R1FoZ3y//hwwnJtO51ypFGwm8ZfpxPT/ZLtO1mcgQ= diff --git a/hubs.go b/hubs.go index 3968963..d1afaff 100644 --- a/hubs.go +++ b/hubs.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -53,7 +53,12 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/hubs") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -85,6 +90,10 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -115,7 +124,11 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -284,7 +297,12 @@ func (s *Hubs) GetRecentlyAdded(ctx context.Context, request operations.GetRecen } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/hubs/home/recentlyAdded") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -316,6 +334,10 @@ func (s *Hubs) GetRecentlyAdded(ctx context.Context, request operations.GetRecen return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -346,7 +368,11 @@ func (s *Hubs) GetRecentlyAdded(ctx context.Context, request operations.GetRecen req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -481,7 +507,12 @@ func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *flo } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/hubs/sections/{sectionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -513,6 +544,10 @@ func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *flo return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -543,7 +578,11 @@ func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *flo req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/internal/globals/globals.go b/internal/globals/globals.go deleted file mode 100644 index a60ff28..0000000 --- a/internal/globals/globals.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - -package globals - -type Globals struct { - // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) - ClientID *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` - // The name of the client application. (Plex Web, Plex Media Server, etc.) - ClientName *string `header:"style=simple,explode=false,name=X-Plex-Product"` - // The version of the client application. - ClientVersion *string `header:"style=simple,explode=false,name=X-Plex-Version"` - // The platform of the client application. - Platform *string `header:"style=simple,explode=false,name=X-Plex-Platform"` - // A relatively friendly name for the client device - DeviceNickname *string `header:"style=simple,explode=false,name=X-Plex-Device"` -} - -func (o *Globals) GetClientID() *string { - if o == nil { - return nil - } - return o.ClientID -} - -func (o *Globals) GetClientName() *string { - if o == nil { - return nil - } - return o.ClientName -} - -func (o *Globals) GetClientVersion() *string { - if o == nil { - return nil - } - return o.ClientVersion -} - -func (o *Globals) GetPlatform() *string { - if o == nil { - return nil - } - return o.Platform -} - -func (o *Globals) GetDeviceNickname() *string { - if o == nil { - return nil - } - return o.DeviceNickname -} diff --git a/internal/utils/env.go b/internal/utils/env.go new file mode 100644 index 0000000..110d464 --- /dev/null +++ b/internal/utils/env.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package utils + +import ( + "os" +) + +// GetEnv returns the value of the environment variable named by the key or the defaultValue if the environment variable is not set. +func GetEnv(name, defaultValue string) string { + value := os.Getenv(name) + if value == "" { + return defaultValue + } + return value +} diff --git a/internal/utils/queryparams.go b/internal/utils/queryparams.go index 6623e7a..369d98d 100644 --- a/internal/utils/queryparams.go +++ b/internal/utils/queryparams.go @@ -214,7 +214,11 @@ func populateDeepObjectParamsStruct(qsValues url.Values, priorScope string, stru continue } - scope := priorScope + "[" + qpTag.ParamName + "]" + scope := priorScope + + if !qpTag.Inline { + scope = priorScope + "[" + qpTag.ParamName + "]" + } switch fieldValue.Kind() { case reflect.Array, reflect.Slice: @@ -252,6 +256,13 @@ type paramTag struct { Explode bool ParamName string Serialization string + + // Inline is a special case for union/oneOf. When a wrapper struct type is + // used, each union/oneOf value field should be inlined (e.g. not appended + // in deepObject style with the name) as if the value was directly on the + // parent struct field. Without this annotation, the value would not be + // encoded by downstream logic that requires the struct field tag. + Inline bool } func parseQueryParamTag(field reflect.StructField) *paramTag { diff --git a/internal/utils/requestbody.go b/internal/utils/requestbody.go index 000226e..78479c6 100644 --- a/internal/utils/requestbody.go +++ b/internal/utils/requestbody.go @@ -166,7 +166,7 @@ func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { tag := parseMultipartFormTag(field) if tag.File { - if err := encodeMultipartFormDataFile(writer, fieldType, valType); err != nil { + if err := encodeMultipartFormDataFile(writer, tag.Name, fieldType, valType); err != nil { writer.Close() return "", err } @@ -211,12 +211,11 @@ func encodeMultipartFormData(w io.Writer, data interface{}) (string, error) { return writer.FormDataContentType(), nil } -func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, valType reflect.Value) error { +func encodeMultipartFormDataFile(w *multipart.Writer, fieldName string, fieldType reflect.Type, valType reflect.Value) error { if fieldType.Kind() != reflect.Struct { return fmt.Errorf("invalid type %s for multipart/form-data file", valType.Type()) } - var fieldName string var fileName string var reader io.Reader @@ -236,12 +235,11 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va reader = val.Interface().(io.Reader) } } else { - fieldName = tag.Name fileName = val.String() } } - if fieldName == "" || fileName == "" || reader == nil { + if fileName == "" || reader == nil { return fmt.Errorf("invalid multipart/form-data file") } diff --git a/internal/utils/retries.go b/internal/utils/retries.go index d429b45..c045f1e 100644 --- a/internal/utils/retries.go +++ b/internal/utils/retries.go @@ -7,7 +7,8 @@ import ( "errors" "fmt" "github.com/LukeHagar/plexgo/retry" - "github.com/cenkalti/backoff/v4" + "math" + "math/rand" "net/http" "net/url" "strconv" @@ -15,8 +16,6 @@ import ( "time" ) -var errRequestFailed = errors.New("request failed") - // Deprecated: Use retry.BackoffStrategy instead. type BackoffStrategy = retry.BackoffStrategy @@ -28,34 +27,27 @@ type Retries struct { StatusCodes []string } -func Retry(ctx context.Context, r Retries, action func() (*http.Response, error)) (*http.Response, error) { +func Retry(ctx context.Context, r Retries, operation func() (*http.Response, error)) (*http.Response, error) { switch r.Config.Strategy { case "backoff": if r.Config.Backoff == nil { - return action() + return operation() } - config := backoff.NewExponentialBackOff() - config.InitialInterval = time.Duration(r.Config.Backoff.InitialInterval) * time.Millisecond - config.MaxInterval = time.Duration(r.Config.Backoff.MaxInterval) * time.Millisecond - config.Multiplier = r.Config.Backoff.Exponent - config.MaxElapsedTime = time.Duration(r.Config.Backoff.MaxElapsedTime) * time.Millisecond - config.Reset() - var resp *http.Response - err := backoff.Retry(func() error { + err := retryWithBackoff(ctx, r.Config.Backoff, func() error { if resp != nil { resp.Body.Close() } select { case <-ctx.Done(): - return backoff.Permanent(ctx.Err()) + return retry.Permanent(ctx.Err()) default: } - res, err := action() + res, err := operation() if err != nil { urlError := new(url.Error) if errors.As(err, &urlError) { @@ -64,7 +56,7 @@ func Retry(ctx context.Context, r Retries, action func() (*http.Response, error) } } - return backoff.Permanent(err) + return retry.Permanent(err) } resp = res if res == nil { @@ -81,7 +73,7 @@ func Retry(ctx context.Context, r Retries, action func() (*http.Response, error) s := res.StatusCode / 100 if s >= codeRange && s < codeRange+1 { - return errRequestFailed + return retry.TemporaryFromResponse("request failed", res) } } else { parsedCode, err := strconv.Atoi(code) @@ -90,7 +82,7 @@ func Retry(ctx context.Context, r Retries, action func() (*http.Response, error) } if res.StatusCode == parsedCode { - return errRequestFailed + return retry.TemporaryFromResponse("request failed", res) } } } @@ -98,13 +90,131 @@ func Retry(ctx context.Context, r Retries, action func() (*http.Response, error) resp = res return nil - }, config) - if err != nil && !errors.Is(err, errRequestFailed) { + }) + + var tempErr *retry.TemporaryError + if err != nil && !errors.As(err, &tempErr) { return nil, err } return resp, nil default: - return action() + return operation() } } + +func retryWithBackoff(ctx context.Context, s *retry.BackoffStrategy, operation func() error) error { + var ( + err error + next time.Duration + attempt int + start = time.Now() + maxElapsedTime = time.Duration(s.MaxElapsedTime) * time.Millisecond + ) + + timer := &defaultTimer{} + defer func() { + timer.Stop() + }() + + for { + err = operation() + if err == nil { + return nil + } + + var permanent *retry.PermanentError + if errors.As(err, &permanent) { + return permanent.Unwrap() + } + + if time.Since(start) >= maxElapsedTime { + return err + } + + var temporary *retry.TemporaryError + if errors.As(err, &temporary) { + next = temporary.RetryAfter() + } + + if next <= 0 { + next = nextInterval(s, attempt) + } + + timer.Start(next) + + select { + case <-ctx.Done(): + return ctx.Err() + case <-timer.C(): + } + + attempt += 1 + } +} + +type Timer interface { + Start(duration time.Duration) + Stop() + C() <-chan time.Time +} + +// defaultTimer implements Timer interface using time.Timer +type defaultTimer struct { + timer *time.Timer +} + +// C returns the timers channel which receives the current time when the timer fires. +func (t *defaultTimer) C() <-chan time.Time { + return t.timer.C +} + +// Start starts the timer to fire after the given duration +func (t *defaultTimer) Start(duration time.Duration) { + if t.timer == nil { + t.timer = time.NewTimer(duration) + return + } + + if !t.timer.Stop() { + select { + case <-t.timer.C: + default: + } + } + + t.timer.Reset(duration) +} + +// Stop is called when the timer is not used anymore and resources may be freed. +func (t *defaultTimer) Stop() { + if t.timer != nil { + t.timer.Stop() + } +} + +func nextInterval(s *retry.BackoffStrategy, attempt int) time.Duration { + initialInterval := float64(time.Duration(s.InitialInterval) * time.Millisecond) + maxInterval := float64(time.Duration(s.MaxInterval) * time.Millisecond) + exponent := s.Exponent + jitterFactor := float64(0.25) + + interval := initialInterval * math.Pow(float64(attempt+1), exponent) + + jitter := rand.Float64() * jitterFactor * interval + if rand.Float64() < 0.5 { + jitter = -1 * jitter + } + + interval = interval + jitter + + if interval <= 0 { + interval = initialInterval + } + + if interval > maxInterval { + interval = maxInterval + } + + return time.Duration(interval) +} diff --git a/internal/utils/utils.go b/internal/utils/utils.go index f1ff9e0..031a71a 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -127,6 +127,7 @@ func parseStructTag(tagKey string, field reflect.StructField) map[string]string func parseParamTag(tagKey string, field reflect.StructField, defaultStyle string, defaultExplode bool) *paramTag { // example `{tagKey}:"style=simple,explode=false,name=apiID"` + // example `{tagKey}:"inline"` values := parseStructTag(tagKey, field) if values == nil { return nil @@ -140,6 +141,8 @@ func parseParamTag(tagKey string, field reflect.StructField, defaultStyle string for k, v := range values { switch k { + case "inline": + tag.Inline = v == "true" case "style": tag.Style = v case "explode": diff --git a/library.go b/library.go index c9c634c..5b92a29 100644 --- a/library.go +++ b/library.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -53,7 +53,12 @@ func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64, } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/library/hashes") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -85,6 +90,10 @@ func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64, return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -115,7 +124,11 @@ func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64, req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -264,7 +277,12 @@ func (s *Library) GetRecentlyAddedLibrary(ctx context.Context, request operation } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/library/recentlyAdded") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -296,6 +314,10 @@ func (s *Library) GetRecentlyAddedLibrary(ctx context.Context, request operation return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -326,7 +348,11 @@ func (s *Library) GetRecentlyAddedLibrary(ctx context.Context, request operation req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -500,7 +526,12 @@ func (s *Library) GetAllLibraries(ctx context.Context, opts ...operations.Option } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/library/sections") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -528,6 +559,10 @@ func (s *Library) GetAllLibraries(ctx context.Context, opts ...operations.Option return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -558,7 +593,11 @@ func (s *Library) GetAllLibraries(ctx context.Context, opts ...operations.Option req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -770,7 +809,12 @@ func (s *Library) GetLibraryDetails(ctx context.Context, sectionKey int, include } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -802,6 +846,10 @@ func (s *Library) GetLibraryDetails(ctx context.Context, sectionKey int, include return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -832,7 +880,11 @@ func (s *Library) GetLibraryDetails(ctx context.Context, sectionKey int, include req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1005,7 +1057,12 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionKey int, opts ...ope } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1033,6 +1090,10 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionKey int, opts ...ope return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1063,7 +1124,11 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionKey int, opts ...ope req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1211,6 +1276,7 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionKey int, opts ...ope // - `resolution`: Items categorized by resolution. // - `firstCharacter`: Items categorized by the first letter. // - `folder`: Items categorized by folder. +// - `albums`: Items categorized by album. func (s *Library) GetLibraryItems(ctx context.Context, request operations.GetLibraryItemsRequest, opts ...operations.Option) (*operations.GetLibraryItemsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, @@ -1231,7 +1297,12 @@ func (s *Library) GetLibraryItems(ctx context.Context, request operations.GetLib } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}/{tag}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1263,6 +1334,10 @@ func (s *Library) GetLibraryItems(ctx context.Context, request operations.GetLib return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1293,7 +1368,11 @@ func (s *Library) GetLibraryItems(ctx context.Context, request operations.GetLib req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1467,7 +1546,12 @@ func (s *Library) GetRefreshLibraryMetadata(ctx context.Context, sectionKey int, } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}/refresh", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1499,6 +1583,10 @@ func (s *Library) GetRefreshLibraryMetadata(ctx context.Context, sectionKey int, return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1529,7 +1617,11 @@ func (s *Library) GetRefreshLibraryMetadata(ctx context.Context, sectionKey int, req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1700,7 +1792,12 @@ func (s *Library) GetSearchLibrary(ctx context.Context, sectionKey int, type_ op } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}/search", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1732,6 +1829,10 @@ func (s *Library) GetSearchLibrary(ctx context.Context, sectionKey int, type_ op return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1762,7 +1863,11 @@ func (s *Library) GetSearchLibrary(ctx context.Context, sectionKey int, type_ op req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1919,10 +2024,6 @@ func (s *Library) GetSearchAllLibraries(ctx context.Context, request operations. SecuritySource: s.sdkConfiguration.Security, } - globals := operations.GetSearchAllLibrariesGlobals{ - ClientID: s.sdkConfiguration.Globals.ClientID, - } - o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -1935,7 +2036,12 @@ func (s *Library) GetSearchAllLibraries(ctx context.Context, request operations. } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/library/search") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1959,9 +2065,9 @@ func (s *Library) GetSearchAllLibraries(ctx context.Context, request operations. req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - utils.PopulateHeaders(ctx, req, request, globals) + utils.PopulateHeaders(ctx, req, request, nil) - if err := utils.PopulateQueryParams(ctx, req, request, globals); err != nil { + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } @@ -1969,6 +2075,10 @@ func (s *Library) GetSearchAllLibraries(ctx context.Context, request operations. return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1999,7 +2109,11 @@ func (s *Library) GetSearchAllLibraries(ctx context.Context, request operations. req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -2172,7 +2286,12 @@ func (s *Library) GetMetaDataByRatingKey(ctx context.Context, ratingKey int64, o } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/library/metadata/{ratingKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -2200,6 +2319,10 @@ func (s *Library) GetMetaDataByRatingKey(ctx context.Context, ratingKey int64, o return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -2230,7 +2353,11 @@ func (s *Library) GetMetaDataByRatingKey(ctx context.Context, ratingKey int64, o req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -2404,7 +2531,12 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, in } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/library/metadata/{ratingKey}/children", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -2436,6 +2568,10 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, in return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -2466,7 +2602,11 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, in req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -2640,7 +2780,12 @@ func (s *Library) GetTopWatchedContent(ctx context.Context, type_ operations.Get } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/library/all/top") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -2672,6 +2817,10 @@ func (s *Library) GetTopWatchedContent(ctx context.Context, type_ operations.Get return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -2702,7 +2851,11 @@ func (s *Library) GetTopWatchedContent(ctx context.Context, type_ operations.Get req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -2871,7 +3024,12 @@ func (s *Library) GetOnDeck(ctx context.Context, opts ...operations.Option) (*op } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/library/onDeck") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -2899,6 +3057,10 @@ func (s *Library) GetOnDeck(ctx context.Context, opts ...operations.Option) (*op return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -2929,7 +3091,11 @@ func (s *Library) GetOnDeck(ctx context.Context, opts ...operations.Option) (*op req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/log.go b/log.go index f93820c..8228c49 100644 --- a/log.go +++ b/log.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -54,7 +54,12 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/log") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -86,6 +91,10 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -116,7 +125,11 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -285,7 +298,12 @@ func (s *Log) LogMultiLine(ctx context.Context, request string, opts ...operatio } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/log") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -319,6 +337,10 @@ func (s *Log) LogMultiLine(ctx context.Context, request string, opts ...operatio return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -349,7 +371,11 @@ func (s *Log) LogMultiLine(ctx context.Context, request string, opts ...operatio req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -498,7 +524,12 @@ func (s *Log) EnablePaperTrail(ctx context.Context, opts ...operations.Option) ( } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/log/networked") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -526,6 +557,10 @@ func (s *Log) EnablePaperTrail(ctx context.Context, opts ...operations.Option) ( return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -556,7 +591,11 @@ func (s *Log) EnablePaperTrail(ctx context.Context, opts ...operations.Option) ( req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/media.go b/media.go index 8235589..9f0bb64 100644 --- a/media.go +++ b/media.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -52,7 +52,12 @@ func (s *Media) MarkPlayed(ctx context.Context, key float64, opts ...operations. } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/:/scrobble") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -84,6 +89,10 @@ func (s *Media) MarkPlayed(ctx context.Context, key float64, opts ...operations. return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -114,7 +123,11 @@ func (s *Media) MarkPlayed(ctx context.Context, key float64, opts ...operations. req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -267,7 +280,12 @@ func (s *Media) MarkUnplayed(ctx context.Context, key float64, opts ...operation } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/:/unscrobble") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -299,6 +317,10 @@ func (s *Media) MarkUnplayed(ctx context.Context, key float64, opts ...operation return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -329,7 +351,11 @@ func (s *Media) MarkUnplayed(ctx context.Context, key float64, opts ...operation req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -484,7 +510,12 @@ func (s *Media) UpdatePlayProgress(ctx context.Context, key string, time float64 } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/:/progress") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -516,6 +547,10 @@ func (s *Media) UpdatePlayProgress(ctx context.Context, key string, time float64 return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -546,7 +581,11 @@ func (s *Media) UpdatePlayProgress(ctx context.Context, key string, time float64 req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -695,7 +734,12 @@ func (s *Media) GetBannerImage(ctx context.Context, request operations.GetBanner } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/library/metadata/{ratingKey}/banner", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -729,6 +773,10 @@ func (s *Media) GetBannerImage(ctx context.Context, request operations.GetBanner return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -759,7 +807,11 @@ func (s *Media) GetBannerImage(ctx context.Context, request operations.GetBanner req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -922,7 +974,12 @@ func (s *Media) GetThumbImage(ctx context.Context, request operations.GetThumbIm } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/library/metadata/{ratingKey}/thumb", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -956,6 +1013,10 @@ func (s *Media) GetThumbImage(ctx context.Context, request operations.GetThumbIm return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -986,7 +1047,11 @@ func (s *Media) GetThumbImage(ctx context.Context, request operations.GetThumbIm req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/models/operations/getlibraryitems.go b/models/operations/getlibraryitems.go index 2a7ae5b..68bba52 100644 --- a/models/operations/getlibraryitems.go +++ b/models/operations/getlibraryitems.go @@ -33,6 +33,7 @@ const ( TagResolution Tag = "resolution" TagFirstCharacter Tag = "firstCharacter" TagFolder Tag = "folder" + TagAlbums Tag = "albums" ) func (e Tag) ToPointer() *Tag { @@ -81,6 +82,8 @@ func (e *Tag) UnmarshalJSON(data []byte) error { case "firstCharacter": fallthrough case "folder": + fallthrough + case "albums": *e = Tag(v) return nil default: @@ -129,6 +132,8 @@ const ( GetLibraryItemsQueryParamTypeSeason GetLibraryItemsQueryParamType = 3 GetLibraryItemsQueryParamTypeEpisode GetLibraryItemsQueryParamType = 4 GetLibraryItemsQueryParamTypeAudio GetLibraryItemsQueryParamType = 8 + GetLibraryItemsQueryParamTypeAlbum GetLibraryItemsQueryParamType = 9 + GetLibraryItemsQueryParamTypeTrack GetLibraryItemsQueryParamType = 10 ) func (e GetLibraryItemsQueryParamType) ToPointer() *GetLibraryItemsQueryParamType { @@ -149,6 +154,10 @@ func (e *GetLibraryItemsQueryParamType) UnmarshalJSON(data []byte) error { case 4: fallthrough case 8: + fallthrough + case 9: + fallthrough + case 10: *e = GetLibraryItemsQueryParamType(v) return nil default: @@ -649,17 +658,17 @@ func (e *GetLibraryItemsFlattenSeasons) UnmarshalJSON(data []byte) error { // GetLibraryItemsShowOrdering - Setting that indicates the episode ordering for the show // None = Library default, // tmdbAiring = The Movie Database (Aired), -// aired = TheTVDB (Aired), -// dvd = TheTVDB (DVD), -// absolute = TheTVDB (Absolute)). +// tvdbAiring = TheTVDB (Aired), +// tvdbDvd = TheTVDB (DVD), +// tvdbAbsolute = TheTVDB (Absolute)). type GetLibraryItemsShowOrdering string const ( - GetLibraryItemsShowOrderingNone GetLibraryItemsShowOrdering = "None" - GetLibraryItemsShowOrderingTmdbAiring GetLibraryItemsShowOrdering = "tmdbAiring" - GetLibraryItemsShowOrderingAired GetLibraryItemsShowOrdering = "aired" - GetLibraryItemsShowOrderingDvd GetLibraryItemsShowOrdering = "dvd" - GetLibraryItemsShowOrderingAbsolute GetLibraryItemsShowOrdering = "absolute" + GetLibraryItemsShowOrderingNone GetLibraryItemsShowOrdering = "None" + GetLibraryItemsShowOrderingTmdbAiring GetLibraryItemsShowOrdering = "tmdbAiring" + GetLibraryItemsShowOrderingTvdbAiring GetLibraryItemsShowOrdering = "tvdbAiring" + GetLibraryItemsShowOrderingTvdbDvd GetLibraryItemsShowOrdering = "tvdbDvd" + GetLibraryItemsShowOrderingTvdbAbsolute GetLibraryItemsShowOrdering = "tvdbAbsolute" ) func (e GetLibraryItemsShowOrdering) ToPointer() *GetLibraryItemsShowOrdering { @@ -675,11 +684,11 @@ func (e *GetLibraryItemsShowOrdering) UnmarshalJSON(data []byte) error { fallthrough case "tmdbAiring": fallthrough - case "aired": + case "tvdbAiring": fallthrough - case "dvd": + case "tvdbDvd": fallthrough - case "absolute": + case "tvdbAbsolute": *e = GetLibraryItemsShowOrdering(v) return nil default: @@ -1647,9 +1656,9 @@ type GetLibraryItemsMetadata struct { // Setting that indicates the episode ordering for the show // None = Library default, // tmdbAiring = The Movie Database (Aired), - // aired = TheTVDB (Aired), - // dvd = TheTVDB (DVD), - // absolute = TheTVDB (Absolute)). + // tvdbAiring = TheTVDB (Aired), + // tvdbDvd = TheTVDB (DVD), + // tvdbAbsolute = TheTVDB (Absolute)). // ShowOrdering *GetLibraryItemsShowOrdering `json:"showOrdering,omitempty"` Thumb *string `json:"thumb,omitempty"` diff --git a/models/operations/getmetadatabyratingkey.go b/models/operations/getmetadatabyratingkey.go index c709b59..86e2f27 100644 --- a/models/operations/getmetadatabyratingkey.go +++ b/models/operations/getmetadatabyratingkey.go @@ -782,15 +782,25 @@ func (o *Producer) GetThumb() *string { } type GetMetaDataByRatingKeyMetadata struct { - RatingKey *string `json:"ratingKey,omitempty"` - Key *string `json:"key,omitempty"` - GUID *string `json:"guid,omitempty"` - Studio *string `json:"studio,omitempty"` - Type *string `json:"type,omitempty"` - Title *string `json:"title,omitempty"` - LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"` - LibrarySectionID *int `json:"librarySectionID,omitempty"` - LibrarySectionKey *string `json:"librarySectionKey,omitempty"` + RatingKey *string `json:"ratingKey,omitempty"` + Key *string `json:"key,omitempty"` + GUID *string `json:"guid,omitempty"` + Studio *string `json:"studio,omitempty"` + Type *string `json:"type,omitempty"` + Title *string `json:"title,omitempty"` + LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"` + LibrarySectionID *int `json:"librarySectionID,omitempty"` + LibrarySectionKey *string `json:"librarySectionKey,omitempty"` + // The name of the album artist for the track when audio, and the name of the TV show for the episode when video. + GrandparentTitle *string `json:"grandparentTitle,omitempty"` + // The name of the album for the track when audio, and the name of the season for the episode when TV show. + ParentTitle *string `json:"parentTitle,omitempty"` + // The orginal untranslated name of the media item when non-english. + OriginalTitle *string `json:"originalTitle,omitempty"` + // The index starting from 0 of this media item in the MetaData array. + Index *int64 `json:"index,omitempty"` + // The parent index starting from 0 of this media item in the parent MetaData array. + ParentIndex *int64 `json:"parentIndex,omitempty"` ContentRating *string `json:"contentRating,omitempty"` Summary *string `json:"summary,omitempty"` Rating *float64 `json:"rating,omitempty"` @@ -891,6 +901,41 @@ func (o *GetMetaDataByRatingKeyMetadata) GetLibrarySectionKey() *string { return o.LibrarySectionKey } +func (o *GetMetaDataByRatingKeyMetadata) GetGrandparentTitle() *string { + if o == nil { + return nil + } + return o.GrandparentTitle +} + +func (o *GetMetaDataByRatingKeyMetadata) GetParentTitle() *string { + if o == nil { + return nil + } + return o.ParentTitle +} + +func (o *GetMetaDataByRatingKeyMetadata) GetOriginalTitle() *string { + if o == nil { + return nil + } + return o.OriginalTitle +} + +func (o *GetMetaDataByRatingKeyMetadata) GetIndex() *int64 { + if o == nil { + return nil + } + return o.Index +} + +func (o *GetMetaDataByRatingKeyMetadata) GetParentIndex() *int64 { + if o == nil { + return nil + } + return o.ParentIndex +} + func (o *GetMetaDataByRatingKeyMetadata) GetContentRating() *string { if o == nil { return nil diff --git a/models/operations/getpin.go b/models/operations/getpin.go index c6ce7fd..5ce24e7 100644 --- a/models/operations/getpin.go +++ b/models/operations/getpin.go @@ -12,54 +12,6 @@ var GetPinServerList = []string{ "https://plex.tv/api/v2", } -type GetPinGlobals struct { - // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) - ClientID *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` - // The name of the client application. (Plex Web, Plex Media Server, etc.) - ClientName *string `header:"style=simple,explode=false,name=X-Plex-Product"` - // A relatively friendly name for the client device - DeviceNickname *string `header:"style=simple,explode=false,name=X-Plex-Device"` - // The version of the client application. - ClientVersion *string `header:"style=simple,explode=false,name=X-Plex-Version"` - // The platform of the client application. - Platform *string `header:"style=simple,explode=false,name=X-Plex-Platform"` -} - -func (o *GetPinGlobals) GetClientID() *string { - if o == nil { - return nil - } - return o.ClientID -} - -func (o *GetPinGlobals) GetClientName() *string { - if o == nil { - return nil - } - return o.ClientName -} - -func (o *GetPinGlobals) GetDeviceNickname() *string { - if o == nil { - return nil - } - return o.DeviceNickname -} - -func (o *GetPinGlobals) GetClientVersion() *string { - if o == nil { - return nil - } - return o.ClientVersion -} - -func (o *GetPinGlobals) GetPlatform() *string { - if o == nil { - return nil - } - return o.Platform -} - type GetPinRequest struct { // Determines the kind of code returned by the API call // Strong codes are used for Pin authentication flows @@ -67,7 +19,7 @@ type GetPinRequest struct { // Strong *bool `default:"false" queryParam:"style=form,explode=true,name=strong"` // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) - ClientID *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` + ClientID string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` // The name of the client application. (Plex Web, Plex Media Server, etc.) ClientName *string `header:"style=simple,explode=false,name=X-Plex-Product"` // A relatively friendly name for the client device @@ -96,9 +48,9 @@ func (o *GetPinRequest) GetStrong() *bool { return o.Strong } -func (o *GetPinRequest) GetClientID() *string { +func (o *GetPinRequest) GetClientID() string { if o == nil { - return nil + return "" } return o.ClientID } diff --git a/models/operations/getplaylistcontents.go b/models/operations/getplaylistcontents.go index e74f7b7..f3ad59f 100644 --- a/models/operations/getplaylistcontents.go +++ b/models/operations/getplaylistcontents.go @@ -24,6 +24,8 @@ const ( GetPlaylistContentsQueryParamTypeSeason GetPlaylistContentsQueryParamType = 3 GetPlaylistContentsQueryParamTypeEpisode GetPlaylistContentsQueryParamType = 4 GetPlaylistContentsQueryParamTypeAudio GetPlaylistContentsQueryParamType = 8 + GetPlaylistContentsQueryParamTypeAlbum GetPlaylistContentsQueryParamType = 9 + GetPlaylistContentsQueryParamTypeTrack GetPlaylistContentsQueryParamType = 10 ) func (e GetPlaylistContentsQueryParamType) ToPointer() *GetPlaylistContentsQueryParamType { @@ -44,6 +46,10 @@ func (e *GetPlaylistContentsQueryParamType) UnmarshalJSON(data []byte) error { case 4: fallthrough case 8: + fallthrough + case 9: + fallthrough + case 10: *e = GetPlaylistContentsQueryParamType(v) return nil default: diff --git a/models/operations/getrecentlyadded.go b/models/operations/getrecentlyadded.go index f947b73..5687dce 100644 --- a/models/operations/getrecentlyadded.go +++ b/models/operations/getrecentlyadded.go @@ -24,6 +24,8 @@ const ( TypeSeason Type = 3 TypeEpisode Type = 4 TypeAudio Type = 8 + TypeAlbum Type = 9 + TypeTrack Type = 10 ) func (e Type) ToPointer() *Type { @@ -44,6 +46,10 @@ func (e *Type) UnmarshalJSON(data []byte) error { case 4: fallthrough case 8: + fallthrough + case 9: + fallthrough + case 10: *e = Type(v) return nil default: @@ -561,17 +567,17 @@ func (e *FlattenSeasons) UnmarshalJSON(data []byte) error { // ShowOrdering - Setting that indicates the episode ordering for the show // None = Library default, // tmdbAiring = The Movie Database (Aired), -// aired = TheTVDB (Aired), -// dvd = TheTVDB (DVD), -// absolute = TheTVDB (Absolute)). +// tvdbAiring = TheTVDB (Aired), +// tvdbDvd = TheTVDB (DVD), +// tvdbAbsolute = TheTVDB (Absolute)). type ShowOrdering string const ( - ShowOrderingNone ShowOrdering = "None" - ShowOrderingTmdbAiring ShowOrdering = "tmdbAiring" - ShowOrderingAired ShowOrdering = "aired" - ShowOrderingDvd ShowOrdering = "dvd" - ShowOrderingAbsolute ShowOrdering = "absolute" + ShowOrderingNone ShowOrdering = "None" + ShowOrderingTmdbAiring ShowOrdering = "tmdbAiring" + ShowOrderingTvdbAiring ShowOrdering = "tvdbAiring" + ShowOrderingTvdbDvd ShowOrdering = "tvdbDvd" + ShowOrderingTvdbAbsolute ShowOrdering = "tvdbAbsolute" ) func (e ShowOrdering) ToPointer() *ShowOrdering { @@ -587,11 +593,11 @@ func (e *ShowOrdering) UnmarshalJSON(data []byte) error { fallthrough case "tmdbAiring": fallthrough - case "aired": + case "tvdbAiring": fallthrough - case "dvd": + case "tvdbDvd": fallthrough - case "absolute": + case "tvdbAbsolute": *e = ShowOrdering(v) return nil default: @@ -1559,9 +1565,9 @@ type GetRecentlyAddedMetadata struct { // Setting that indicates the episode ordering for the show // None = Library default, // tmdbAiring = The Movie Database (Aired), - // aired = TheTVDB (Aired), - // dvd = TheTVDB (DVD), - // absolute = TheTVDB (Absolute)). + // tvdbAiring = TheTVDB (Aired), + // tvdbDvd = TheTVDB (DVD), + // tvdbAbsolute = TheTVDB (Absolute)). // ShowOrdering *ShowOrdering `json:"showOrdering,omitempty"` Thumb *string `json:"thumb,omitempty"` diff --git a/models/operations/getrecentlyaddedlibrary.go b/models/operations/getrecentlyaddedlibrary.go index 9ac972a..ae9e3a6 100644 --- a/models/operations/getrecentlyaddedlibrary.go +++ b/models/operations/getrecentlyaddedlibrary.go @@ -24,6 +24,8 @@ const ( QueryParamTypeSeason QueryParamType = 3 QueryParamTypeEpisode QueryParamType = 4 QueryParamTypeAudio QueryParamType = 8 + QueryParamTypeAlbum QueryParamType = 9 + QueryParamTypeTrack QueryParamType = 10 ) func (e QueryParamType) ToPointer() *QueryParamType { @@ -44,6 +46,10 @@ func (e *QueryParamType) UnmarshalJSON(data []byte) error { case 4: fallthrough case 8: + fallthrough + case 9: + fallthrough + case 10: *e = QueryParamType(v) return nil default: diff --git a/models/operations/getsearchalllibraries.go b/models/operations/getsearchalllibraries.go index 56e8472..5be93df 100644 --- a/models/operations/getsearchalllibraries.go +++ b/models/operations/getsearchalllibraries.go @@ -10,18 +10,6 @@ import ( "net/http" ) -type GetSearchAllLibrariesGlobals struct { - // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) - ClientID *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` -} - -func (o *GetSearchAllLibrariesGlobals) GetClientID() *string { - if o == nil { - return nil - } - return o.ClientID -} - type SearchTypes string const ( @@ -115,7 +103,7 @@ type GetSearchAllLibrariesRequest struct { // The search query term. Query string `queryParam:"style=form,explode=true,name=query"` // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) - ClientID *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` + ClientID string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` // Limit the number of results returned. Limit *int64 `queryParam:"style=form,explode=true,name=limit"` // A comma-separated list of search types to include. Valid values are: movies, music, otherVideos, people, tv. @@ -145,9 +133,9 @@ func (o *GetSearchAllLibrariesRequest) GetQuery() string { return o.Query } -func (o *GetSearchAllLibrariesRequest) GetClientID() *string { +func (o *GetSearchAllLibrariesRequest) GetClientID() string { if o == nil { - return nil + return "" } return o.ClientID } @@ -242,17 +230,17 @@ func (e *GetSearchAllLibrariesFlattenSeasons) UnmarshalJSON(data []byte) error { // GetSearchAllLibrariesShowOrdering - Setting that indicates the episode ordering for the show // None = Library default, // tmdbAiring = The Movie Database (Aired), -// aired = TheTVDB (Aired), -// dvd = TheTVDB (DVD), -// absolute = TheTVDB (Absolute)). +// tvdbAiring = TheTVDB (Aired), +// tvdbDvd = TheTVDB (DVD), +// tvdbAbsolute = TheTVDB (Absolute)). type GetSearchAllLibrariesShowOrdering string const ( - GetSearchAllLibrariesShowOrderingNone GetSearchAllLibrariesShowOrdering = "None" - GetSearchAllLibrariesShowOrderingTmdbAiring GetSearchAllLibrariesShowOrdering = "tmdbAiring" - GetSearchAllLibrariesShowOrderingAired GetSearchAllLibrariesShowOrdering = "aired" - GetSearchAllLibrariesShowOrderingDvd GetSearchAllLibrariesShowOrdering = "dvd" - GetSearchAllLibrariesShowOrderingAbsolute GetSearchAllLibrariesShowOrdering = "absolute" + GetSearchAllLibrariesShowOrderingNone GetSearchAllLibrariesShowOrdering = "None" + GetSearchAllLibrariesShowOrderingTmdbAiring GetSearchAllLibrariesShowOrdering = "tmdbAiring" + GetSearchAllLibrariesShowOrderingTvdbAiring GetSearchAllLibrariesShowOrdering = "tvdbAiring" + GetSearchAllLibrariesShowOrderingTvdbDvd GetSearchAllLibrariesShowOrdering = "tvdbDvd" + GetSearchAllLibrariesShowOrderingTvdbAbsolute GetSearchAllLibrariesShowOrdering = "tvdbAbsolute" ) func (e GetSearchAllLibrariesShowOrdering) ToPointer() *GetSearchAllLibrariesShowOrdering { @@ -268,11 +256,11 @@ func (e *GetSearchAllLibrariesShowOrdering) UnmarshalJSON(data []byte) error { fallthrough case "tmdbAiring": fallthrough - case "aired": + case "tvdbAiring": fallthrough - case "dvd": + case "tvdbDvd": fallthrough - case "absolute": + case "tvdbAbsolute": *e = GetSearchAllLibrariesShowOrdering(v) return nil default: @@ -1240,9 +1228,9 @@ type GetSearchAllLibrariesMetadata struct { // Setting that indicates the episode ordering for the show // None = Library default, // tmdbAiring = The Movie Database (Aired), - // aired = TheTVDB (Aired), - // dvd = TheTVDB (DVD), - // absolute = TheTVDB (Absolute)). + // tvdbAiring = TheTVDB (Aired), + // tvdbDvd = TheTVDB (DVD), + // tvdbAbsolute = TheTVDB (Absolute)). // ShowOrdering *GetSearchAllLibrariesShowOrdering `json:"showOrdering,omitempty"` Thumb *string `json:"thumb,omitempty"` diff --git a/models/operations/getsearchlibrary.go b/models/operations/getsearchlibrary.go index 79076f1..69947ef 100644 --- a/models/operations/getsearchlibrary.go +++ b/models/operations/getsearchlibrary.go @@ -22,6 +22,8 @@ const ( GetSearchLibraryQueryParamTypeSeason GetSearchLibraryQueryParamType = 3 GetSearchLibraryQueryParamTypeEpisode GetSearchLibraryQueryParamType = 4 GetSearchLibraryQueryParamTypeAudio GetSearchLibraryQueryParamType = 8 + GetSearchLibraryQueryParamTypeAlbum GetSearchLibraryQueryParamType = 9 + GetSearchLibraryQueryParamTypeTrack GetSearchLibraryQueryParamType = 10 ) func (e GetSearchLibraryQueryParamType) ToPointer() *GetSearchLibraryQueryParamType { @@ -42,6 +44,10 @@ func (e *GetSearchLibraryQueryParamType) UnmarshalJSON(data []byte) error { case 4: fallthrough case 8: + fallthrough + case 9: + fallthrough + case 10: *e = GetSearchLibraryQueryParamType(v) return nil default: diff --git a/models/operations/getserverresources.go b/models/operations/getserverresources.go index 61fa0d5..7956f8d 100644 --- a/models/operations/getserverresources.go +++ b/models/operations/getserverresources.go @@ -14,18 +14,6 @@ var GetServerResourcesServerList = []string{ "https://plex.tv/api/v2", } -type GetServerResourcesGlobals struct { - // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) - ClientID *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` -} - -func (o *GetServerResourcesGlobals) GetClientID() *string { - if o == nil { - return nil - } - return o.ClientID -} - // IncludeHTTPS - Include Https entries in the results type IncludeHTTPS int @@ -118,7 +106,7 @@ type GetServerResourcesRequest struct { // Include IPv6 entries in the results IncludeIPv6 *IncludeIPv6 `default:"0" queryParam:"style=form,explode=true,name=includeIPv6"` // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) - ClientID *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` + ClientID string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` } func (g GetServerResourcesRequest) MarshalJSON() ([]byte, error) { @@ -153,9 +141,9 @@ func (o *GetServerResourcesRequest) GetIncludeIPv6() *IncludeIPv6 { return o.IncludeIPv6 } -func (o *GetServerResourcesRequest) GetClientID() *string { +func (o *GetServerResourcesRequest) GetClientID() string { if o == nil { - return nil + return "" } return o.ClientID } diff --git a/models/operations/gettokenbypinid.go b/models/operations/gettokenbypinid.go index 5f4ad99..7d275c7 100644 --- a/models/operations/gettokenbypinid.go +++ b/models/operations/gettokenbypinid.go @@ -12,59 +12,11 @@ var GetTokenByPinIDServerList = []string{ "https://plex.tv/api/v2", } -type GetTokenByPinIDGlobals struct { - // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) - ClientID *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` - // The name of the client application. (Plex Web, Plex Media Server, etc.) - ClientName *string `header:"style=simple,explode=false,name=X-Plex-Product"` - // A relatively friendly name for the client device - DeviceNickname *string `header:"style=simple,explode=false,name=X-Plex-Device"` - // The version of the client application. - ClientVersion *string `header:"style=simple,explode=false,name=X-Plex-Version"` - // The platform of the client application. - Platform *string `header:"style=simple,explode=false,name=X-Plex-Platform"` -} - -func (o *GetTokenByPinIDGlobals) GetClientID() *string { - if o == nil { - return nil - } - return o.ClientID -} - -func (o *GetTokenByPinIDGlobals) GetClientName() *string { - if o == nil { - return nil - } - return o.ClientName -} - -func (o *GetTokenByPinIDGlobals) GetDeviceNickname() *string { - if o == nil { - return nil - } - return o.DeviceNickname -} - -func (o *GetTokenByPinIDGlobals) GetClientVersion() *string { - if o == nil { - return nil - } - return o.ClientVersion -} - -func (o *GetTokenByPinIDGlobals) GetPlatform() *string { - if o == nil { - return nil - } - return o.Platform -} - type GetTokenByPinIDRequest struct { // The PinID to retrieve an access token for PinID int64 `pathParam:"style=simple,explode=false,name=pinID"` // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) - ClientID *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` + ClientID string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` // The name of the client application. (Plex Web, Plex Media Server, etc.) ClientName *string `header:"style=simple,explode=false,name=X-Plex-Product"` // A relatively friendly name for the client device @@ -82,9 +34,9 @@ func (o *GetTokenByPinIDRequest) GetPinID() int64 { return o.PinID } -func (o *GetTokenByPinIDRequest) GetClientID() *string { +func (o *GetTokenByPinIDRequest) GetClientID() string { if o == nil { - return nil + return "" } return o.ClientID } diff --git a/models/operations/gettopwatchedcontent.go b/models/operations/gettopwatchedcontent.go index a8d2bbc..c848905 100644 --- a/models/operations/gettopwatchedcontent.go +++ b/models/operations/gettopwatchedcontent.go @@ -24,6 +24,8 @@ const ( GetTopWatchedContentQueryParamTypeSeason GetTopWatchedContentQueryParamType = 3 GetTopWatchedContentQueryParamTypeEpisode GetTopWatchedContentQueryParamType = 4 GetTopWatchedContentQueryParamTypeAudio GetTopWatchedContentQueryParamType = 8 + GetTopWatchedContentQueryParamTypeAlbum GetTopWatchedContentQueryParamType = 9 + GetTopWatchedContentQueryParamTypeTrack GetTopWatchedContentQueryParamType = 10 ) func (e GetTopWatchedContentQueryParamType) ToPointer() *GetTopWatchedContentQueryParamType { @@ -44,6 +46,10 @@ func (e *GetTopWatchedContentQueryParamType) UnmarshalJSON(data []byte) error { case 4: fallthrough case 8: + fallthrough + case 9: + fallthrough + case 10: *e = GetTopWatchedContentQueryParamType(v) return nil default: diff --git a/models/operations/options.go b/models/operations/options.go index b0b2165..41bc494 100644 --- a/models/operations/options.go +++ b/models/operations/options.go @@ -12,7 +12,6 @@ import ( var ErrUnsupportedOption = errors.New("unsupported option") const ( - SupportedOptionServerURL = "serverURL" SupportedOptionRetries = "retries" SupportedOptionTimeout = "timeout" SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride" @@ -36,6 +35,7 @@ type Options struct { Timeout *time.Duration AcceptHeaderOverride *AcceptHeaderEnum URLOverride *string + SetHeaders map[string]string } type Option func(*Options, ...string) error @@ -43,10 +43,6 @@ 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 } @@ -55,10 +51,6 @@ func WithServerURL(serverURL string) Option { // 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) } @@ -114,3 +106,12 @@ func WithURLOverride(urlOverride string) Option { return nil } } + +// WithSetHeaders takes a map of headers that will applied to a request. If the +// request contains headers that are in the map then they will be overwritten. +func WithSetHeaders(hdrs map[string]string) Option { + return func(opts *Options, supportedOptions ...string) error { + opts.SetHeaders = hdrs + return nil + } +} diff --git a/models/operations/postuserssignindata.go b/models/operations/postuserssignindata.go index 34d7864..ff0152d 100644 --- a/models/operations/postuserssignindata.go +++ b/models/operations/postuserssignindata.go @@ -13,54 +13,6 @@ var PostUsersSignInDataServerList = []string{ "https://plex.tv/api/v2", } -type PostUsersSignInDataGlobals struct { - // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) - ClientID *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` - // The name of the client application. (Plex Web, Plex Media Server, etc.) - ClientName *string `header:"style=simple,explode=false,name=X-Plex-Product"` - // A relatively friendly name for the client device - DeviceNickname *string `header:"style=simple,explode=false,name=X-Plex-Device"` - // The version of the client application. - ClientVersion *string `header:"style=simple,explode=false,name=X-Plex-Version"` - // The platform of the client application. - Platform *string `header:"style=simple,explode=false,name=X-Plex-Platform"` -} - -func (o *PostUsersSignInDataGlobals) GetClientID() *string { - if o == nil { - return nil - } - return o.ClientID -} - -func (o *PostUsersSignInDataGlobals) GetClientName() *string { - if o == nil { - return nil - } - return o.ClientName -} - -func (o *PostUsersSignInDataGlobals) GetDeviceNickname() *string { - if o == nil { - return nil - } - return o.DeviceNickname -} - -func (o *PostUsersSignInDataGlobals) GetClientVersion() *string { - if o == nil { - return nil - } - return o.ClientVersion -} - -func (o *PostUsersSignInDataGlobals) GetPlatform() *string { - if o == nil { - return nil - } - return o.Platform -} - // PostUsersSignInDataRequestBody - Login credentials type PostUsersSignInDataRequestBody struct { Login string `form:"name=login"` @@ -110,7 +62,7 @@ func (o *PostUsersSignInDataRequestBody) GetVerificationCode() *string { type PostUsersSignInDataRequest struct { // An opaque identifier unique to the client (UUID, serial number, or other unique device ID) - ClientID *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` + ClientID string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` // The name of the client application. (Plex Web, Plex Media Server, etc.) ClientName *string `header:"style=simple,explode=false,name=X-Plex-Product"` // A relatively friendly name for the client device @@ -123,9 +75,9 @@ type PostUsersSignInDataRequest struct { RequestBody *PostUsersSignInDataRequestBody `request:"mediaType=application/x-www-form-urlencoded"` } -func (o *PostUsersSignInDataRequest) GetClientID() *string { +func (o *PostUsersSignInDataRequest) GetClientID() string { if o == nil { - return nil + return "" } return o.ClientID } diff --git a/playlists.go b/playlists.go index 724c200..a9400c0 100644 --- a/playlists.go +++ b/playlists.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -53,7 +53,12 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/playlists") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -85,6 +90,10 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -115,7 +124,11 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -289,7 +302,12 @@ func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.P } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/playlists") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -321,6 +339,10 @@ func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.P return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -351,7 +373,11 @@ func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.P req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -525,7 +551,12 @@ func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64, opts .. } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -553,6 +584,10 @@ func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64, opts .. return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -583,7 +618,11 @@ func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64, opts .. req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -756,7 +795,12 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64, opts } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -784,6 +828,10 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64, opts return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -814,7 +862,11 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64, opts req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -969,7 +1021,12 @@ func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, titl } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1001,6 +1058,10 @@ func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, titl return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1031,7 +1092,11 @@ func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, titl req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1188,7 +1253,12 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}/items", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1220,6 +1290,10 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1250,7 +1324,11 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1423,7 +1501,12 @@ func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float6 } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}/items", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1451,6 +1534,10 @@ func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float6 return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1481,7 +1568,11 @@ func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float6 req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1637,7 +1728,12 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}/items", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1669,6 +1765,10 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1699,7 +1799,11 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1874,7 +1978,12 @@ func (s *Playlists) UploadPlaylist(ctx context.Context, path string, force opera } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/playlists/upload") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1906,6 +2015,10 @@ func (s *Playlists) UploadPlaylist(ctx context.Context, path string, force opera return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1936,7 +2049,11 @@ func (s *Playlists) UploadPlaylist(ctx context.Context, path string, force opera req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/plex.go b/plex.go index c6ccd24..aa1123e 100644 --- a/plex.go +++ b/plex.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -38,7 +38,6 @@ func (s *Plex) GetCompanionsData(ctx context.Context, opts ...operations.Option) o := operations.Options{} supportedOptions := []string{ - operations.SupportedOptionServerURL, operations.SupportedOptionRetries, operations.SupportedOptionTimeout, } @@ -81,6 +80,10 @@ func (s *Plex) GetCompanionsData(ctx context.Context, opts ...operations.Option) return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -111,7 +114,11 @@ func (s *Plex) GetCompanionsData(ctx context.Context, opts ...operations.Option) req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -270,7 +277,6 @@ func (s *Plex) GetUserFriends(ctx context.Context, opts ...operations.Option) (* o := operations.Options{} supportedOptions := []string{ - operations.SupportedOptionServerURL, operations.SupportedOptionRetries, operations.SupportedOptionTimeout, } @@ -313,6 +319,10 @@ func (s *Plex) GetUserFriends(ctx context.Context, opts ...operations.Option) (* return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -343,7 +353,11 @@ func (s *Plex) GetUserFriends(ctx context.Context, opts ...operations.Option) (* req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -502,7 +516,6 @@ func (s *Plex) GetGeoData(ctx context.Context, opts ...operations.Option) (*oper o := operations.Options{} supportedOptions := []string{ - operations.SupportedOptionServerURL, operations.SupportedOptionRetries, operations.SupportedOptionTimeout, } @@ -541,6 +554,10 @@ func (s *Plex) GetGeoData(ctx context.Context, opts ...operations.Option) (*oper req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -571,7 +588,11 @@ func (s *Plex) GetGeoData(ctx context.Context, opts ...operations.Option) (*oper req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -740,7 +761,12 @@ func (s *Plex) GetHomeData(ctx context.Context, opts ...operations.Option) (*ope } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/home") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -768,6 +794,10 @@ func (s *Plex) GetHomeData(ctx context.Context, opts ...operations.Option) (*ope return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -798,7 +828,11 @@ func (s *Plex) GetHomeData(ctx context.Context, opts ...operations.Option) (*ope req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -947,7 +981,7 @@ func (s *Plex) GetHomeData(ctx context.Context, opts ...operations.Option) (*ope // GetServerResources - Get Server Resources // Get Plex server access tokens and server connections -func (s *Plex) GetServerResources(ctx context.Context, includeHTTPS *operations.IncludeHTTPS, includeRelay *operations.IncludeRelay, includeIPv6 *operations.IncludeIPv6, clientID *string, opts ...operations.Option) (*operations.GetServerResourcesResponse, error) { +func (s *Plex) GetServerResources(ctx context.Context, clientID string, includeHTTPS *operations.IncludeHTTPS, includeRelay *operations.IncludeRelay, includeIPv6 *operations.IncludeIPv6, opts ...operations.Option) (*operations.GetServerResourcesResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "get-server-resources", @@ -962,13 +996,8 @@ func (s *Plex) GetServerResources(ctx context.Context, includeHTTPS *operations. ClientID: clientID, } - globals := operations.GetServerResourcesGlobals{ - ClientID: s.sdkConfiguration.Globals.ClientID, - } - o := operations.Options{} supportedOptions := []string{ - operations.SupportedOptionServerURL, operations.SupportedOptionRetries, operations.SupportedOptionTimeout, } @@ -1007,9 +1036,9 @@ func (s *Plex) GetServerResources(ctx context.Context, includeHTTPS *operations. req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - utils.PopulateHeaders(ctx, req, request, globals) + utils.PopulateHeaders(ctx, req, request, nil) - if err := utils.PopulateQueryParams(ctx, req, request, globals); err != nil { + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } @@ -1017,6 +1046,10 @@ func (s *Plex) GetServerResources(ctx context.Context, includeHTTPS *operations. return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1047,7 +1080,11 @@ func (s *Plex) GetServerResources(ctx context.Context, includeHTTPS *operations. req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1204,17 +1241,8 @@ func (s *Plex) GetPin(ctx context.Context, request operations.GetPinRequest, opt SecuritySource: nil, } - globals := operations.GetPinGlobals{ - ClientID: s.sdkConfiguration.Globals.ClientID, - ClientName: s.sdkConfiguration.Globals.ClientName, - DeviceNickname: s.sdkConfiguration.Globals.DeviceNickname, - ClientVersion: s.sdkConfiguration.Globals.ClientVersion, - Platform: s.sdkConfiguration.Globals.Platform, - } - o := operations.Options{} supportedOptions := []string{ - operations.SupportedOptionServerURL, operations.SupportedOptionRetries, operations.SupportedOptionTimeout, } @@ -1253,12 +1281,16 @@ func (s *Plex) GetPin(ctx context.Context, request operations.GetPinRequest, opt req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - utils.PopulateHeaders(ctx, req, request, globals) + utils.PopulateHeaders(ctx, req, request, nil) - if err := utils.PopulateQueryParams(ctx, req, request, globals); err != nil { + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1289,7 +1321,11 @@ func (s *Plex) GetPin(ctx context.Context, request operations.GetPinRequest, opt req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1424,17 +1460,8 @@ func (s *Plex) GetTokenByPinID(ctx context.Context, request operations.GetTokenB SecuritySource: nil, } - globals := operations.GetTokenByPinIDGlobals{ - ClientID: s.sdkConfiguration.Globals.ClientID, - ClientName: s.sdkConfiguration.Globals.ClientName, - DeviceNickname: s.sdkConfiguration.Globals.DeviceNickname, - ClientVersion: s.sdkConfiguration.Globals.ClientVersion, - Platform: s.sdkConfiguration.Globals.Platform, - } - o := operations.Options{} supportedOptions := []string{ - operations.SupportedOptionServerURL, operations.SupportedOptionRetries, operations.SupportedOptionTimeout, } @@ -1450,7 +1477,7 @@ func (s *Plex) GetTokenByPinID(ctx context.Context, request operations.GetTokenB baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/pins/{pinID}", request, globals) + opURL, err := utils.GenerateURL(ctx, baseURL, "/pins/{pinID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -1473,7 +1500,11 @@ func (s *Plex) GetTokenByPinID(ctx context.Context, request operations.GetTokenB req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - utils.PopulateHeaders(ctx, req, request, globals) + utils.PopulateHeaders(ctx, req, request, nil) + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries @@ -1505,7 +1536,11 @@ func (s *Plex) GetTokenByPinID(ctx context.Context, request operations.GetTokenB req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/plexapi.go b/plexapi.go index fcc3a82..d77f955 100644 --- a/plexapi.go +++ b/plexapi.go @@ -6,7 +6,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/LukeHagar/plexgo/internal/globals" "github.com/LukeHagar/plexgo/internal/hooks" "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/components" @@ -58,7 +57,6 @@ type sdkConfiguration struct { SDKVersion string GenVersion string UserAgent string - Globals globals.Globals RetryConfig *retry.Config Hooks *hooks.Hooks Timeout *time.Duration @@ -281,41 +279,6 @@ func WithSecuritySource(security func(context.Context) (components.Security, err } } -// WithClientID allows setting the ClientID parameter for all supported operations -func WithClientID(clientID string) SDKOption { - return func(sdk *PlexAPI) { - sdk.sdkConfiguration.Globals.ClientID = &clientID - } -} - -// WithClientName allows setting the ClientName parameter for all supported operations -func WithClientName(clientName string) SDKOption { - return func(sdk *PlexAPI) { - sdk.sdkConfiguration.Globals.ClientName = &clientName - } -} - -// WithClientVersion allows setting the ClientVersion parameter for all supported operations -func WithClientVersion(clientVersion string) SDKOption { - return func(sdk *PlexAPI) { - sdk.sdkConfiguration.Globals.ClientVersion = &clientVersion - } -} - -// WithPlatform allows setting the Platform parameter for all supported operations -func WithPlatform(platform string) SDKOption { - return func(sdk *PlexAPI) { - sdk.sdkConfiguration.Globals.Platform = &platform - } -} - -// WithDeviceNickname allows setting the DeviceNickname parameter for all supported operations -func WithDeviceNickname(deviceNickname string) SDKOption { - return func(sdk *PlexAPI) { - sdk.sdkConfiguration.Globals.DeviceNickname = &deviceNickname - } -} - func WithRetryConfig(retryConfig retry.Config) SDKOption { return func(sdk *PlexAPI) { sdk.sdkConfiguration.RetryConfig = &retryConfig @@ -335,10 +298,9 @@ func New(opts ...SDKOption) *PlexAPI { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "0.0.3", - SDKVersion: "0.16.1", - GenVersion: "2.457.9", - UserAgent: "speakeasy-sdk/go 0.16.1 2.457.9 0.0.3 github.com/LukeHagar/plexgo", - Globals: globals.Globals{}, + SDKVersion: "0.17.0", + GenVersion: "2.483.1", + UserAgent: "speakeasy-sdk/go 0.17.0 2.483.1 0.0.3 github.com/LukeHagar/plexgo", ServerDefaults: []map[string]string{ { "protocol": "https", diff --git a/retry/config.go b/retry/config.go index c051b0a..aa4b334 100644 --- a/retry/config.go +++ b/retry/config.go @@ -2,6 +2,15 @@ package retry +import ( + "errors" + "net/http" + "strconv" + "time" +) + +// BackoffStrategy defines the parameters for exponential backoff. This can be +// used to drive a retry loop for example. type BackoffStrategy struct { InitialInterval int MaxInterval int @@ -9,8 +18,128 @@ type BackoffStrategy struct { MaxElapsedTime int } +// Config configures a retry policy. type Config struct { Strategy string Backoff *BackoffStrategy RetryConnectionErrors bool } + +// PermanentError is an error that signals that some operation has terminally +// failed and should not be retried. +type PermanentError struct { + cause error +} + +// Permanent creates a PermanentError that signals to a retry loop that it +// should stop retrying an operation and return the underlying error. +func Permanent(cause error) error { + if IsPermanentError(cause) { + return cause + } + + return &PermanentError{ + cause: cause, + } +} + +func (e *PermanentError) Error() string { + return e.cause.Error() +} + +func (e *PermanentError) Unwrap() error { + return e.cause +} + +// TemporaryError represents a retryable error and signals to a retry loop that +// an operation may be retried with an optional wait interval. +type TemporaryError struct { + wait time.Duration + message string +} + +// Temporary creates a TemporaryError that signals to a retry loop that an +// operation can be retried. The error may also carry details about how long to +// wait before retrying. This wait interval may be used to override the retry +// policy in use. +func Temporary(message string) error { + return &TemporaryError{ + message: message, + } +} + +// TemporaryFromResponse creates a TemporaryError similar to Temporary but +// additionally parses the Retry-After header from a response to determine the +// wait interval before the next retry attempt. +func TemporaryFromResponse(message string, res *http.Response) error { + return &TemporaryError{ + wait: retryIntervalFromResponse(res), + message: message, + } +} + +func (e *TemporaryError) Error() string { + return e.message +} + +// RetryAfter returns the time to wait before retrying the request. The zero +// value should be interpreted by retry loops to mean they should fallback on +// their default policy whether expenonential, constant backoff or something +// else. It does not mean that an operation should be retried immediately. +func (e *TemporaryError) RetryAfter() time.Duration { + return e.wait +} + +func retryIntervalFromResponse(res *http.Response) time.Duration { + if res == nil { + return 0 + } + + retryVal := res.Header.Get("retry-after") + if retryVal == "" { + return 0 + } + + parsedNumber, err := strconv.ParseInt(retryVal, 10, 64) + if err == nil { + if parsedNumber < 0 { + return 0 + } else { + return time.Duration(parsedNumber) * time.Second + } + } + + parsedDate, err := time.Parse(time.RFC1123, retryVal) + if err == nil { + delta := parsedDate.Sub(time.Now()) + if delta < 0 { + return 0 + } else { + return delta + } + } + + return 0 +} + +// IsPermanentError returns true if an error value is or contains a +// PermanentError in its chain of errors. +func IsPermanentError(err error) bool { + if err == nil { + return false + } + + var pe *PermanentError + return errors.As(err, &pe) +} + +// IsTemporaryError returns true if an error value is or contains a +// TemporaryError in its chain of errors. +func IsTemporaryError(err error) bool { + if err == nil { + return false + } + + var pe *TemporaryError + return errors.As(err, &pe) +} diff --git a/search.go b/search.go index 90a6498..8c84b5e 100644 --- a/search.go +++ b/search.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -66,7 +66,12 @@ func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *flo } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/hubs/search") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -98,6 +103,10 @@ func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *flo return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -128,7 +137,11 @@ func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *flo req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -286,7 +299,12 @@ func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/hubs/search/voice") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -318,6 +336,10 @@ func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -348,7 +370,11 @@ func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -501,7 +527,12 @@ func (s *Search) GetSearchResults(ctx context.Context, query string, opts ...ope } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/search") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -533,6 +564,10 @@ func (s *Search) GetSearchResults(ctx context.Context, query string, opts ...ope return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -563,7 +598,11 @@ func (s *Search) GetSearchResults(ctx context.Context, query string, opts ...ope req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/server.go b/server.go index ebee81c..3a233f8 100644 --- a/server.go +++ b/server.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -48,7 +48,12 @@ func (s *Server) GetServerCapabilities(ctx context.Context, opts ...operations.O } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -76,6 +81,10 @@ func (s *Server) GetServerCapabilities(ctx context.Context, opts ...operations.O return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -106,7 +115,11 @@ func (s *Server) GetServerCapabilities(ctx context.Context, opts ...operations.O req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -275,7 +288,12 @@ func (s *Server) GetServerPreferences(ctx context.Context, opts ...operations.Op } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/:/prefs") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -303,6 +321,10 @@ func (s *Server) GetServerPreferences(ctx context.Context, opts ...operations.Op return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -333,7 +355,11 @@ func (s *Server) GetServerPreferences(ctx context.Context, opts ...operations.Op req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -502,7 +528,12 @@ func (s *Server) GetAvailableClients(ctx context.Context, opts ...operations.Opt } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/clients") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -530,6 +561,10 @@ func (s *Server) GetAvailableClients(ctx context.Context, opts ...operations.Opt return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -560,7 +595,11 @@ func (s *Server) GetAvailableClients(ctx context.Context, opts ...operations.Opt req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -729,7 +768,12 @@ func (s *Server) GetDevices(ctx context.Context, opts ...operations.Option) (*op } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/devices") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -757,6 +801,10 @@ func (s *Server) GetDevices(ctx context.Context, opts ...operations.Option) (*op return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -787,7 +835,11 @@ func (s *Server) GetDevices(ctx context.Context, opts ...operations.Option) (*op req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -956,7 +1008,12 @@ func (s *Server) GetServerIdentity(ctx context.Context, opts ...operations.Optio } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/identity") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -980,6 +1037,10 @@ func (s *Server) GetServerIdentity(ctx context.Context, opts ...operations.Optio req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1010,7 +1071,11 @@ func (s *Server) GetServerIdentity(ctx context.Context, opts ...operations.Optio req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1157,7 +1222,12 @@ func (s *Server) GetMyPlexAccount(ctx context.Context, opts ...operations.Option } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/myplex/account") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1185,6 +1255,10 @@ func (s *Server) GetMyPlexAccount(ctx context.Context, opts ...operations.Option return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1215,7 +1289,11 @@ func (s *Server) GetMyPlexAccount(ctx context.Context, opts ...operations.Option req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1384,7 +1462,12 @@ func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResi } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/photo/:/transcode") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1416,6 +1499,10 @@ func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResi return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1446,7 +1533,11 @@ func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResi req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1599,7 +1690,12 @@ func (s *Server) GetMediaProviders(ctx context.Context, xPlexToken string, opts } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/media/providers") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1629,6 +1725,10 @@ func (s *Server) GetMediaProviders(ctx context.Context, xPlexToken string, opts return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1659,7 +1759,11 @@ func (s *Server) GetMediaProviders(ctx context.Context, xPlexToken string, opts req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -1828,7 +1932,12 @@ func (s *Server) GetServerList(ctx context.Context, opts ...operations.Option) ( } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/servers") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -1856,6 +1965,10 @@ func (s *Server) GetServerList(ctx context.Context, opts ...operations.Option) ( return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -1886,7 +1999,11 @@ func (s *Server) GetServerList(ctx context.Context, opts ...operations.Option) ( req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/sessions.go b/sessions.go index d7a9643..ea1ba48 100644 --- a/sessions.go +++ b/sessions.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -48,7 +48,12 @@ func (s *Sessions) GetSessions(ctx context.Context, opts ...operations.Option) ( } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/status/sessions") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -76,6 +81,10 @@ func (s *Sessions) GetSessions(ctx context.Context, opts ...operations.Option) ( return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -106,7 +115,11 @@ func (s *Sessions) GetSessions(ctx context.Context, opts ...operations.Option) ( req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -282,7 +295,12 @@ func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountI } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/status/sessions/history/all") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -314,6 +332,10 @@ func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountI return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -344,7 +366,11 @@ func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountI req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -513,7 +539,12 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context, opts ...operations. } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/transcode/sessions") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -541,6 +572,10 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context, opts ...operations. return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -571,7 +606,11 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context, opts ...operations. req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -744,7 +783,12 @@ func (s *Sessions) StopTranscodeSession(ctx context.Context, sessionKey string, } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := utils.GenerateURL(ctx, baseURL, "/transcode/sessions/{sessionKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -772,6 +816,10 @@ func (s *Sessions) StopTranscodeSession(ctx context.Context, sessionKey string, return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -802,7 +850,11 @@ func (s *Sessions) StopTranscodeSession(ctx context.Context, sessionKey string, req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/statistics.go b/statistics.go index 10c934e..6d07f56 100644 --- a/statistics.go +++ b/statistics.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -52,7 +52,12 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64, opts .. } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/statistics/media") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -84,6 +89,10 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64, opts .. return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -114,7 +123,11 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64, opts .. req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -287,7 +300,12 @@ func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64 } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/statistics/resources") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -319,6 +337,10 @@ func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64 return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -349,7 +371,11 @@ func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64 req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -522,7 +548,12 @@ func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64 } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/statistics/bandwidth") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -554,6 +585,10 @@ func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64 return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -584,7 +619,11 @@ func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64 req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/updater.go b/updater.go index 2c60697..d6a4221 100644 --- a/updater.go +++ b/updater.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -49,7 +49,12 @@ func (s *Updater) GetUpdateStatus(ctx context.Context, opts ...operations.Option } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/updater/status") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -77,6 +82,10 @@ func (s *Updater) GetUpdateStatus(ctx context.Context, opts ...operations.Option return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -107,7 +116,11 @@ func (s *Updater) GetUpdateStatus(ctx context.Context, opts ...operations.Option req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -280,7 +293,12 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/updater/check") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -312,6 +330,10 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -342,7 +364,11 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -496,7 +522,12 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/updater/apply") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -528,6 +559,10 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -558,7 +593,11 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/video.go b/video.go index 603c70d..fa66265 100644 --- a/video.go +++ b/video.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" "net/url" ) @@ -48,7 +48,12 @@ func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineR } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/:/timeline") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -80,6 +85,10 @@ func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineR return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -110,7 +119,11 @@ func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineR req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) @@ -259,7 +272,12 @@ func (s *Video) StartUniversalTranscode(ctx context.Context, request operations. } } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } opURL, err := url.JoinPath(baseURL, "/video/:/transcode/universal/start.mpd") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) @@ -291,6 +309,10 @@ func (s *Video) StartUniversalTranscode(ctx context.Context, request operations. return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -321,7 +343,11 @@ func (s *Video) StartUniversalTranscode(ctx context.Context, request operations. req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req) diff --git a/watchlist.go b/watchlist.go index 45f69f2..a32d929 100644 --- a/watchlist.go +++ b/watchlist.go @@ -10,7 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/cenkalti/backoff/v4" + "github.com/LukeHagar/plexgo/retry" "net/http" ) @@ -37,7 +37,6 @@ func (s *Watchlist) GetWatchList(ctx context.Context, request operations.GetWatc o := operations.Options{} supportedOptions := []string{ - operations.SupportedOptionServerURL, operations.SupportedOptionRetries, operations.SupportedOptionTimeout, } @@ -86,6 +85,10 @@ func (s *Watchlist) GetWatchList(ctx context.Context, request operations.GetWatc return nil, err } + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + globalRetryConfig := s.sdkConfiguration.RetryConfig retryConfig := o.Retries if retryConfig == nil { @@ -116,7 +119,11 @@ func (s *Watchlist) GetWatchList(ctx context.Context, request operations.GetWatc req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { - return nil, backoff.Permanent(err) + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) } httpRes, err := s.sdkConfiguration.Client.Do(req)